1
0
Fork 0
trinitrix/trixy/trixy-lang_parser/docs/grammar.ebnf

20 lines
728 B
EBNF

# (*
# Trixy is fully whitespace independent, this means that you can
# interleave whitespace in the definitions.
# The same applies to comments:
# - Line comments (`// \n`) and
# - Block comments (`/* */`).
# *)
CommandSpec = { Function | Namespace | Enumeration | Structure } ;
Function = "fn" Identifier "(" [NamedType {"," NamedType }] ")" [ "->" Type ] ";" ;
Namespace = "nasp" Identifier "{" {Function | Namespace | Enumeration | Structure} "}" ;
Structure = "struct" Identifier "{" [NamedType {"," NamedType } [","]] "}" ";";
Enumeration = "enum" Identifier "{" [Identifier {"," Identifier} [","]] "}" ";";
Identifier = CHARACTER { NUMBER | CHARACTER } ;
NamedType = Identifier ":" Type;
# (*
# vim: ft=ebnf
# *)