1
0
Fork 0
forked from AbleOS/ableos
ableos-idl/dev/aldi.bnf

32 lines
849 B
BNF

declarations ::= <declaration> <declarations>
declaration ::= <enum_decl> | <struct_decl> | <type_decl> | <protocol_decl>
type_decl ::= "type" <ident> <ident> ";"
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>
protocol_decl ::= "protocol" <ident> "{" "}"
| "protocol" <ident> "{" <protocol_member>+ "}"
protocol_member ::= "fn" <ident>"("[<arg_list>]")" "->" <ident> ";"
arg_list ::= <ident> ["," <ident>]+