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 software is provided 'as-is', without any express or implied
00006 // warranty. In no event will the authors be held liable for any damages
00007 // arising from the use of this software.
00008 // 
00009 // Permission is granted to anyone to use this software for any purpose,
00010 // including commercial applications, and to alter it and redistribute it
00011 // freely, subject to the following restrictions:
00012 // 
00013 // 1. The origin of this software must not be misrepresented; you must
00014 // not claim that you wrote the original software. If you use this
00015 // software in a product, an acknowledgment in the product documentation
00016 // would be appreciated but is not required.
00017 // 
00018 // 2. Altered source versions must be plainly marked as such, and must
00019 // not be misrepresented as being the original software.
00020 // 
00021 // 3. This notice may not be removed or altered from any source
00022 // distribution.
00024 #ifndef SHPARSER_HPP
00025 #define SHPARSER_HPP
00026 
00027 #include "ShDllExport.hpp"
00028 #include "ShCtrlGraph.hpp"
00029 #include "ShToken.hpp"
00030 
00031 namespace SH {
00032 
00037 class
00038 SH_DLLEXPORT ShParser {
00039 public:
00042   static void parse(ShCtrlGraphNodePtr& head,
00043                     ShCtrlGraphNodePtr& tail,
00044                     ShBlockListPtr blocks);
00045   
00046 private:
00047   static void parseBlock(ShCtrlGraphNodePtr& head, 
00048                          ShCtrlGraphNodePtr& tail,
00049                          ShBasicBlockPtr block);
00050   static void parseStmts(ShCtrlGraphNodePtr& head,
00051                          ShCtrlGraphNodePtr& tail,
00052                          ShBlockListPtr blocks);
00053   static void parseIf(ShCtrlGraphNodePtr& head,
00054                       ShCtrlGraphNodePtr& tail,
00055                       ShBlockListPtr blocks);
00056   static void parseFor(ShCtrlGraphNodePtr& head,
00057                        ShCtrlGraphNodePtr& tail,
00058                        ShBlockListPtr blocks);
00059   static void parseWhile(ShCtrlGraphNodePtr& head,
00060                          ShCtrlGraphNodePtr& tail,
00061                          ShBlockListPtr blocks);
00062   static void parseDo(ShCtrlGraphNodePtr& head,
00063                       ShCtrlGraphNodePtr& tail,
00064                       ShBlockListPtr blocks);
00065   static void parseSection(ShCtrlGraphNodePtr& head,
00066                            ShCtrlGraphNodePtr& tail,
00067                            ShBlockListPtr blocks);
00068 
00069   /* Just pops a token */
00070   static ShTokenPtr popToken(ShBlockListPtr blocks);
00071 
00072   /* Checks if front of block list matches expected, pops, and returns */
00073   static ShTokenPtr popToken(ShBlockListPtr blocks, ShTokenType expectedType, unsigned int expectedArgs=0);
00074 
00075 
00076   // NOT IMPLEMENTED
00077   ShParser();
00078   ShParser(const ShParser&);
00079   ~ShParser();
00080 };
00081  
00082 }
00083 
00084 #endif

Generated on Wed Jun 15 18:12:41 2005 for Sh by  doxygen 1.4.3-20050530