/* pa.h */ typedef enum { TTbad, TTidentifier, TTinteger, TTbinaryexpr, TTunaryexpr, TTstatementlist, TTblock, TTexprstatement, TTfunctioncall, TTexpressionlist, TTfieldselect, TTifstatement, TTfloat, TTwhilestatement, TTsimpletype, TTdecllist, TTnull, TTdeclareitemvar, TTdeclareitemptr, TTreturnstatement, TTdeclareitemarray, TTarrayaccess, TTdeclareitemfunction, TTdeclareparamlist, TTstring, TTstructtype, TTcoerce, TTfixedstructdef, TTfixeddecl, TTfixedfuncdef, TTfixedparam, TTTagtypebegin, TTsimple, TTpointerto, TTarrayof, TTstruct, TTfunction, } tagtype; typedef void Syntax; struct Sgeneric { tagtype tag; }; struct Sidentifier { tagtype tag; SymbolDescription *symbol; }; struct Sinteger { tagtype tag; int value; }; struct Sfloat { tagtype tag; float value; }; struct Sstring { tagtype tag; char *thestring; }; struct Sbinaryexpr { tagtype tag; Syntax *left, *right; SymbolKind operator; }; struct Sunaryexpr { tagtype tag; Syntax *operand; SymbolKind operator; }; struct Sfunctioncall { tagtype tag; Syntax *function, *arguments; }; struct Sarrayaccess { tagtype tag; Syntax *array, *index; }; struct Sfieldselect { tagtype tag; Syntax *structure; SymbolDescription *field; }; struct Sexpressionlist { tagtype tag; Syntax *first, *rest; }; struct Sgenericstatement { tagtype tag; int linenum; }; struct Sstatementlist { tagtype tag; int linenum; Syntax *first, *rest; }; struct Sblock { tagtype tag; int linenum; Syntax *declarations, *statements; }; struct Sexprstatement { tagtype tag; int linenum; Syntax *expression; }; struct Sifstatement { tagtype tag; int linenum; Syntax *condition, *iftrue, *iffalse; }; struct Swhilestatement { tagtype tag; int linenum; Syntax *condition, *body; }; struct Sreturnstatement { tagtype tag; int linenum; Syntax *value; }; struct Sfixeddecl { tagtype tag; int linenum; void *type; SymbolDescription *var; }; struct Sfixedparam { tagtype tag; int linenum; void *type; SymbolDescription *var; }; struct Sfixedfuncdef { tagtype tag; int linenum; void *type; SymbolDescription *name; Syntax *body; }; struct Sfixedstructdef { tagtype tag; int linenum; SymbolDescription *name; void *type; }; struct Ssimpletype { tagtype tag; SymbolKind type; }; struct Sstructtype { tagtype tag; SymbolDescription *name; Syntax *fielddecs; }; struct Sdeclareitemvar { tagtype tag; SymbolDescription *variable; }; struct Sdeclareitemfunction { tagtype tag; Syntax *name, *parameters, *body; }; struct Sdeclareparamlist { tagtype tag; Syntax *first, *rest; }; struct Sdeclareitemptr { tagtype tag; Syntax *towhat; }; struct Sdeclareitemarray { tagtype tag; int numelements; Syntax *ofwhat; }; struct Scoerce { tagtype tag; void *fromtype, *totype; Syntax *operand; }; void init_parser(void); void prepare_parser(void); void print_statement(Syntax *t); void print_syntax(FILE *f, Syntax *t); void print_tagged_tree(FILE *f, Syntax *t); Syntax *Pdeclaration(void);