Last active
December 15, 2015 05:19
-
-
Save itod/5208009 to your computer and use it in GitHub Desktop.
Simple ParseKit Expression Language grammar
This file contains hidden or 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
| @symbols = '!=' '<=' '>='; | |
| @start = expr; | |
| expr = orExpr; | |
| orExpr = andExpr orTerm*; | |
| orTerm = 'or' andExpr; | |
| andExpr = relExpr andTerm*; | |
| andTerm = 'and' relExpr; | |
| relExpr = callExpr (relOp callExpr)*; | |
| relOp = '<' | '>' | '=' | '!=' | '<=' | '>='; | |
| callExpr = primaryExpr ('(' argList ')')?; | |
| argList = Empty | atom (',' atom)*; | |
| primaryExpr = atom | '(' expr ')'; | |
| atom = obj | literal; | |
| obj = id member*; | |
| id = Word; | |
| member = '.' id; | |
| literal = QuotedString | Number | bool; | |
| bool = 'yes' | 'no'; |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
// This grammar will parse simple relational boolean expressions like:
foo and bar
(foo or bar) and yes
foo.bar(20) >= 10.0
foo.bar("hello") != "hello"