renamings

This commit is contained in:
ChUrl
2020-12-13 15:03:28 +01:00
parent 8e7292ea3e
commit ba624cf4a0
6 changed files with 48 additions and 48 deletions

View File

@ -1,7 +1,7 @@
import lexer.StupsLexer;
import org.antlr.v4.runtime.CharStreams;
import org.antlr.v4.runtime.Lexer;
import parser.Parser;
import parser.StupsParser;
import parser.grammar.Grammar;
import java.io.IOException;
@ -50,9 +50,9 @@ public final class StupsCompiler {
return;
}
Parser parser = Parser.fromGrammar(grammar);
StupsParser stupsParser = StupsParser.fromGrammar(grammar);
parser.parse(lexer.getAllTokens(), lexer.getVocabulary());
stupsParser.parse(lexer.getAllTokens(), lexer.getVocabulary());
System.out.println("Compilation completed.");
}

View File

@ -15,21 +15,21 @@ import java.util.List;
import static util.Logger.log;
public class Parser {
public class StupsParser {
private final ParsingTable parsetable;
public Parser(ParsingTable parsetable) {
public StupsParser(ParsingTable parsetable) {
this.parsetable = parsetable;
}
public static Parser fromGrammar(Path path) throws IOException {
return Parser.fromGrammar(Grammar.fromFile(path));
public static StupsParser fromGrammar(Path path) throws IOException {
return StupsParser.fromGrammar(Grammar.fromFile(path));
}
public static Parser fromGrammar(Grammar grammar) {
public static StupsParser fromGrammar(Grammar grammar) {
GrammarAnalyzer analyzer = new GrammarAnalyzer(grammar);
return new Parser(analyzer.getTable());
return new StupsParser(analyzer.getTable());
}
public AST parse(List<? extends Token> token, Vocabulary voc) {