コード例 #1
0
ファイル: main.cpp プロジェクト: Kazanovitz/compiler
int main(void) {
    SymTab st; //symbol table
    // set this to 1 if you would like to print a trace 
    // of the entire parsing process (it prints to stdout)
    yydebug = 0; 
    
    // after parsing, the global "ast" should be set to the
    // syntax tree that we have built up during the parse
    yyparse();  
    
    // walk over the ast and print it out as a dot file
    dopass_ast2dot( ast );
    dopass_typecheck(ast, &st); 
    return 0;
}
コード例 #2
0
ファイル: main.cpp プロジェクト: jhenkens/CS160
int main(void) {

	SymTab st; //symbol table

	// set this to 1 if you would like to print a trace 
	// of the entire parsing process (it prints to stdout)
        yydebug = 0; 

	// after parsing, the global "ast" should be set to the
	// syntax tree that we have built up during the parse
        yyparse();  

	if (ast) {
		dopass_typecheck( ast, &st );
		dopass_constantfolding(ast, &st);

		// do codegen!
		dopass_codegen( ast, &st );
	}
    return 0;
}