Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

cppcc_driver.cc

Go to the documentation of this file.
00001 /*
00002  *  File:       cppcc_driver.cc
00003  *              $Id: cppcc_driver.cc,v 1.10 2002/07/09 03:04:58 alec Exp $
00004  *
00005  *  Author:     Alec Panoviciu (alecu@email.com)
00006  * 
00007  *  Comments:
00008  *
00009  *  Revision history:
00010  *
00011  *  $Log: cppcc_driver.cc,v $
00012  *  Revision 1.10  2002/07/09 03:04:58  alec
00013  *  OWN_STRINGS bu*beep*it finally vanished
00014  *  gcc 3.1&mingw - related cleanups
00015  *
00016  *  Revision 1.9  2002/05/22 01:24:33  alec
00017  *  case sensitivity support
00018  *
00019  *  Revision 1.8  2002/05/16 21:33:05  alec
00020  *  parser generation done
00021  *
00022  *  Revision 1.7  2002/05/10 07:15:10  alec
00023  *  parser parse tree ok
00024  *
00025  *  Revision 1.6  2002/05/08 18:16:24  alec
00026  *  *** empty log message ***
00027  *
00028  *  Revision 1.5  2002/05/04 17:39:22  alec
00029  *  the scanner works (slightly tested)
00030  *
00031  *  Revision 1.4  2002/04/30 16:24:38  alec
00032  *  tested the scanner ptree & vBitVector implementation -> ok
00033  *
00034  *  Revision 1.3  2002/04/29 09:34:10  alec
00035  *  scanner ptree building compiles
00036  *
00037  */
00038 
00039 /*
00040   Copyright (C) 2002 Alexandru Panoviciu (alecu@email.com)
00041 
00042   This program is free software; you can redistribute it and/or modify
00043   it under the terms of the GNU General Public License as published by
00044   the Free Software Foundation; either version 2 of the License, or
00045   (at your option) any later version.
00046 
00047   This program is distributed in the hope that it will be useful,
00048   but WITHOUT ANY WARRANTY; without even the implied warranty of
00049   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00050   GNU General Public License for more details.
00051 
00052   You should have received a copy of the GNU General Public License
00053   along with this program; if not, write to the Free Software
00054   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00055 
00056  */
00057 
00058 
00059 #include "debug.h"
00060 #include "prop_registry.hh"
00061 #include "cppcc_driver.hh"
00062 #include "lex_yacc_parser.hh"
00063 #include "token_spec.hh"
00064 #include "scanner_spec.hh"
00065 #include "parser_spec.hh"
00066 #include "dfa_generator.hh"
00067 #include "scanner_dfa_spec.hh"
00068 #include "scanner_dfa_writer.hh"
00069 #include "token_writer.hh"
00070 #include "lanalyzer.hh"
00071 #include "la_parser_writer.hh"
00072 
00073 bool CppCcDriver::run (PropRegistry &registry)
00074 {
00075   ASSERT(registry.contains("input_file"), "no input file ???");
00076 
00077   TokenSpec tSpec;
00078   ScannerSpec sSpec(tSpec, registry);
00079   ParserSpec pSpec(registry, tSpec);
00080   LexYaccParser parser;
00081 
00082   if (!parser.parse(registry, tSpec, sSpec, pSpec))
00083     return false;
00084 
00085   DfaGenerator dfaGen;
00086   ScannerDfaSpec dfa = dfaGen.createScannerDfa(registry, sSpec, tSpec);
00087 
00088   LAnalyzer lan(registry);
00089   try {
00090     lan.makeLa(pSpec);
00091   } catch (ParseException &pex)
00092   {
00093     die(formatError(pex));
00094   }
00095   
00096   TokenWriter tkw(registry);
00097   tkw.writeTokenClass(tSpec, dfa.className);
00098   ScannerDfaWriter dfaw(tSpec, registry);
00099   dfaw.writeScanner(dfa);
00100 
00101   LaParserWriter pw(registry);
00102   pw.writeParser(pSpec, tSpec, sSpec.className);
00103 
00104   return true;
00105 }
00106   
00107   

Generated at Tue Jul 9 21:05:43 2002 for CppCC by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001