Search in sources :

Example 1 with FormulaContext

use of de.bmoth.antlr.BMoThParser.FormulaContext in project bmoth by hhu-stups.

the class Parser method getFormulaAsSemanticAst.

public static FormulaNode getFormulaAsSemanticAst(String inputString) throws ParserException {
    Parser parser = new Parser();
    try {
        FormulaContext formulaContext;
        formulaContext = parser.parseFormula(inputString);
        List<String> warnings = CSTAnalyser.analyseConcreteSyntaxTree(formulaContext);
        FormulaNode formulaNode = parser.getFormulaAst(formulaContext);
        formulaNode.setWarnings(warnings);
        TypeChecker.typecheckFormulaNode(formulaNode);
        return formulaNode;
    } catch (ParseErrorException | TypeErrorException | ScopeException e) {
        throw new ParserException(e);
    }
}
Also used : FormulaNode(de.bmoth.parser.ast.nodes.FormulaNode) TypeErrorException(de.bmoth.parser.ast.TypeErrorException) FormulaContext(de.bmoth.antlr.BMoThParser.FormulaContext) BMoThParser(de.bmoth.antlr.BMoThParser)

Aggregations

BMoThParser (de.bmoth.antlr.BMoThParser)1 FormulaContext (de.bmoth.antlr.BMoThParser.FormulaContext)1 TypeErrorException (de.bmoth.parser.ast.TypeErrorException)1 FormulaNode (de.bmoth.parser.ast.nodes.FormulaNode)1