2023-11-11 01:44:03 +00:00
|
|
|
================================================================================
|
2024-01-04 17:10:31 +00:00
|
|
|
Simple Structure
|
2023-11-11 01:44:03 +00:00
|
|
|
================================================================================
|
2023-10-18 21:52:56 +00:00
|
|
|
|
2024-01-04 17:10:31 +00:00
|
|
|
struct { answer = 42 }
|
2023-10-18 21:52:56 +00:00
|
|
|
|
2023-11-11 01:44:03 +00:00
|
|
|
--------------------------------------------------------------------------------
|
2023-10-18 21:52:56 +00:00
|
|
|
|
|
|
|
(root
|
2023-11-11 01:44:03 +00:00
|
|
|
(statement
|
2023-11-16 06:59:48 +00:00
|
|
|
(expression
|
|
|
|
(value
|
2024-01-04 17:10:31 +00:00
|
|
|
(structure
|
2023-11-11 01:44:03 +00:00
|
|
|
(identifier)
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(integer)))))))))
|
2023-10-18 21:52:56 +00:00
|
|
|
|
2023-12-20 23:29:18 +00:00
|
|
|
================================================================================
|
2024-01-04 17:10:31 +00:00
|
|
|
Structure with Types
|
2023-12-20 23:29:18 +00:00
|
|
|
================================================================================
|
|
|
|
|
2024-01-04 17:10:31 +00:00
|
|
|
struct {
|
2023-12-20 23:29:18 +00:00
|
|
|
answer <num> = 42
|
|
|
|
stuff <[str]> = [ "some" "stuff" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(root
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(value
|
2024-01-04 17:10:31 +00:00
|
|
|
(structure
|
2023-12-20 23:29:18 +00:00
|
|
|
(identifier)
|
|
|
|
(type_definition
|
|
|
|
(type))
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(integer))))
|
|
|
|
(identifier)
|
|
|
|
(type_definition
|
|
|
|
(type
|
|
|
|
(type)))
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(list
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(string)))
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(string))))))))))))
|
|
|
|
|
2023-11-11 01:44:03 +00:00
|
|
|
================================================================================
|
2024-01-04 17:10:31 +00:00
|
|
|
Nested Structures
|
2023-11-11 01:44:03 +00:00
|
|
|
================================================================================
|
2023-10-18 21:52:56 +00:00
|
|
|
|
2024-01-04 17:10:31 +00:00
|
|
|
struct {
|
|
|
|
bar <Bar>
|
|
|
|
baz <Baz>
|
2023-11-28 16:01:38 +00:00
|
|
|
}
|
2023-10-18 21:52:56 +00:00
|
|
|
|
2023-11-11 01:44:03 +00:00
|
|
|
--------------------------------------------------------------------------------
|
2023-10-18 21:52:56 +00:00
|
|
|
|
|
|
|
(root
|
2023-11-11 01:44:03 +00:00
|
|
|
(statement
|
2024-01-04 17:10:31 +00:00
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(structure
|
|
|
|
(identifier)
|
|
|
|
(type_definition
|
|
|
|
(type
|
|
|
|
(identifier)))
|
|
|
|
(identifier)
|
|
|
|
(type_definition
|
|
|
|
(type
|
|
|
|
(identifier))))))))
|