Last active
December 15, 2022 05:33
-
-
Save getify/61088517c65c44d29dc65c3eed595565 to your computer and use it in GitHub Desktop.
exploring grammars
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
(* as checked here: https://mdkrajnak.github.io/ebnftest/ *) | |
(* ebnf syntax rules defined here: https://github.com/Engelberg/instaparse *) | |
Program := WhSp* (StmtSemi WhSp*)* StmtSemiOpt? WhSp*; | |
Stmt := AStmt | BStmt | CStmt | DStmt; | |
StmtSemi := Stmt? (WhSp* ";")+; | |
StmtSemiOpt := Stmt? (WhSp* ";")*; | |
WhSp := "_"; | |
AStmt := "a"; | |
BStmt := "b"; | |
CStmt := "c"; | |
DStmt := "d"; |
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
(* as checked here: https://mdkrajnak.github.io/ebnftest/ *) | |
(* ebnf syntax rules defined here: https://github.com/Engelberg/instaparse *) | |
(* backport from the normalized bnf in '2b.bnf' *) | |
Leading := WhSp Leading Program | Semi Leading Program | Program; | |
Program := Stmt | Stmt WhSp | Stmt WhSpOptSemi Program | Stmt WhSpOptSemi WhSp Program | Epsilon; | |
Stmt := AStmt | BStmt | CStmt | DStmt; | |
WhSpOptSemi := Semi | WhSp Semi | Semi WhSpOptSemi | WhSp Semi WhSpOptSemi; | |
WhSp := "_" | "_" WhSp; | |
Semi := ";"; | |
AStmt := "a"; | |
BStmt := "b"; | |
CStmt := "c"; | |
DStmt := "d"; |
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
/* as checked here: https://smlweb.cpsc.ucalgary.ca/start.html */ | |
/* analysis here: shorturl.at/bjBO7 */ | |
/* bnf syntax rules defined here: https://smlweb.cpsc.ucalgary.ca/readme.html */ | |
Program -> StmtSemi FinalStmtSemiOpt . | |
StmtSemi -> WhSp StmtSemiOpt | StmtSemiOpt . | |
FinalStmtSemiOpt -> StmtOpt SemiOpt WhSpOpt | WhSpOpt . | |
Stmt -> AStmt | BStmt | CStmt | DStmt . | |
StmtOpt -> Stmt | . | |
StmtSemiOpt -> StmtOpt Semi | StmtOpt Semi WhSpOpt StmtSemiOpt | . | |
Semi -> WhSpOpt ; | WhSpOpt ; Semi . | |
SemiOpt -> Semi | . | |
WhSp -> _ | _ WhSp . | |
WhSpOpt -> WhSp | . | |
AStmt -> a . | |
BStmt -> b . | |
CStmt -> c . | |
DStmt -> d . |
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
/* as checked here: https://smlweb.cpsc.ucalgary.ca/start.html */ | |
/* analysis here: shorturl.at/huCOP */ | |
/* bnf syntax rules defined here: https://smlweb.cpsc.ucalgary.ca/readme.html */ | |
Leading -> WhSp Leading Program | Semi Leading Program | Program . | |
Program -> Stmt | Stmt WhSp | Stmt WhSpOptSemi Program | Stmt WhSpOptSemi WhSp Program | . | |
Stmt -> AStmt | BStmt | CStmt | DStmt . | |
WhSpOptSemi -> Semi | WhSp Semi | Semi WhSpOptSemi | WhSp Semi WhSpOptSemi . | |
WhSp -> _ | _ WhSp . | |
Semi -> ; . | |
AStmt -> a . | |
BStmt -> b . | |
CStmt -> c . | |
DStmt -> d . |
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
_____ | |
;;;;; | |
_;_;_ | |
a | |
__a__ | |
a; | |
a;b; | |
a;_b; | |
_a;_b;_ | |
_a_;_b_;_ | |
__a__;; | |
_;_a;_b;c;;;__;;__d;___a___ |
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
ab | |
a_b | |
a;_b_c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment