Package gorsat.parser

Class CalcCompiler

java.lang.Object
org.antlr.v4.runtime.tree.AbstractParseTreeVisitor<T>
All Implemented Interfaces:
org.antlr.v4.runtime.tree.ParseTreeVisitor<TypedCalcLambda>, GorScriptVisitor<TypedCalcLambda>

public class CalcCompiler extends GorScriptBaseVisitor<TypedCalcLambda>
CalcCompiler implements an Antlr parse tree visitor, starting on an expression node. It builds up a TypedCalcLambda along the way, collapsing constant expressions into constants, otherwise a lambda taking a ColumnValueProvider as an argument. To use the CalcCompiler, construct a parse tree with GorScriptParser - this is also done by SyntaxChecker. Then call setColumnNamesAndTypes to inform the compiler of available variables before passing the compiler to the accept method of the parse tree node.