public static LinearIntegerExpression parseLinearExpression(String input) { var stream = new AntlrInputStream(input); var lexer = new SymbolicStringsLexer(stream); var tokens = new CommonTokenStream(lexer); var parser = new SymbolicStringsParser(tokens); parser.BuildParseTree = true; var tree = parser.integer(); if (parser.NumberOfSyntaxErrors == 0) return tree.value; return null; }
public static SymbolicString parseSymbolicString(String input, List<String> alphabet) { var stream = new AntlrInputStream(input); var lexer = new SymbolicStringsLexer(stream); var tokens = new CommonTokenStream(lexer); var parser = new SymbolicStringsParser(tokens); parser.alphabet = alphabet; parser.BuildParseTree = true; var tree = parser.symbolic_string(); if (parser.NumberOfSyntaxErrors == 0 && parser.word_error == null) return tree.value; return null; }
public static LinearIntegerExpression parseLinearExpression(String input) { var stream = new AntlrInputStream(input); var lexer = new SymbolicStringsLexer(stream); var tokens = new CommonTokenStream(lexer); var parser = new SymbolicStringsParser(tokens); parser.BuildParseTree = true; var tree = parser.integer(); if (parser.NumberOfSyntaxErrors == 0) { return(tree.value); } return(null); }
public static SymbolicString parseSymbolicString(String input, List <String> alphabet) { var stream = new AntlrInputStream(input); var lexer = new SymbolicStringsLexer(stream); var tokens = new CommonTokenStream(lexer); var parser = new SymbolicStringsParser(tokens); parser.alphabet = alphabet; parser.BuildParseTree = true; var tree = parser.symbolic_string(); if (parser.NumberOfSyntaxErrors == 0 && parser.word_error == null) { return(tree.value); } return(null); }