Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

AST Namespace Reference

Namespace for the AST Library everything inside the astnode library goes here, so that we can use short / comfy names like Loop instead of ASTNodeLoop or something longer. More...


Classes

class  Node
 Root node class, can save / load itself to its own file format, as well as be converted to 3ac subclasses declare the attributes they must have subclasses implement to3ac functionality. More...
class  List
 Special node type subclasses to contain a list of other nodes. More...
class  Leaf
class  Program
 Root Program node. More...
class  Def_Function
 Function Declaration. More...
class  Def_Struct
 Struct. More...
class  If
 Conditional -> If. More...
class  Jump
 break or continue More...
class  Loop
 for or while or do while More...
class  Return
 return More...
class  Op_Unary
 Unary Operation ++ -- * - sizeof. More...
class  Op_Binary
 Binary operation -> + - < > ... More...
class  Op_Ternary
 a?b:c; More...
class  Assignment
 a = b; b *= c; c = d More...
class  Constant
 5.0 More...
class  FunctionCall
 func(x,y,z) More...
class  Identifier
 x More...
class  Op_Bracket
 a[5] More...
class  Op_Dot
 x.y More...
class  Def_Var
 int x More...
class  Def_Array
 int x More...
class  AttributeProxy
 Attribute proxy allows some nicer ways to access the attributes then using set/get attributes Attribute proxy allows some nicer ways to access the attributes then using set/get attributes. More...

Functions

NodefromASTFile (FILE *f)
 Parse a .ast file and construct / return an AST from it.
NodefromASTFile (FILE *f)
 Parse a .ast file and construct / return an AST from it.


Detailed Description

Namespace for the AST Library everything inside the astnode library goes here, so that we can use short / comfy names like Loop instead of ASTNodeLoop or something longer.

Function Documentation

Node* AST::fromASTFile FILE *  f  ) 
 

Parse a .ast file and construct / return an AST from it.

Parse the astfile, building the astree as we go, then return said tree Use a boost.spirit parser to parse back in that beautiful, but hard to parse file It parses out the relavent tokens, and using several stacks pushes data together in the right way

Definition at line 210 of file ast_fromastfile.cc.

References stack_wrapped_node.

00210                              {
00211     printf("fromASTFile(%p)\n", f);
00212     string str;
00213     char s[1024];
00214     vector<string> v;
00215     while (fgets(s, 1024, f)) {
00216         if (s[0] == '\0')
00217             break;
00218         str += s;
00219     }
00220     ASTreeGrammar grammar;
00221 
00222     bool b = parse(str.c_str(), grammar, space_p).full;
00223     printf(b ? "ParsingSuccesful\n" : "Parsing Failed\n");
00224     Node* root = stack_wrapped_node.back();
00225     return root;
00226 }

Node* AST::fromASTFile FILE *  f  ) 
 

Parse a .ast file and construct / return an AST from it.

Parse the astfile, building the astree as we go, then return said tree Use a boost.spirit parser to parse back in that beautiful, but hard to parse file It parses out the relavent tokens, and using several stacks pushes data together in the right way

Definition at line 210 of file ast_fromastfile.cc.

References stack_wrapped_node.

00210                              {
00211     printf("fromASTFile(%p)\n", f);
00212     string str;
00213     char s[1024];
00214     vector<string> v;
00215     while (fgets(s, 1024, f)) {
00216         if (s[0] == '\0')
00217             break;
00218         str += s;
00219     }
00220     ASTreeGrammar grammar;
00221 
00222     bool b = parse(str.c_str(), grammar, space_p).full;
00223     printf(b ? "ParsingSuccesful\n" : "Parsing Failed\n");
00224     Node* root = stack_wrapped_node.back();
00225     return root;
00226 }


Generated on Thu Oct 20 12:00:04 2005 for ASTree by  doxygen 1.4.2-20050421