convtree.pas 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 by Florian Klaempfl
  4. Converts the old tree nodes into the new OOP nodest
  5. This unit is necessary to interface the new code generator
  6. with the old parser
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or
  10. (at your option) any later version.
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. GNU General Public License for more details.
  15. You should have received a copy of the GNU General Public License
  16. along with this program; if not, write to the Free Software
  17. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. ****************************************************************************
  19. }
  20. unit convtree;
  21. interface
  22. uses
  23. tree;
  24. function convtree2node(p : ptree) : pnode;
  25. implementation
  26. uses
  27. verbose,nstatmnt,nmem;
  28. function convtree2node(p : ptree) : pnode;
  29. function doconv(p : ptree) : pnode;
  30. var
  31. node : pnode;
  32. begin
  33. if assigned(p) then
  34. begin
  35. case p^.treetype of
  36. blockn:
  37. node:=new(pblocknode,init(doconv(p^.left)));
  38. assignn:
  39. node:=new(passignmentnode,init(doconv(p^.left),
  40. doconv(p^.right)));
  41. statementn:
  42. node:=new(pstatementnode,init(doconv(p^.left),
  43. doconv(p^.right)));
  44. loadn:
  45. node:=new(ploadnode,init(p^.symtableentry,p^.symtable));
  46. else internalerror(1209993);
  47. end;
  48. doconv:=node;
  49. end
  50. else
  51. doconv:=nil;
  52. end;
  53. begin
  54. convtree2node:=doconv(p);
  55. disposetree(p);
  56. end;
  57. end.
  58. {
  59. $Log$
  60. Revision 1.1 2000-07-13 06:30:08 michael
  61. + Initial import
  62. Revision 1.6 2000/01/07 01:14:53 peter
  63. * updated copyright to 2000
  64. Revision 1.5 1999/09/14 11:16:09 florian
  65. * only small updates to work with the current compiler
  66. Revision 1.4 1999/01/24 22:32:35 florian
  67. * well, more changes, especially parts of secondload ported
  68. Revision 1.3 1999/01/23 23:29:47 florian
  69. * first running version of the new code generator
  70. * when compiling exceptions under Linux fixed
  71. Revision 1.2 1999/01/19 10:19:04 florian
  72. * bug with mul. of dwords fixed, reported by Alexander Stohr
  73. * some changes to compile with TP
  74. + small enhancements for the new code generator
  75. Revision 1.1 1999/01/13 22:52:37 florian
  76. + YES, finally the new code generator is compilable, but it doesn't run yet :(
  77. }