prognode.h 821 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef PROGNODE_H
  2. #define PROGNODE_H
  3. #include "node.h"
  4. #include "codegen.h"
  5. struct UserFunc{
  6. string ident,proc,lib;
  7. UserFunc( const UserFunc &t ):ident(t.ident),proc(t.proc),lib(t.lib){}
  8. UserFunc( const string &id,const string &pr,const string &lb ):ident(id),proc(pr),lib(lb){}
  9. };
  10. struct ProgNode : public Node{
  11. DeclSeqNode *consts;
  12. DeclSeqNode *structs;
  13. DeclSeqNode *funcs;
  14. DeclSeqNode *datas;
  15. StmtSeqNode *stmts;
  16. Environ *sem_env;
  17. string file_lab;
  18. ProgNode( DeclSeqNode *c,DeclSeqNode *s,DeclSeqNode *f,DeclSeqNode *d,StmtSeqNode *ss ):consts(c),structs(s),funcs(f),datas(d),stmts(ss){}
  19. ~ProgNode(){
  20. delete consts;
  21. delete structs;
  22. delete funcs;
  23. delete datas;
  24. delete stmts;
  25. }
  26. Environ *semant( Environ *e );
  27. void translate( Codegen *g,const vector<UserFunc> &userfuncs );
  28. };
  29. #endif