1 package polyglot.ext.coffer; 2 3 import polyglot.ext.coffer.parse.Lexer_c; 4 import polyglot.ext.coffer.parse.Grm; 5 import polyglot.ext.coffer.ast.*; 6 import polyglot.ext.coffer.types.*; 7 import polyglot.ext.coffer.visit.*; 8 9 import polyglot.ast.*; 10 import polyglot.types.*; 11 import polyglot.util.*; 12 import polyglot.visit.*; 13 import polyglot.frontend.*; 14 import polyglot.main.*; 15 import polyglot.lex.Lexer; 16 17 import java.util.*; 18 import java.io.*; 19 20 23 public class ExtensionInfo extends polyglot.ext.param.ExtensionInfo { 24 static { 25 Topics t = new Topics(); 27 } 28 29 public String defaultFileExtension() { 30 return "cof"; 31 } 32 33 public String compilerName() { 34 return "cofferc"; 35 } 36 37 public Parser parser(Reader reader, FileSource source, ErrorQueue eq) { 38 Lexer lexer = new Lexer_c(reader, source.name(), eq); 39 Grm grm = new Grm(lexer, ts, nf, eq); 40 return new CupParser(grm, source, eq); 41 } 42 43 protected NodeFactory createNodeFactory() { 44 return new CofferNodeFactory_c(); 45 } 46 protected TypeSystem createTypeSystem() { 47 return new CofferTypeSystem_c(); 48 } 49 50 public static final Pass.ID KEY_CHECK = new Pass.ID("key-check"); 51 52 public List passes(Job job) { 53 List passes = super.passes(job); 54 55 beforePass(passes, Pass.PRE_OUTPUT_ALL, 56 new VisitorPass(KEY_CHECK, 57 job, new KeyChecker(job, ts, nf))); 58 59 return passes; 60 } 61 62 } 63 | Popular Tags |