Skip to content

Instantly share code, notes, and snippets.

@ryohji
Created April 18, 2020 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryohji/fda832fd26119a2ff6c204429b588af3 to your computer and use it in GitHub Desktop.
Save ryohji/fda832fd26119a2ff6c204429b588af3 to your computer and use it in GitHub Desktop.
Equational logic syntax
grammar EqLogic;
predicate
: predicate substitution
| LPAREN predicate RPAREN
| BOOLEAN
| ID
| NOT predicate
| predicate IMPLY predicate
| predicate AND predicate
| predicate OR predicate
| predicate EQUAL predicate (leibniz | equanimity)?
;
substitution: LBRACK ID (COMMA ID)* SUBSTITUTE predicate (COMMA predicate)* RBRACK ;
leibniz: LEIBNIZ ID DOT predicate ;
equanimity: EQUANIMITY predicate ;
SUBSTITUTE: ':=' ;
LEIBNIZ : 'Leibniz' ;
EQUANIMITY: 'Equanimity' ;
BOOLEAN: TRUE | FALSE ;
LBRACK : '[' ;
RBRACK : ']' ;
LPAREN : '(' ;
RPAREN : ')' ;
DOT : '.' ;
COMMA : ',' ;
NOT : '~' ;
IMPLY: '?' ;
AND : '&' ;
OR : '|' ;
EQUAL: '=' ;
TRUE : 'true' ;
FALSE: 'false' ;
ID: [a-z]+ ;
WS: [ \t\r\n]+ -> skip ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment