2024-09-10 18:50:51 -05:00
|
|
|
|
|
|
|
|
|
|
|
declarations ::= <declaration> <declarations>
|
|
|
|
declaration ::= <enum_decl> | <struct_decl> | <type_decl> | <protocol_decl>
|
|
|
|
|
2024-09-10 19:18:11 -05:00
|
|
|
type_decl ::= "type" <ident> <ident> ";"
|
2024-09-10 18:50:51 -05:00
|
|
|
|
|
|
|
enum_decl ::= "enum" <ident> "{" "}"
|
|
|
|
| "enum" <ident> "{" <enum_members> "}"
|
|
|
|
|
|
|
|
|
|
|
|
enum_members ::= <enum_member> ["," <enum_member>]+ [","]
|
|
|
|
|
|
|
|
enum_member ::= <ident> "=" <number>
|
|
|
|
|
|
|
|
|
|
|
|
struct_decl ::= "struct" <ident> "{" "}"
|
|
|
|
| "struct" <ident> "{" <struct_members> "}"
|
|
|
|
|
|
|
|
struct_members ::= <struct_member>
|
|
|
|
| <struct_member> ","
|
|
|
|
| <struct_member> "," <struct_members>
|
|
|
|
| <struct_member> "," <struct_members>
|
|
|
|
|
2024-09-10 19:18:11 -05:00
|
|
|
protocol_decl ::= "protocol" <ident> "{" "}"
|
|
|
|
| "protocol" <ident> "{" <protocol_member>+ "}"
|
|
|
|
|
|
|
|
protocol_member ::= "fn" <ident>"("[<arg_list>]")" "->" <ident> ";"
|
|
|
|
|
|
|
|
arg_list ::= <ident> ["," <ident>]+
|
|
|
|
|