Separated parser class nodes and began writing compile methods
This commit is contained in:
14
app/imports/parser/parseTree/ParseNode.js
Normal file
14
app/imports/parser/parseTree/ParseNode.js
Normal 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()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user