diff options
author | Adrian Thurston <thurston@complang.org> | 2013-04-14 10:36:42 -0400 |
---|---|---|
committer | Adrian Thurston <thurston@complang.org> | 2013-04-14 10:36:42 -0400 |
commit | 9ded7ffab271affabe1a85cc31ddace7f3c13da4 (patch) | |
tree | 881c0c82e7fc19238cf3b9afc305ed95c8878928 | |
parent | 3a85b29e2a01c72a52eb2c89315b9646c0c23d5d (diff) | |
download | colm-9ded7ffab271affabe1a85cc31ddace7f3c13da4.tar.gz |
improved naming of cons/load functions
ConsInit: Constructs the initial parser that will parse the colm grammar.
Language is hardcoded.
LoadInit: loads the colm grammar and constructs the parser that main binary
will use to parse programs.
LoadColm: loads the colm program being compiled.
-rw-r--r-- | colm/.gitignore | 8 | ||||
-rw-r--r-- | colm/Makefile.am | 32 | ||||
-rw-r--r-- | colm/loadcolm.cc (renamed from colm/load.cc) | 16 | ||||
-rw-r--r-- | colm/loadcolm.h (renamed from colm/load.h) | 2 | ||||
-rw-r--r-- | colm/loadinit.cc (renamed from colm/conscolm.cc) | 36 | ||||
-rw-r--r-- | colm/loadinit.h (renamed from colm/conscolm.h) | 4 | ||||
-rw-r--r-- | colm/main.cc | 12 |
7 files changed, 55 insertions, 55 deletions
diff --git a/colm/.gitignore b/colm/.gitignore index df0c9a97..af9a50d6 100644 --- a/colm/.gitignore +++ b/colm/.gitignore @@ -26,12 +26,12 @@ /bootstrap0 /bootstrap1 -/exports1.h -/exports1.cc +/if1.h +/if1.cc /parse1.c -/exports2.h -/exports2.cc +/if2.h +/if2.cc /parse2.c /libprog.a diff --git a/colm/Makefile.am b/colm/Makefile.am index 5b5637c3..f3f42ba4 100644 --- a/colm/Makefile.am +++ b/colm/Makefile.am @@ -65,19 +65,19 @@ bootstrap0_CXXFLAGS = $(common_CFLAGS) -DCONS_INIT bootstrap0_SOURCES = consinit.cc consinit.h main.cc bootstrap0_LDADD = libprog.a libcolmd.a -bootstrap1_CXXFLAGS = $(common_CFLAGS) -DLOAD_COLM +bootstrap1_CXXFLAGS = $(common_CFLAGS) -DLOAD_INIT bootstrap1_CFLAGS = $(common_CFLAGS) bootstrap1_SOURCES = \ - conscolm.h conscolm.cc \ - exports1.h exports1.cc parse1.c \ + loadinit.h loadinit.cc \ + if1.h if1.cc parse1.c \ main.cc bootstrap1_LDADD = libprog.a libcolmd.a -colm_CXXFLAGS = $(common_CFLAGS) -DLOAD_SRC +colm_CXXFLAGS = $(common_CFLAGS) -DLOAD_COLM colm_CFLAGS = $(common_CFLAGS) colm_SOURCES = \ - load.h load.cc \ - exports2.h exports2.cc parse2.c \ + loadcolm.h loadcolm.cc \ + if2.h if2.cc parse2.c \ main.cc colm_LDADD = libprog.a libcolmd.a @@ -86,20 +86,20 @@ colmincdir = $(includedir)/colm colminc_HEADERS = $(RUNTIME_HDR) parse1.c: bootstrap0 - $(builddir)/bootstrap0 -L -o parse1.c -e exports1.h -c exports1.cc -exports1.h: parse1.c -exports1.cc: parse1.c + $(builddir)/bootstrap0 -L -o parse1.c -e if1.h -c if1.cc +if1.h: parse1.c +if1.cc: parse1.c parse2.c: bootstrap1 colm.lm - $(builddir)/bootstrap1 -L -o parse2.c -e exports2.h -c exports2.cc colm.lm -exports2.h: parse2.c -exports2.cc: parse2.c + $(builddir)/bootstrap1 -L -o parse2.c -e if2.h -c if2.cc colm.lm +if2.h: parse2.c +if2.cc: parse2.c -bootstrap1-exports1.$(OBJEXT): exports1.h exports1.cc parse1.c -bootstrap1-conscolm.$(OBJEXT): exports1.h exports1.cc parse1.c +bootstrap1-if1.$(OBJEXT): if1.h if1.cc parse1.c +bootstrap1-loadinit.$(OBJEXT): if1.h if1.cc parse1.c -colm-exports2.$(OBJEXT): exports2.h exports2.cc parse2.c -colm-load.$(OBJEXT): exports2.h exports2.cc parse2.c +colm-if2.$(OBJEXT): if2.h if2.cc parse2.c +colm-loadcolm.$(OBJEXT): if2.h if2.cc parse2.c BUILT_SOURCES = version.h diff --git a/colm/load.cc b/colm/loadcolm.cc index 9ec6e41a..e0c4b3cf 100644 --- a/colm/load.cc +++ b/colm/loadcolm.cc @@ -29,8 +29,8 @@ #include "parser.h" #include "global.h" #include "input.h" -#include "load.h" -#include "exports2.h" +#include "loadcolm.h" +#include "if2.h" #include "colm/colm.h" extern RuntimeData main_runtimeData; @@ -80,11 +80,11 @@ String unescape( const String &s ) } -struct LoadSource +struct LoadColm : public BaseParser { - LoadSource( Compiler *pd, const char *inputFileName ) + LoadColm( Compiler *pd, const char *inputFileName ) : BaseParser( pd ), inputFileName( inputFileName ) @@ -1885,9 +1885,9 @@ struct LoadSource virtual void go( long activeRealm ); }; -void LoadSource::go( long activeRealm ) +void LoadColm::go( long activeRealm ) { - LoadSource::init(); + LoadColm::init(); const char *argv[2]; argv[0] = inputFileName; @@ -1913,7 +1913,7 @@ void LoadSource::go( long activeRealm ) pd->rootCodeBlock = CodeBlock::cons( stmtList, 0 ); } -BaseParser *consLoadSource( Compiler *pd, const char *inputFileName ) +BaseParser *consLoadColm( Compiler *pd, const char *inputFileName ) { - return new LoadSource( pd, inputFileName ); + return new LoadColm( pd, inputFileName ); } diff --git a/colm/load.h b/colm/loadcolm.h index ebfc8307..bfc0589f 100644 --- a/colm/load.h +++ b/colm/loadcolm.h @@ -21,4 +21,4 @@ #include "parser.h" -BaseParser *consLoadSource( Compiler *pd, const char *inputFileName ); +BaseParser *consLoadColm( Compiler *pd, const char *inputFileName ); diff --git a/colm/conscolm.cc b/colm/loadinit.cc index 054db4bc..fc6d77b5 100644 --- a/colm/conscolm.cc +++ b/colm/loadinit.cc @@ -30,15 +30,15 @@ #include "parser.h" #include "global.h" #include "input.h" -#include "conscolm.h" -#include "exports1.h" +#include "loadinit.h" +#include "if1.h" #include "colm/colm.h" using std::string; extern RuntimeData main_runtimeData; -void LoadColm::walkProdElList( ProdElList *list, prod_el_list &prodElList ) +void LoadInit::walkProdElList( ProdElList *list, prod_el_list &prodElList ) { if ( prodElList.ProdElList() != 0 ) { prod_el_list RightProdElList = prodElList.ProdElList(); @@ -67,7 +67,7 @@ void LoadColm::walkProdElList( ProdElList *list, prod_el_list &prodElList ) } } -void LoadColm::walkProdList( LelDefList *outProdList, prod_list &prodList ) +void LoadInit::walkProdList( LelDefList *outProdList, prod_list &prodList ) { if ( prodList.ProdList() != 0 ) { prod_list RightProdList = prodList.ProdList(); @@ -84,7 +84,7 @@ void LoadColm::walkProdList( LelDefList *outProdList, prod_list &prodList ) prodAppend( outProdList, prod ); } -LexFactor *LoadColm::walkLexFactor( lex_factor &lexFactor ) +LexFactor *LoadInit::walkLexFactor( lex_factor &lexFactor ) { LexFactor *factor = 0; if ( lexFactor.Literal() != 0 ) { @@ -115,7 +115,7 @@ LexFactor *LoadColm::walkLexFactor( lex_factor &lexFactor ) return factor; } -LexFactorNeg *LoadColm::walkLexFactorNeg( lex_factor_neg &lexFactorNeg ) +LexFactorNeg *LoadInit::walkLexFactorNeg( lex_factor_neg &lexFactorNeg ) { if ( lexFactorNeg.FactorNeg() != 0 ) { lex_factor_neg Rec = lexFactorNeg.FactorNeg(); @@ -131,7 +131,7 @@ LexFactorNeg *LoadColm::walkLexFactorNeg( lex_factor_neg &lexFactorNeg ) } } -LexFactorRep *LoadColm::walkLexFactorRep( lex_factor_rep &lexFactorRep ) +LexFactorRep *LoadInit::walkLexFactorRep( lex_factor_rep &lexFactorRep ) { LexFactorRep *factorRep = 0; if ( lexFactorRep.Star() != 0 ) { @@ -152,13 +152,13 @@ LexFactorRep *LoadColm::walkLexFactorRep( lex_factor_rep &lexFactorRep ) return factorRep; } -LexFactorAug *LoadColm::walkLexFactorAug( lex_factor_rep &lexFactorRep ) +LexFactorAug *LoadInit::walkLexFactorAug( lex_factor_rep &lexFactorRep ) { LexFactorRep *factorRep = walkLexFactorRep( lexFactorRep ); return LexFactorAug::cons( factorRep ); } -LexTerm *LoadColm::walkLexTerm( lex_term &lexTerm ) +LexTerm *LoadInit::walkLexTerm( lex_term &lexTerm ) { if ( lexTerm.Term() != 0 ) { lex_term Rec = lexTerm.Term(); @@ -177,7 +177,7 @@ LexTerm *LoadColm::walkLexTerm( lex_term &lexTerm ) } } -LexExpression *LoadColm::walkLexExpr( lex_expr &LexExprTree ) +LexExpression *LoadInit::walkLexExpr( lex_expr &LexExprTree ) { if ( LexExprTree.Expr() != 0 ) { lex_expr Rec = LexExprTree.Expr(); @@ -202,7 +202,7 @@ bool walkNoIgnore( opt_ni OptNi ) return OptNi.Ni() != 0; } -void LoadColm::walkTokenList( token_list &tokenList ) +void LoadInit::walkTokenList( token_list &tokenList ) { if ( tokenList.TokenList() != 0 ) { token_list RightTokenList = tokenList.TokenList(); @@ -238,7 +238,7 @@ void LoadColm::walkTokenList( token_list &tokenList ) } } -void LoadColm::walkLexRegion( item &LexRegion ) +void LoadInit::walkLexRegion( item &LexRegion ) { pushRegionSet( internal ); @@ -248,7 +248,7 @@ void LoadColm::walkLexRegion( item &LexRegion ) popRegionSet(); } -void LoadColm::walkDefinition( item &define ) +void LoadInit::walkDefinition( item &define ) { prod_list ProdList = define.ProdList(); @@ -261,7 +261,7 @@ void LoadColm::walkDefinition( item &define ) cflDef( ntDef, objectDef, defList ); } -void LoadColm::consParseStmt( StmtList *stmtList ) +void LoadInit::consParseStmt( StmtList *stmtList ) { /* Parse the "start" def. */ NamespaceQual *nspaceQual = NamespaceQual::cons( namespaceStack.top() ); @@ -302,7 +302,7 @@ void LoadColm::consParseStmt( StmtList *stmtList ) stmtList->append( parseStmt ); } -void LoadColm::consExportTree( StmtList *stmtList ) +void LoadInit::consExportTree( StmtList *stmtList ) { QualItemVect *qual = new QualItemVect; LangVarRef *varRef = LangVarRef::cons( internal, qual, String("P") ); @@ -315,7 +315,7 @@ void LoadColm::consExportTree( StmtList *stmtList ) stmtList->append( programExport ); } -void LoadColm::consExportError( StmtList *stmtList ) +void LoadInit::consExportError( StmtList *stmtList ) { QualItemVect *qual = new QualItemVect; LangVarRef *varRef = LangVarRef::cons( internal, qual, String("error") ); @@ -328,9 +328,9 @@ void LoadColm::consExportError( StmtList *stmtList ) stmtList->append( programExport ); } -void LoadColm::go( long activeRealm ) +void LoadInit::go( long activeRealm ) { - LoadColm::init(); + LoadInit::init(); StmtList *stmtList = new StmtList; diff --git a/colm/conscolm.h b/colm/loadinit.h index 6cf774db..4a3120c7 100644 --- a/colm/conscolm.h +++ b/colm/loadinit.h @@ -34,11 +34,11 @@ struct prod_el_list; struct prod_list; struct item; -struct LoadColm +struct LoadInit : public BaseParser { - LoadColm( Compiler *pd, const char *inputFileName ) + LoadInit( Compiler *pd, const char *inputFileName ) : BaseParser(pd), inputFileName(inputFileName) diff --git a/colm/main.cc b/colm/main.cc index 25a2c074..eba57960 100644 --- a/colm/main.cc +++ b/colm/main.cc @@ -44,10 +44,10 @@ #if defined(CONS_INIT) #include "consinit.h" -#elif defined(LOAD_COLM) -#include "conscolm.h" +#elif defined(LOAD_INIT) +#include "loadinit.h" #else -#include "load.h" +#include "loadcolm.h" #endif using std::istream; @@ -582,10 +582,10 @@ int main(int argc, const char **argv) #if defined(CONS_INIT) BaseParser *parser = new ConsInit( pd ); -#elif defined(LOAD_COLM) - BaseParser *parser = new LoadColm( pd, inputFileName ); +#elif defined(LOAD_INIT) + BaseParser *parser = new LoadInit( pd, inputFileName ); #else - BaseParser *parser = consLoadSource( pd, inputFileName ); + BaseParser *parser = consLoadColm( pd, inputFileName ); #endif parser->go( gblActiveRealm ); |