2024-01-06 06:05:13 +00:00
|
|
|
================================================================================
|
|
|
|
Simple Structure
|
|
|
|
================================================================================
|
|
|
|
|
2024-02-15 01:23:33 +00:00
|
|
|
struct Foo {
|
2024-01-06 06:05:13 +00:00
|
|
|
x <int>
|
|
|
|
y <float>
|
|
|
|
}
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(root
|
|
|
|
(statement
|
2024-02-15 01:23:33 +00:00
|
|
|
(type_definition
|
|
|
|
(struct_definition
|
|
|
|
(identifier)
|
|
|
|
(identifier)
|
|
|
|
(type_specification
|
|
|
|
(type))
|
|
|
|
(identifier)
|
|
|
|
(type_specification
|
|
|
|
(type))))))
|
2024-01-06 06:05:13 +00:00
|
|
|
|
|
|
|
================================================================================
|
2024-02-15 01:23:33 +00:00
|
|
|
Nested Structure
|
2024-01-06 06:05:13 +00:00
|
|
|
================================================================================
|
|
|
|
|
2024-02-15 01:23:33 +00:00
|
|
|
struct Foo {
|
2024-01-06 06:05:13 +00:00
|
|
|
x <int>
|
|
|
|
y <float> = 0.0
|
|
|
|
|
|
|
|
bar <Bar> = new Bar {
|
|
|
|
baz = 42
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(root
|
|
|
|
(statement
|
2024-02-15 01:23:33 +00:00
|
|
|
(type_definition
|
|
|
|
(struct_definition
|
|
|
|
(identifier)
|
|
|
|
(identifier)
|
|
|
|
(type_specification
|
|
|
|
(type))
|
|
|
|
(identifier)
|
|
|
|
(type_specification
|
|
|
|
(type))
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(float))))
|
|
|
|
(identifier)
|
|
|
|
(type_specification
|
|
|
|
(type
|
|
|
|
(identifier)))
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(struct_instance
|
|
|
|
(identifier)
|
|
|
|
(map
|
|
|
|
(identifier)
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(integer)))))))))))))
|