Implement a dead simple pseudo-EBNF to Pest translator, which works on Conlang's EBNF

This commit is contained in:
2024-04-06 05:22:21 -05:00
commit d1d8c45bdb
6 changed files with 316 additions and 0 deletions

18
test.grammatical Normal file
View File

@@ -0,0 +1,18 @@
(* Grammatical EBNF *)
Ruleset = (COMMENT? Rule)* EOI ;
Rule = ident '=' Either? ';' ;
Either = Follow ('|' Follow)* ;
Follow = (Any | Many | Maybe | Not)+ ;
Any = Not '*' ;
Many = Not '+' ;
Maybe = Not '?' ;
Not = '!'? Prime ;
Prime = Group | chr | str | ident ;
Group = '(' Either ')' ;
ident = XID_START XID_CONTINUE* ;
str = '"' (!'"' ANY)* '"' ;
chr = "'" (!"'" ANY)* "'" ;
WHITESPACE = WHITE_SPACE ;
COMMENT = "(*" (COMMENT | !"*)" ANY)* "*)" ;