Separated parser class nodes and began writing compile methods

This commit is contained in:
Thaum Rystra
2019-04-06 10:56:53 +02:00
parent d21827106c
commit b7b0ac9c00
14 changed files with 167 additions and 207 deletions

View File

@@ -0,0 +1,14 @@
export default class ParseNode {
// Compiling a node must return a ConstantNode
compile(){
throw new Meteor.Error('Compile not implemented on ' + this);
}
// Compile, but turn rolls into arrays
roll(){
return this.compile();
}
// Compile, turn rolls into arrays, and reduce those arrays into single values
reduce(){
return this.compileAndRoll()
}
}