This repository has been archived on 2024-05-26. You can view files and clone it, but cannot push or open issues or pull requests.
core/trixy/trixy-lang_parser/docs/grammar.ebnf

21 lines
787 B
EBNF
Raw Normal View History

# (*
# 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;
Type = Identifier ["<" Type {"," Type} ">"];
# (*
# vim: ft=ebnf
# *)