Created
August 10, 2014 01:02
-
-
Save athanclark/733588ba735506eb455f to your computer and use it in GitHub Desktop.
BNF in LBNF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--| I kinda made lists explicit, here: I was able to implement | |
--| Kleene plusses and stars with the inductive lists. I haven't | |
--| found much material on properly making list productions in | |
--| BNFC (*prays to shrine for more material*), but would gladly | |
--| take in suggestions! | |
token NonTerminal ('<' (letter | digit | '_' | '-')* '>') ; | |
SyntaxNil . Syntax ::= ; | |
SyntaxCons . Syntax ::= Rule Syntax ; | |
Rule . Rule ::= NonTerminal "::=" Expression ; | |
--Expression captures optionality | |
ExpressionList . Expression ::= List ; | |
ExpressionOpt . Expression ::= List "|" Expression ; | |
--Kleene Plus lists are concatenation | |
ListOne . List ::= Term ; | |
ListCons . List ::= Term List ; | |
Literal . Term ::= String ; | |
NonTerm . Term ::= NonTerminal ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment