m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/parser.js
diff options
context:
space:
mode:
authorMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2017-07-14 18:14:14 -0400
committerMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2017-07-14 18:14:14 -0400
commitd3132a5463908bcabd0578ad48a457b2bec30a9a (patch)
tree4c752b28616663c418fa44b1f56219a3a4dd1e44 /src/parser.js
parenta15a2986c95131a13d3707ae50f8a215dcaac564 (diff)
Lex and parse subtraction
Diffstat (limited to 'src/parser.js')
-rw-r--r--src/parser.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/parser.js b/src/parser.js
index c7d91c3..6c39c77 100644
--- a/src/parser.js
+++ b/src/parser.js
@@ -32,6 +32,14 @@ newSymbol('+', null, 20, (left, parser) => {
}
})
+newSymbol('-', null, 20, (left, parser) => {
+ return {
+ type: 'subtract',
+ left: left,
+ right: parser.expression(20)
+ }
+})
+
newSymbol('end', null, -1)
const newParser = (tokens) => {