Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main.cc

    rfaf8857 rd3b7937  
    1010// Created On       : Fri May 15 23:12:02 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Dec 17 12:59:06 2015
    13 // Update Count     : 179
     12// Last Modified On : Wed Jan 27 22:20:20 2016
     13// Update Count     : 199
    1414//
    1515
     
    4545//#include "Try/Visit.h"
    4646
    47 #include "SemanticError.h"
    48 #include "UnimplementedError.h"
     47#include "Common/SemanticError.h"
     48#include "Common/UnimplementedError.h"
    4949
    5050#include "../config.h"
     
    7070        resolvep = false,                                                                       // used in AlternativeFinder
    7171        symtabp = false,
     72        treep = false,
    7273        validp = false,
    7374        errorp = false,
    7475        codegenp = false;
    7576
    76 enum { Ast, Bresolver, Expr, ExprAlt, Grammar, LibCFA, Nopreamble, Parse, Prototypes, Resolver, Symbol, Validate, };
     77enum { Ast, Bresolver, Expr, ExprAlt, Grammar, LibCFA, Nopreamble, Parse, Prototypes, Resolver, Symbol, Tree, Validate, };
    7778
    7879static struct option long_opts[] = {
     
    8889        { "resolver", no_argument, 0, Resolver },
    8990        { "symbol", no_argument, 0, Symbol },
     91        { "tree", no_argument, 0, Tree },
    9092        { "validate", no_argument, 0, Validate },
    9193        { 0, 0, 0, 0 }
     
    101103       
    102104        int c;
    103         while ( (c = getopt_long( argc, argv, "abefglnpqrsvyzD:", long_opts, &long_index )) != -1 ) {
     105        while ( (c = getopt_long( argc, argv, "abefglnpqrstvyzD:", long_opts, &long_index )) != -1 ) {
    104106                switch ( c ) {
    105107                  case Ast:
     
    146148                  case 's':                                                                             // print symbol table events
    147149                        symtabp = true;
     150                        break;
     151                  case Tree:
     152                  case 't':                                                                             // build in tree
     153                        treep = true;
    148154                        break;
    149155                  case 'v':                                                                             // dump AST after decl validation pass
     
    188194                if ( ! nopreludep ) {                                                   // include gcc builtins
    189195                        // -l is for initial build ONLY and builtins.cf is not in the lib directory so access it here.
    190                         FILE * builtins = fopen( libcfap ? "./builtins.cf" : CFA_LIBDIR "/builtins.cf", "r" );
     196                        FILE * builtins = fopen( libcfap | treep ? "builtins.cf" : CFA_LIBDIR "/builtins.cf", "r" );
    191197                        if ( builtins == NULL ) {
    192                                 std::cerr << "Error: can't open builtins" << std::endl;
     198                                std::cerr << "Error: can't open builtins.cf" << std::endl;
    193199                                exit( 1 );
    194200                        } // if
     
    198204                        if ( ! libcfap ) {
    199205                                // read the prelude in, if not generating the cfa library
    200                                 FILE * prelude = fopen( CFA_LIBDIR "/prelude.cf", "r" );
     206                                FILE * prelude = fopen( treep ? "prelude.cf" : CFA_LIBDIR "/prelude.cf", "r" );
    201207                                if ( prelude == NULL ) {
    202                                         std::cerr << "Error: can't open prelude" << std::endl;
     208                                        std::cerr << "Error: can't open prelude.cf" << std::endl;
    203209                                        exit( 1 );
    204210                                } // if
Note: See TracChangeset for help on using the changeset viewer.