sourguid.txt 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. --- SOURGUID.TXT ---
  2. By Wadim Engelson , IMCS LU Riga, Latvia 16-oct-1990
  3. Revised 1-dec-1990 (for version 1.4)
  4. 8-apr-1991: (for version 1.50-no changes)
  5. 15-sep-1991: (for version 2.04, TP 5.5 changed to
  6. 6.0)
  7. Rigal source guide
  8. ==================
  9. Rigal is implemented as some tasks (.EXE-files), in
  10. two versions : RIG.EXE which is without the compiler option
  11. (more simple ) , and RIG1.EXE which calls several another
  12. tasks including interpreter, compiler and so on.
  13. Some of parts were compiled Pascal programs, some
  14. (ANRIG,GENRIG, RIG_LINT, RIG_CRF, RIG_PNT ) are compiled
  15. RIGAL programs.
  16. Pascal source files include all necessary subprograms
  17. ( UNITS in Turbo Pascal terms ) and main programs ( their
  18. names are equal to task names). Units are used both to
  19. compile tasks and to form additional part, which is added
  20. to standard Turbo PascaL library TURBO.TPL, which is used
  21. as Rigal runtime library.
  22. Turbo Pascal 6.0 (TPC.EXE) is used both to compile
  23. pascal code and in Rigal Compiler (as last phase of it).
  24. Pascal code compilation may run as batch ( batch command
  25. file RECOMP.BAT ) where correct directory name must be
  26. given as command line parameter). This directory must yet
  27. contain TPC.EXE , any version of TURBO.TPL and
  28. TPUMOVER.EXE. At the beginning all old Units are removed
  29. from TURBO.TPL, then normal compilation of some tasks is
  30. executed, then new Unit codes are added to TURBO.TPL.
  31. Rigal-written programs may be compiled by F8 key of
  32. the integrated environment (or simply by running RIGCOMP.BAT)
  33. and their names are equal to
  34. tasks (ANRIG, GENRIG are analysis and generation part of
  35. the compiler itself, CRF (=RIG_CRF) is Cross-referencer.
  36. ----- Porting considerations -----
  37. Before porting to another Pascal version - simple
  38. translation in MS-DOS Turbo Pascal 6.0 is recommended (5.0
  39. also may be used ).
  40. Two main problems are (1) using built-in Turbo Pascal
  41. procedures and functions and (2) using Unit-dependency
  42. schema.
  43. Here are recommended sequence of works which are need
  44. for porting of Rigal Environment from MS-DOS/Turbo Pascal
  45. version to Unix/Pascal or any another.
  46. At first we recommend to compile DEFINE.PAS unit. It
  47. describes types A and AA (the same) which must be 4 bytes
  48. length positive number, it is used everywhere as address of
  49. structured objects (atoms, list and tree descriptors)
  50. (S-space),and text pieces (symbolic constants) ( A-space).
  51. Below described fields of records must be of the same
  52. sub-division to bytes ( in Turbo Pascal no division to
  53. bits). Length of records in memory must be the same.
  54. DEFPAGE.PAS describes paging manager and loading and
  55. saving rigal objects. In preliminary porting loading and
  56. saving rigal objects in files is not implementable,
  57. butanother procedures will allocate rigal objects in
  58. ordinary heap memory, using A as POINTER type.
  59. In more advanced level of porting we need take under
  60. control such considerations about current version of paging
  61. manager : Low-level operations semantics must be under
  62. control; Virtual disk name comes as parameter from command
  63. line , and we are sure that if heap memory is big enough (
  64. 8 MBytes ?) - then no paging and no special disk name are
  65. needed. File names ( they are now defined as constants )
  66. may be of ANY nature , because they normally will not be
  67. opened, and all paging will execute only in heap memory.
  68. BlockRead & BlockWrite & Seek procedure semantic must be
  69. carefully tested; no special disk-error or memory-error or
  70. disk-overflow messages are produced now. It is not so easy
  71. to separate paging from SAVE/LOAD of Rigal objects and only
  72. Andris Zarins (third author) knows the details. Parameter
  73. passing by reference is essential now.
  74. Unit LEYER.PAS describes lexical analyzer of Rigal.
  75. STRING type is used to form every one token. STRING zero
  76. byte is not mentioned in programs. GotoXY and Write are not
  77. essential here. Pascal lexical analyzer (if it is need at
  78. all) may be changed later - as you want.
  79. Program RIGCHECK (version 1.4) is the simplest one:
  80. it takes a command line parameter - file which contains
  81. a .RIG program and
  82. executes syntax checking of Rigal program. Program name
  83. (a.rig) is given , lexical analyzer and
  84. (then) recursive descending analyze executes; either error
  85. message is showed in the screen (might be redirected by
  86. '>' DOS symbol), either program special code
  87. (need for interpretation ) is saved in A.RSC file.
  88. W*.PAS are parts of our domestic text editor. No
  89. toolboxes were used, only GotoXY, ClrScr , ClrEol and Write
  90. procedures were used for output to the screen. Colors are
  91. yet fixed as declared constants. Double direction chain of
  92. records in heap represents global buffer and additional
  93. one. We save names of 8 last used files. Procedure
  94. FindFirst and similar one are used to show directory. Error
  95. messages returned from checker, and editor shows this
  96. message and goes to according line and column where error
  97. occurred. You can of course to use your own text editor if
  98. you can form output and input parameters of procedure WED
  99. or similar one, menus , and to put error message into the
  100. appropriate place.( In any case it is much better to use
  101. ready text editor like
  102. MS-DOS MULTIEDIT (with Muliedit's "Big compile" option)).
  103. INT.EXE is interpreter of RSC files. There is no
  104. porting problems; circular calling of procedures is
  105. essential. No problems in text output or PRINT.
  106. First version (really working) RIG.EXE prototype now
  107. may be compiled. In preliminary version paging we do not
  108. use - it simplifies work (without real SAVE and LOAD).
  109. After this moment really working SAVE and LOAD are
  110. absolutely necessary.
  111. Now, COMPILER. Current Rigal->Pascal compiler
  112. generates some pascal files from one rigal program. Pascal
  113. code patterns and unit dependency is common for all cases,
  114. only count of files is changeable. You must design new
  115. dependency schema (what and how to generate in pascal
  116. files). After fixing all changes must be inserted into
  117. programs ATN.RIG and ATI3.RIG of compiler generation part.
  118. Compiler analysis part will not be changed. New pascal
  119. codes must allow circular calling of many procedures each
  120. other and all they call the Runtime Library. Of course
  121. dependency schema will be simple if it is allowed to
  122. compile more than 2 MBytes of pascal source code as one
  123. unit.
  124. Runtime library must be formed from the same pascal
  125. sources, which were used in interpreter or checker.
  126. Now run both parts of compiler may be run through
  127. themselves (using interpreter first time, and then - bootstrapping).
  128. Such a way you
  129. get ready ANRIG.EXE and GENRIG.EXE. Understanding of
  130. command line parameters passing is essential. Task calling
  131. we recommend to implement through additional batch file,
  132. which is generated by checker. It requires correct
  133. references to files and directories of user and of
  134. implementation and of PASCAL compiler.
  135. Now all tasks are linked to one or to set of tasks.
  136. RIG1 must be the main task.
  137. My experience shows that porting from RSX11M Oregon
  138. Pascal to VAX/VMS Pascal and then to MS-DOS Turbo Pascal
  139. takes one man * month each. It not includes paging manager,
  140. studying pascal differenced and operating systems.