Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ShParser.hpp

00001 // Sh: A GPU metaprogramming language.
00002 //
00003 // Copyright 2003-2005 Serious Hack Inc.
00004 // 
00005 // This library is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU Lesser General Public
00007 // License as published by the Free Software Foundation; either
00008 // version 2.1 of the License, or (at your option) any later version.
00009 //
00010 // This library is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 // Lesser General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU Lesser General Public
00016 // License along with this library; if not, write to the Free Software
00017 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
00018 // MA  02110-1301, USA
00020 #ifndef SHPARSER_HPP
00021 #define SHPARSER_HPP
00022 
00023 #include "ShDllExport.hpp"
00024 #include "ShCtrlGraph.hpp"
00025 #include "ShToken.hpp"
00026 
00027 namespace SH {
00028 
00033 class
00034 SH_DLLEXPORT ShParser {
00035 public:
00038   static void parse(ShCtrlGraphNodePtr& head,
00039                     ShCtrlGraphNodePtr& tail,
00040                     ShBlockListPtr blocks);
00041   
00042 private:
00043   static void parseBlock(ShCtrlGraphNodePtr& head, 
00044                          ShCtrlGraphNodePtr& tail,
00045                          ShBasicBlockPtr block);
00046   static void parseStmts(ShCtrlGraphNodePtr& head,
00047                          ShCtrlGraphNodePtr& tail,
00048                          ShBlockListPtr blocks);
00049   static void parseIf(ShCtrlGraphNodePtr& head,
00050                       ShCtrlGraphNodePtr& tail,
00051                       ShBlockListPtr blocks);
00052   static void parseFor(ShCtrlGraphNodePtr& head,
00053                        ShCtrlGraphNodePtr& tail,
00054                        ShBlockListPtr blocks);
00055   static void parseWhile(ShCtrlGraphNodePtr& head,
00056                          ShCtrlGraphNodePtr& tail,
00057                          ShBlockListPtr blocks);
00058   static void parseDo(ShCtrlGraphNodePtr& head,
00059                       ShCtrlGraphNodePtr& tail,
00060                       ShBlockListPtr blocks);
00061   static void parseSection(ShCtrlGraphNodePtr& head,
00062                            ShCtrlGraphNodePtr& tail,
00063                            ShBlockListPtr blocks);
00064 
00065   /* Just pops a token */
00066   static ShTokenPtr popToken(ShBlockListPtr blocks);
00067 
00068   /* Checks if front of block list matches expected, pops, and returns */
00069   static ShTokenPtr popToken(ShBlockListPtr blocks, ShTokenType expectedType, unsigned int expectedArgs=0);
00070 
00071 
00072   // NOT IMPLEMENTED
00073   ShParser();
00074   ShParser(const ShParser&);
00075   ~ShParser();
00076 };
00077  
00078 }
00079 
00080 #endif

Generated on Thu Jul 28 17:33:05 2005 for Sh by  doxygen 1.4.3-20050530