================================================================================ Simple Structure Definition ================================================================================ struct { answer = 42 } -------------------------------------------------------------------------------- (root (statement (expression (value (structure_definition (structure_instantiator (identifier) (statement (expression (value (integer)))))))))) ================================================================================ Structure Definition with Types ================================================================================ struct { answer = 42 stuff <[str]> = [ "some" "stuff" ] } -------------------------------------------------------------------------------- (root (statement (expression (value (structure_definition (structure_instantiator (identifier) (type_definition (type)) (statement (expression (value (integer)))) (identifier) (type_definition (type (type))) (statement (expression (value (list (expression (value (string))) (expression (value (string))))))))))))) ================================================================================ Nested Structure Definition ================================================================================ struct { bar baz } -------------------------------------------------------------------------------- (root (statement (expression (value (structure_definition (structure_instantiator (identifier) (type_definition (type (identifier))) (identifier) (type_definition (type (identifier))))))))) ================================================================================ Simple Structure ================================================================================ new Foo -------------------------------------------------------------------------------- (root (statement (expression (value (structure (identifier)))))) ================================================================================ Complex Structure ================================================================================ User = struct { id = random:integer() email name = none } bob = new User { email = "bob@example.come" } -------------------------------------------------------------------------------- (root (statement (assignment (identifier) (assignment_operator) (statement (expression (value (structure_definition (structure_instantiator (identifier) (type_definition (type)) (statement (expression (function_call (function_expression (index (index_expression (value (built_in_value))) (index_expression (identifier))))))) (identifier) (type_definition (type)) (identifier) (type_definition (type (type))) (statement (expression (value (option))))))))))) (statement (assignment (identifier) (assignment_operator) (statement (expression (value (structure (identifier) (structure_instantiator (identifier) (statement (expression (value (string))))))))))))