Began work on rewriting parser without object orientation

Parsing is expensive, if the parse tree can be stored on the DB it can 
save a lot of compute time, but mongo can't store Classes, so we 
re-write without classes
This commit is contained in:
Stefan Zermatten
2021-10-01 13:41:22 +02:00
parent cb1fd38df3
commit feffa45cf7
19 changed files with 521 additions and 305 deletions

View File

@@ -0,0 +1,18 @@
const constant = {
create({value, valueType}){
if (!valueType) throw `Expected valueType to be set, got ${valueType}`
return {
type: 'constant',
valueType,
value,
}
},
compile(node){
return node;
},
toString(node){
return `${node.value}`;
},
}
export default constant;