InternalTree.mod 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. IMPLEMENTATION MODULE InternalTree;
  2. FROM Storage IMPORT ALLOCATE;
  3. FROM Scanner IMPORT POSITION;
  4. VAR nodecl : declPtr;
  5. nostat : stmtPtr;
  6. noexpr : exprPtr;
  7. PROCEDURE NewDeclSequence(p : POSITION): declPtr;
  8. VAR t : declPtr;
  9. BEGIN
  10. NEW(t); t^.kind := declsequence;
  11. t^.first := NIL;
  12. t^.rest := NIL;
  13. t^.position := p;
  14. RETURN t
  15. END NewDeclSequence;
  16. PROCEDURE NewStmtSequence(p: POSITION): stmtPtr;
  17. VAR t : stmtPtr;
  18. BEGIN
  19. NEW(t); t^.kind := stmtsequence;
  20. t^.first := NIL;
  21. t^.rest := NIL;
  22. t^.position := p;
  23. RETURN t
  24. END NewStmtSequence;
  25. PROCEDURE NewExprSequence(p: POSITION): exprPtr;
  26. VAR t: exprPtr;
  27. BEGIN
  28. NEW(t); t^.kind := exprsequence;
  29. t^.first := NIL;
  30. t^.rest := NIL;
  31. t^.position := p;
  32. RETURN t
  33. END NewExprSequence;
  34. PROCEDURE NoDeclaration(): declPtr;
  35. BEGIN
  36. RETURN nodecl
  37. END NoDeclaration;
  38. PROCEDURE NoStatement(): stmtPtr;
  39. BEGIN
  40. RETURN nostat
  41. END NoStatement;
  42. PROCEDURE NoExpression(): exprPtr;
  43. BEGIN
  44. RETURN noexpr
  45. END NoExpression;
  46. BEGIN
  47. NEW(nodecl); nodecl^.kind := nodeclaration;
  48. NEW(nostat); nostat^.kind := nostatement;
  49. NEW(noexpr); noexpr^.kind := noexpression;
  50. END InternalTree.