Какая зима - такие и ёлки.

By logging in to LiveJournal using a third-party service you accept LiveJournal's User agreement
<?xml version="1.0" encoding="utf-8" ?> <module> <define name="hello"> <code> <print> <gettext name="arg"/> <str> </str> <getattr name="what"/> <get name="finish"/> </print> </code> </define> <main> <code> <hello what="World"> <arg>Hello</arg> <finish><str>!</str></finish> </hello> </code> </main> </module>
через аттрибуты
через вложенные тэги
<open flags="O_RDWR"><filename>...</filename></open>
<?xml version="1.0" encoding="utf-8" ?> <module> <function name="main"> <code> <print> <str>Hello World!</str> </print> </code> </function> </module>
#include <stdio.h> int main(int argc, char ** argv){ printf("Hello World!"); return 0; }
<?xml version="1.0" encoding="utf-8" ?> <module> <function name="main"> <code> <let name="i" type="int">5</let> <repeat> <pre-cond> <gt> <var name="i"/> <int>0</int> </gt> </pre-cond> <block> <print> <str>Iter </str> <var name="i"/> </print> </block> <post-cond> <dec name="i"/> </post-cond> </repeat> </code> </function> </module>
Iter 5 Iter 4 Iter 3 Iter 2 Iter 1
def tag_repeat(tag): preCondition = tag.find('pre-cond') postCondition = tag.find('post-cond') body = tag.find('block') while(preCondition == None or evalChilds(preCondition)): evalChilds(body) if postCondition != None and not evalChilds(postCondition): break
<repeat> <pre-condition/> <block/> <post-condition/> </repeat>
while(pre_condition){ .... if(!post_condition) break; }
<repeat> <block/> </repeat>
<?xml version="1.0" encoding="utf-8" ?>
<module>
<function name="main">
<code>
<let name="ld" type="string">ld</let>
<let name="w" type="string">Wor<var name="ld"/></let>
<print>
<str>Hello</str>
<var name="w"/>
<str>!</str>
</print>
<let name="a" type="int">3</let>
<let name="b" type="int">2</let>
<print><str>a + b = </str>
<add>
<var name="a"/>
<var name="b"/>
</add>
</print>
</code>
</function>
</module>
И ведь работает. При интерпретаторе менее 100 строк на python.
mysql> explain select uid from log l where '2016-12-31' <= l.startday ; +----+-------------+-------+-------+---------------+----------+---------+------+---------+-----------------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+-------+-------+---------------+----------+---------+------+---------+-----------------------+ | 1 | SIMPLE | l | range | startday | startday | 3 | NULL | 8370032 | Using index condition | +----+-------------+-------+-------+---------------+----------+---------+------+---------+-----------------------+ 1 row in set (0,00 sec) mysql> explain select uid from log l where '2016-11-31' <= l.startday ; +----+-------------+-------+------+---------------+------+---------+------+----------+-------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+-------+------+---------------+------+---------+------+----------+-------------+ | 1 | SIMPLE | l | ALL | startday | NULL | NULL | NULL | 65140960 | Using where | +----+-------------+-------+------+---------------+------+---------+------+----------+-------------+ 1 row in set (0,21 sec)
#include <stdio.h> #include <string.h> void something_wrong() { //(1) char * p; strcpy(p, "Hello"); printf("%s World\n", p); } void some_other_code() { } int main() { some_other_code(); something_wrong(); return 0; }