Search in sources :

Example 1 with StartContext

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

the class Parser method getMachineAsSemanticAst.

public static MachineNode getMachineAsSemanticAst(String inputString) throws ParserException {
    Parser parser = new Parser();
    try {
        StartContext start = parser.parseMachine(inputString);
        List<String> warnings = CSTAnalyser.analyseConcreteSyntaxTree(start);
        MachineNode machineNode = parser.getMachineAst(start);
        machineNode.setWarnings(warnings);
        TypeChecker.typecheckMachineNode(machineNode);
        return machineNode;
    } catch (ParseErrorException | TypeErrorException | ScopeException e) {
        throw new ParserException(e);
    }
}
Also used : StartContext(de.bmoth.antlr.BMoThParser.StartContext) LtlStartContext(de.bmoth.antlr.BMoThParser.LtlStartContext) TypeErrorException(de.bmoth.parser.ast.TypeErrorException) BMoThParser(de.bmoth.antlr.BMoThParser) MachineNode(de.bmoth.parser.ast.nodes.MachineNode)

Aggregations

BMoThParser (de.bmoth.antlr.BMoThParser)1 LtlStartContext (de.bmoth.antlr.BMoThParser.LtlStartContext)1 StartContext (de.bmoth.antlr.BMoThParser.StartContext)1 TypeErrorException (de.bmoth.parser.ast.TypeErrorException)1 MachineNode (de.bmoth.parser.ast.nodes.MachineNode)1