Skip to content

Instantly share code, notes, and snippets.

@ThatXliner
Created November 18, 2020 21:45
Show Gist options
  • Save ThatXliner/a3e03c8010986e841bf62de34a97e922 to your computer and use it in GitHub Desktop.
Save ThatXliner/a3e03c8010986e841bf62de34a97e922 to your computer and use it in GitHub Desktop.
A subset of LaTeX, meant to be intuitive and easy to use. Licensed GNU GPL v3
%import common (WS, LETTER, NUMBER)
%ignore WS
start: exp?
?exp : term
| mul
| div
| sub
| add
| eq
VARIABLE: LETTER [("e"|"E") NUMBER]
?parenthesis: "(" exp ")"
add: add? term? "+" exp
sub: sub? term? "-" exp
div: div? term? "/" exp
mul: mul? term? "*" exp
pow: pow? term "^" term
eq: exp "=" exp
fra: "\\f" term "/" term
vmul: (NUMBER raw_term) | (raw_term term)
?raw_term: (parenthesis | fra | pow | VARIABLE)
?term: vmul | parenthesis | fra | pow | VARIABLE | NUMBER | ("-" (parenthesis | fra | VARIABLE | NUMBER))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment