parser.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2008 Kamil Dudka <xdudka00@stud.fit.vutbr.cz>
00003  *
00004  * This file is part of vyp08 (compiler and interpreter of VYP08 language).
00005  *
00006  * vyp08 is free software: you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation, either version 3 of the License, or
00009  * any later version.
00010  *
00011  * vyp08 is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with vyp08.  If not, see <http://www.gnu.org/licenses/>.
00018  */
00019 
00020 #ifndef PARSER_H
00021 #define PARSER_H
00022 
00023 #include "config.h"
00024 #include "scanner.h"
00025 
00026 #ifndef BUILDING_DOX
00027 #   include <string>
00028 #endif
00029 
00034 class IBuilder: public IErrorSensitive {
00035     public:
00036         virtual ~IBuilder() { }
00037         virtual void errorDetected()                    = 0; 
00038         virtual void glVar(EToken type, Token id)       = 0; 
00039         virtual void fncDeclInit(EToken type, Token id) = 0; 
00040         virtual void fncDeclArg(EToken type)            = 0; 
00041         virtual void fncDecl()                          = 0; 
00042         virtual void fncDefInit(EToken type, Token id)  = 0; 
00043         virtual void fncDefArg(EToken type, Token id)   = 0; 
00044         virtual void fncDefVar(EToken type, Token id)   = 0; 
00045         virtual void fncDefBody()                       = 0; 
00046         virtual void fncDef()                           = 0; 
00047         virtual void assign(Token token)                = 0; 
00048         virtual void ifEnter(Token token)               = 0; 
00049         virtual void ifElse()                           = 0; 
00050         virtual void ifLeave()                          = 0; 
00051         virtual void whileInit(Token token)             = 0; 
00052         virtual void whileEnter()                       = 0; 
00053         virtual void whileLeave()                       = 0; 
00054         virtual void pushToken(Token token)             = 0; 
00055         virtual void evalUnOp(Token token)              = 0; 
00056         virtual void evalBinOp(Token token)             = 0; 
00057 
00064         virtual void fncCall(Token id, int argsToPop, bool pushResult) = 0;
00065 
00071         virtual void fncCallPrint(Token id, EToken valType) = 0;
00072 };
00073 
00077 class Parser {
00078     public:
00085         static int parse(IScanner *scanner, IBuilder *builder, std::string fileName);
00086 #ifdef BUILDING_DOX
00087         // pull this in only for Doxygne to know these classes are being used
00088         IScanner *scanner;
00089         Builder *builder;
00090 #endif
00091     private:
00092         Parser();
00093 };
00094 
00095 #endif /* PARSER_H */

Generated on Sat Jul 4 18:32:59 2009 for vyp08 (compiler and interpreter of VYP08 language) by  doxygen 1.5.4