11package ko .carbonel .compiler .runner ;
22
3- import ko .carbonel .Logger ;
4- import ko .carbonel .compiler .AttributeParser ;
5- import ko .carbonel .compiler .codegen .DeCompiler ;
6- import ko .carbonel .compiler .config .ArgumentName ;
73import ko .carbonel .compiler .generated .AttrBNFParser ;
84import ko .carbonel .compiler .generated .AttrTinyRustParser ;
95import ko .carbonel .compiler .generated .BNFParser ;
106import ko .carbonel .compiler .generated .TinyRustParser ;
117import ko .carbonel .compiler .intermediate .tinyRust .TSSerializer ;
12- import ko .carbonel .compiler .intermediate .tinyRust .TinyRustSymbolTable ;
138import ko .carbonel .compiler .stream .lexer .bnf .BNFLexer ;
149import ko .carbonel .compiler .stream .lexer .tinyRust .TinyRustLexer ;
1510
16- import static ko .carbonel .json .SerializeClass .Value .AST ;
17-
1811public class Runners {
1912 // if (!inputFileName.endsWith(".rs")) Logger.inputRSWarning();
2013 public static final Runner TINY_RUST_PARSER = new GenericParserRunner <>(TinyRustLexer ::new , TinyRustParser ::new , true );
@@ -23,36 +16,7 @@ public class Runners {
2316 public static final Runner ATTR_BNF_PARSER = new STParserRunner <>(BNFLexer ::new , AttrBNFParser ::new , false );
2417 public static final Runner TINY_RUST_LEXER = new GenericLexerRunner <>(TinyRustLexer ::new , true );
2518 public static final Runner BNF_LEXER = new GenericLexerRunner <>(BNFLexer ::new , false );
26-
27- public static final Runner TINY_RUST_AST_PARSER = new STParserRunner <>(TinyRustLexer ::new , AttrTinyRustParser ::new , true ){
28- protected void afterParse (AttrTinyRustParser parser ) {
29- super .afterParse (parser );
30- String input = "" ;
31- TinyRustSymbolTable st = ((AttributeParser <TinyRustSymbolTable >)parser ).getSymbolTable ();
32- st .checkExpressions ();
33- String serialize = TSSerializer .serialize (st );
34- Logger .output (serialize );
35-
36- outputIntermediateRepr (parser , ArgumentName .OUTPUT_AST_FILE , ".ast.json" , AST );
37- // outputParallelFile("rsC", DeCompiler.decompile(st));
38- Logger .output (DeCompiler .decompile (st ));
39-
40- // while (!input.equals("exit")){
41- // try {
42- // Logger.outputNoNewline("> ");
43- // input = new BufferedReader(new InputStreamReader(System.in)).readLine();
44- // TinyRustLexer tinyRustLexer = new TinyRustLexer(new StringSourceReader(input, true));
45- // List<TinyRustLexerToken> tokens = tinyRustLexer.stream().toList();
46- // Object o = ChainResolver.resolveChaining(st, tokens.stream().filter(it -> !it.type().equals(TinyRustTokenType.DOT)).toList());
47- // Logger.output(o != null ? o.toString() : null);
48- // } catch (IOException e) {
49- // throw new RuntimeException(e);
50- // } catch (CompilerError e){
51- // Logger.error(e.getMessage(), e);
52- // }
53- // }
54- }
55- };
19+ public static final Runner TINY_RUST_AST_PARSER = new ASTParserRunner <>(TinyRustLexer ::new , AttrTinyRustParser ::new , true );
5620
5721 private Runners () {
5822 }
0 commit comments