2024-01-06 06:05:13 +00:00
|
|
|
================================================================================
|
|
|
|
Simple Structure
|
|
|
|
================================================================================
|
|
|
|
|
|
|
|
struct {
|
|
|
|
x <int>
|
|
|
|
y <float>
|
|
|
|
}
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(root
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(value
|
2024-01-23 20:46:20 +00:00
|
|
|
(structure
|
|
|
|
(identifier)
|
|
|
|
(type_specification
|
|
|
|
(type))
|
|
|
|
(identifier)
|
|
|
|
(type_specification
|
|
|
|
(type)))))))
|
2024-01-06 06:05:13 +00:00
|
|
|
|
|
|
|
================================================================================
|
|
|
|
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
|
2024-01-23 20:46:20 +00:00
|
|
|
(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))))))))))))))
|