-
-
Save michaelgpearce/3385007 to your computer and use it in GitHub Desktop.
Left to right association with Treetop Grammar
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
rule expression | |
term (space? additive_operator space? term)* space? <Node::Expression> | |
end | |
rule term | |
space? factor (space? multitive_operator space? factor)* <Node::Expression> | |
end | |
rule factor | |
number | |
/ | |
'(' expression ')' <Node::Expression> | |
end | |
rule additive_operator | |
addition_operator / subtraction_operator | |
end | |
rule multitive_operator | |
multiplication_operator / division_operator | |
end | |
rule addition_operator | |
'+' <Node::Operator> | |
end | |
rule subtraction_operator | |
'-' <Node::Operator> | |
end | |
rule multiplication_operator | |
'*' <Node::Operator> | |
end | |
rule division_operator | |
'/' <Node::Operator> | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment