BGBCC BAON - cr88192/bgbtech_shxemu GitHub Wiki
New AST Node serialization to replace use of XML.
Node:
- { tag attr* }
- { tag attr* child* }
- var=int
- var=real
- var='shortstring'
- Shortstring is a string which may be interned.
- var="longstring"
- Longstring is a string which may be heap-allocated.
- var=node
- var= [node*]
- x+y
- {binary op='+' left={ref name='x'} right={ref name='y'}}
- x*2
- {binary op='*' left={ref name='x'} right={int value=2}}
- For binary nodes and similar, the left/right attributes are required to be nodes.
- Possibly could allow literal values in some cases, TBD.
- Many nodes may be expressed either as an attribute or as a node.
- {binary op='*' left={ref name='x'} right={int value=2}}
- {binary op='*' {left {ref name='x'}} {right {int value=2}}}
- { assign left right }
- left=right;
- { assign op left right }
- left=(left op right);
- { unary op value}
- (op value)
- { binary op left right }
- (left op right)
- { funcall name args }
- name(args)
- { defun name args body }
- Define function.
- { preinc name } | { postinc name } | { predec name } | { postdec name }
- { vars var* }
- { var name type }
- { var name type init }
- { proto name type args }
- { begin body* }
- Block of statements.
- { ref name }
- Variable referenced by name.
- { int value }
- Integer literal (32 or 64 bit).
- { real value }
- Floating point literal (float or double).
- { string value }
- String literal.
- { list expr* }
- List of expressions (array or struct literal).
- { struct name body }
- Struct definition (exists in structs list).
- { union name body }
- Struct definition (exists in structs list).
- { enum name body }
- Struct definition (exists in structs list).
- { module structs types body }