73 lines
1.8 KiB
Plaintext
73 lines
1.8 KiB
Plaintext
================================================================================
|
|
Simple Structure
|
|
================================================================================
|
|
|
|
struct {
|
|
x <int>
|
|
y <float>
|
|
}
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(root
|
|
(statement
|
|
(expression
|
|
(value
|
|
(type_definition
|
|
(structure
|
|
(identifier)
|
|
(type_specification
|
|
(type))
|
|
(identifier)
|
|
(type_specification
|
|
(type))))))))
|
|
|
|
================================================================================
|
|
Complex Structure
|
|
================================================================================
|
|
|
|
Foo = struct {
|
|
x <int>
|
|
y <float> = 0.0
|
|
|
|
bar <Bar> = new Bar {
|
|
baz = 42
|
|
}
|
|
}
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(root
|
|
(statement
|
|
(assignment
|
|
(identifier)
|
|
(assignment_operator)
|
|
(statement
|
|
(expression
|
|
(value
|
|
(type_definition
|
|
(structure
|
|
(identifier)
|
|
(type_specification
|
|
(type))
|
|
(identifier)
|
|
(type_specification
|
|
(type))
|
|
(statement
|
|
(expression
|
|
(value
|
|
(float))))
|
|
(identifier)
|
|
(type_specification
|
|
(type
|
|
(identifier)))
|
|
(statement
|
|
(expression
|
|
(new
|
|
(identifier)
|
|
(identifier)
|
|
(statement
|
|
(expression
|
|
(value
|
|
(integer)))))))))))))))
|