home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / sharew / exoten / rec / rec.hlp < prev    next >
Encoding:
Text File  |  1990-10-30  |  32.5 KB  |  643 lines

  1. Preface -- Statement of Policy
  2. Introduction
  3. Chapter 1.  The Structure of REC
  4. Chapter 2.  Operator Arguments and Data Structures
  5. Chapter 3.  The Pushdown List
  6. Chapter 4.  The Workspace
  7. Chapter 5.  Variables, the Compiling Operator and the OS Interface
  8. Chapter 6.  Operation of REC and User-supplied Extensions
  9. Appendix -- Summary of REC Operators and Predicates
  10. :
  11.  
  12.  
  13.                 PREFACE
  14.  
  15.     With dropping prices of microcomputers, programming is becoming 
  16. accessible to more people, and software is assuming an increasing importance 
  17. in the total balance of the operation of a computer. This has originated much 
  18. controversy about an author's rights to his software, ranging from the idea 
  19. that the world can be held to ransom for a brilliant idea to the suggestion 
  20. that there should be no impediment to any copying whatsoever.
  21.  
  22.     The research reported in this document has been supported by public 
  23. funds (Mexican, American, Swedish) in a number of institutions (Universities, 
  24. Atomic Energy Commissions, Polytechnic Institutes) over a decade or two. Its 
  25. result has especially been used in programming and applied mathematics 
  26. courses in an attempt to get people to learn it and to use it. Accordingly it 
  27. might be held to belong in the public domain.
  28.        
  29.  
  30.  
  31.  
  32.  
  33.     Most people read scientific literature, as well as any other 
  34. literature, to establish a background. Should they encounter something 
  35. particularly useful, they are expected to acknowledge its source, because the 
  36. resulting fame more than anything is the author's compensation for his work. 
  37. In those rare instances where a resounding commercial success has been the 
  38. sole or a substantial consequence of the largely unaltered use of an author's 
  39. work, it is to be expected that he, his associates, and his employer will 
  40. expect to share in the benefits. It is curious that there does not seem to be 
  41. a corresponding willingness to share in the consequences of a bungling or 
  42. even bona fide misapplication of the work or the attendant catastrophe, 
  43. should something go wrong.
  44.  
  45.     In short, although the authors have licensed REC and many REC 
  46. programs (especially Convert) for free personal, non-commercial use, they 
  47. retain copyright (duly registered at the Dirección General del Registro de 
  48. Derechos de Autor in México) and will appreciate proper acknowledgment of 
  49. source from users.
  50.  
  51.                 Gainesville, Florida, U.S.A.
  52.                 Puebla, Puebla, Mexico.
  53. :
  54.                 Introduction
  55.  
  56.     REC (Regular Expression Compiler) is the end product of an effort 
  57. begun many years ago at the University of Florida to find an aesthetic 
  58. structure to take the place of the "program feature" in McCarthy's LISP. 
  59. "Operator Predicates" were the solution evolved at that time. Later, when 
  60. they were taken completely out of the context of LISP and implemented on a 
  61. PDP-8 computer at the National Autonomous University of Mexico in 1966, the 
  62. programming language REC arose.
  63.  
  64.     For more than a decade thereafter it was used in programming, 
  65. numerical analysis and mathematical logic courses at the National Polytechnic 
  66. Institute, also in Mexico City, acquiring a number of versions and giving 
  67. many people considerable experience in its presentation and usage. REC 
  68. compilers developed at the Polytechnic included versions suitable for matrix 
  69. manipulations, text editing and numerical integration of second order 
  70. differential equations; REC was also used there to program hand calculations 
  71. on the Friden 132 desk calculator, one of the first machines to offer an 
  72. operand stack.  One version was used extensively in the administration and 
  73. data processing of the Mexican Nuclear Energy Institute, in conjunction with 
  74. the monitor system of the PDP-10.
  75.  
  76.     In the last five years, and with the advent of microcomputers, REC 
  77. has matured at the Autonomous University of Puebla into a very powerful 
  78. symbolic manipulation language with some arithmetic capabilities, which has 
  79. proved to be very well suited to the construction of compilers and operating 
  80. systems.
  81.  
  82.     REC possesses an extremely simple control structure consisting of 
  83. four symbols: the two parentheses, the colon, and the semicolon. Besides 
  84. these there may be any number of predicates and operators (these being a 
  85. special case of predicates), which are responsible for all the work to be 
  86. done.  This represents an attempt to reduce computer programming to its 
  87. barest essentials, both for pedagogical reasons, and in the expectation that 
  88. it will be a manageable structure when it is cast in its simplest terms. The 
  89. resulting language is very concise, not unlike APL or TECO. 
  90.  
  91.     As the allusion to regular expressions implies, there is also the 
  92. expectation that the language is intimately related to the theory of 
  93. computations. In effect, REC derives its appeal from the fact that computers 
  94. can be regarded reasonably well as Turing machines with very elaborate 
  95. built-in shortcuts to eliminate the grotesque inefficiency of manipulating 
  96. individual bits on a single linear tape. A Turing machine itself consists of 
  97. a finite-state machine acting as the control of a tape memory; finite state 
  98. machines in turn are conveniently described by regular expressions.
  99. The REC notation simply allows one to write regular expressions in a 
  100. manner somewhat more amenable to programming the Turing machine which they 
  101. control.  If one does not wish to think so strictly in terms of Turing 
  102. machines, REC expressions still provide a means of defining the flow of 
  103. control in a program which is quite convenient for many applications.
  104.  
  105.     REC defines only a control structure. It takes some getting used to, 
  106. but coincides well with contemporary ideas about "structured programming."  
  107. Some particularly useful REC languages come into being when specific sets of 
  108. operators and predicates are chosen. One selection gives the 
  109. symbol-manipulation language REC/MARKOV. People who are familiar with DEC's 
  110. PDP-10 will note a strong resemblance to TECO, although REC actually 
  111. contemporizes with or even antedates TECO. One of the most important 
  112. differences between these two languages is that TECO lacks REC's orderly 
  113. control structure.
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.     The REC/MARKOV processor is remarkably compact, fitting into about 
  123. 5Kbytes of memory in many machines (7.5Kbytes when floating point arithmetic 
  124. operations are included), exclusive of working storage. In the course of these
  125. notes we shall analyze the operation of the microcomputer implementation of 
  126. REC/MARKOV mentioned earlier; we shall call it simply REC throughout the 
  127. remainder of the notes. Our principal objective will be to introduce a symbol 
  128. manipulation programming language sufficiently powerful that it can handle 
  129. the compilation of REC languages in a wide variety of different computers. At 
  130. the same time one will have a language useful for text editing, assembly 
  131. including macro assembly and cross assemblers, compiling, and even file 
  132. maintenance and data analysis.  To do all this will also entail some 
  133. discussion of programming languages and computer architecture, but not to the 
  134. extent that no previous familiarity with such things is needed.
  135.  
  136. :        Chapter 1.  The Structure of REC
  137.  
  138.     To define formally a REC expression, let us use ten characters as 
  139. metasymbols, that is, symbols which would not appear explicitly in an actual 
  140. instance of the object being defined and whose significance as metasymbols is 
  141. limited to the definition in which they are used.  Let these characters be 
  142. [, ], *, |, =, o, p, E, P and n.  Establishing the convention that 
  143. concatenation is implicit, alternatives are separated by the vertical bar, 
  144. repetition --even zero times-- is denoted by an asterisk, square brackets are 
  145. used for grouping and the equals sign means "is defined as", a REC expression 
  146. E and a REC program P are defined recursively by
  147.  
  148. E = ( [[o | p | P]*[: | ;]]* [o | p | P]* )        P = E | { [P n]* P }
  149.  
  150. where the parentheses, colon, semicolon and braces, denote instances of them-
  151. selves, o denotes an operator, p denotes a predicate and n denotes a name for 
  152. the program preceding it (any printing ASCII character other than the space, 
  153. the atsign and the right brace).  In other words, a REC expression is a string
  154. enclosed by balanced parentheses, which consists of a sequence of predicates 
  155. or REC programs separated by punctuation consisting of one more colons or 
  156. semicolons; a REC program is either a REC expression or an alternating list 
  157. of programs and names, ending in a program and enclosed in braces.
  158.  
  159.     Operators and predicates carry out operations, not all of them 
  160. necessarily primitive.  They may be coded either in machine language or 
  161. consist of subroutines themselves defined in REC. Predicates differ from 
  162. operators by acquiring either of two truth values as a consequence of their 
  163. operation; operators always have the value TRUE.  The difference between 
  164. operators and predicates makes itself felt in the way that predicates can 
  165. affect the sequence of operations which is chosen to execute a program.  Both 
  166. REC expressions and programs acquire also a truth value as a result of their 
  167. execution and thus are composite predicates.
  168.  
  169.     A REC expression is executed by reading it from left to right in 
  170. sequence.  Operators or predicates are performed in the order in which they 
  171. occur, except that jumps occur after predicates if their truth value turns 
  172. out to be FALSE.  On encountering a right parenthesis, the expression 
  173. terminates with the value FALSE, but if a semicolon is encountered, 
  174. termination results with the value TRUE. Colons mean repetition from the 
  175. opening left parenthesis. Finally we have to say what kinds of jumps are 
  176. caused by predicates whose truth value is FALSE.  If there is a colon or 
  177. semicolon to the right of the predicate and on the same parenthesis level, 
  178. the jump is to the next position beyond. If there is none, the jump is beyond 
  179. the terminating right parenthesis, resulting in the value TRUE just as if a 
  180. semicolon had been encountered.
  181.  
  182. It should be mentioned that parentheses within parentheses are treated as a 
  183. single expression, so that all jumps originating inside a given level of 
  184. parentheses refer to locations only on the same level and never to locations 
  185. within subexpressions.
  186.  
  187.     The rules for executing a REC program P are as follows: if P is an 
  188. expression, it is executed as described in the preceding paragraphs.  If P is 
  189. a brace-enclosed list, the last program P (which is the main program of the 
  190. list) is executed; this rule is applied recursively until an expression E 
  191. (the program's main expression) is found.
  192.  
  193.     The following figure illustrates the flow of control in REC, assuming 
  194. the only colons, semicolons and parentheses are those explicitly shown, and p 
  195. is any predicate.  Jumps from colons point leftwards; all other jumps point
  196. to the right.  Jumps from predicates are taken only when they become FALSE.
  197.  
  198.      ┌─────────────────┬──────────────────────────┐
  199.      │     ┌──────┐       │           ┌──────┐   │      ┌──────┐
  200.     (     (p     )     :     (     p   ;     )    :   ;     )
  201.              └──────┘           └────┘     └─────┘    └
  202.  
  203.  
  204.  
  205.     The structure which we have described allows Boolean combinations of 
  206. predicates. Suppose that P, P1, and P2 are predicates. Then
  207.  
  208.     (P)       is not-P,        ()  is always FALSE,
  209.     (P1; P2;)  is (P1 or P2),    (;) is always TRUE,
  210.     (P1 P2;)   is (P1 and P2).
  211.  
  212.     Some care has to be taken with the Boolean interpretation because the 
  213. combinations which were described do not strictly follow the laws of Boolean 
  214. algebra. The principal discrepancy is the failure of the commutative law, 
  215. because the order in which the two predicates are executed might make a 
  216. difference. One reason for the importance of the order might be that an 
  217. irreversible operation is effected, such as initiating an input-output 
  218. operation, or changing the value of a variable, or something similar. Another 
  219. factor is the fact that algorithms are sometimes undefined, either because 
  220. their arguments are inappropriate, or the attempt to follow them out would 
  221. never terminate. By testing first for terminal conditions or for the 
  222. suitability of data, the undefined conditions can be avoided.
  223.  
  224.  
  225.  
  226.  
  227.  
  228.     The structured programming constructs if-then-else, while-do and
  229. repeat-until are readily expressed in REC: let p be a condition (i.e., a
  230. predicate), and o, o1 and o2 operations (no matter how complicated).  Then
  231.  
  232.     (p o1; o2;)    is    if p then o1 else o2
  233.     (p o;)        is    while p do o
  234.     (o p:;)        is    repeat o until p.
  235.  
  236. The first expression can clearly be extended to cover the else-if construct:
  237.  
  238.     (p1 o1; p2 o2; p3 o3; o4;)    is    if p1 then o1
  239.                         else if p2 then o2
  240.                         else if p3 then o3
  241.                         else o4
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.     Subroutines are defined in REC by grouping them together with a main 
  252. program within a pair of braces; any printing ASCII character other than the 
  253. space, atsign (@) or right brace may be assigned as a subroutine name.  In a 
  254. subroutine group
  255.  
  256.         { P1 n1 P2 n2   ...  Pk nk Pm }
  257.  
  258. where P1, P2, ... Pk and Pm are REC programs as defined above, the characters 
  259. denoted by n1, n2, ... nk are the names assigned to P1, P2, ... Pk, respective-
  260. ly, and Pm is the main program, where execution of the braced group starts.  
  261. Since a program within braces also has a truth value (that of its main 
  262. program), such a structure may also be given a name within an outer level of 
  263. braces, or it may appear as a composite predicate within a REC expression.
  264.  
  265. Subroutines are recursive and definitions that become active when entering a 
  266. pair of braces replace definitions of the same name which were active in the 
  267. previous level; on exit from a braced expression all of its definitions 
  268. become inactive and any definitions which were replaced on entry become 
  269. active again.  Calls are effected by the predicate @x, which produces a call 
  270. to subroutine x and whose truth value is that of the REC program named x.
  271.  
  272.  
  273.  
  274.     All of the above is illustrated in the following example, in which 
  275. ellipses (...) are used to denote features not essential to our discussion 
  276. and the numbers on the left are for reference only:
  277.  
  278.     [1]    {   {    ( ... @A ... ) A
  279.     [2]        ( ... @C ... @D ... ) B
  280.     [3]        ( ... @A ... )   } C
  281.     [4]        ( ... ) A    ( ... @A ... ) D
  282.     [5]        ( ... @A ...
  283.     [6]        {( ... ) A   ( ... @A ... ) }
  284.     [7]        ... @C ... @A ... )    }
  285.  
  286.     Assume the only subroutine definitions are the ones shown explicitly 
  287. in the example.  The main program is defined in lines 5 through 7; its level 
  288. of braces (which runs through the whole example) contains also definitions 
  289. for subroutines C (lines 1-3), A (line 4) and D (line 4). @A in lines 5 and 7 
  290. are calls to subroutine A of line 4, while @A in lines 1 and 3 refer to 
  291. subroutine A defined in line 1. The call @A appearing in line 6 calls 
  292. subroutine A of the same line. The subroutine A called by @A in D (line 4) 
  293. depends on who the caller of D is: when B calls D, @A in D invokes subroutine 
  294. A of line 1; when the main program calls D (line 8), @A in D refers to 
  295. subroutine A of line 4.
  296.  
  297.     Due to the mechanism whereby upon entrance to a brace level previous 
  298. definitions of the names defined in that level are saved and the new 
  299. definitions become active (with reversal of the process on exit), it will be 
  300. noticed that in our example the definition of subroutines D (line 4) and C 
  301. (lines 1-3) remain active throughout the entire program while the definition 
  302. of A depends on which pair of braces is currently executing.  B is only 
  303. defined within the brace pair defining C (lines 1-3) and reference to B from 
  304. any of the programs defined in lines 4-7 would cause immediate termination of 
  305. execution with an error message and return to the computer's operating system.
  306.  
  307.     Finally, both square brackets, the space and the comma have been 
  308. reserved for readability and documentation purposes.  Brackets are used to 
  309. delimit comments; these may be nested, so that it is possible to inhibit 
  310. compilation of a program or portion of a program containing comments by 
  311. enclosing it with a pair of brackets.  Comments may appear anywhere except 
  312. between an expression defining a subroutine and its name and between the main 
  313. program of a group and its closing right brace.  No operations have been 
  314. assigned to either the space or the comma, so they may be freely used to 
  315. improve the readability of programs.
  316.  
  317. :        Chapter 2.  Operator Arguments and Data Structures
  318.  
  319.     Insofar as REC is defined as a language exclusively in terms of its 
  320. control structure, leaving the selection of operators and predicates to be 
  321. chosen as best fits a given problem or application area, there can be 
  322. differing versions of REC, such as one dedicated to arithmetic, or another to 
  323. text editing, or even monitor systems whose primitive operations are fairly 
  324. complicated file handling subroutines.
  325.  
  326.     However, there are still general aspects of operators, such as the 
  327. way that they pass data to one another, or how they are formed into 
  328. subroutines, which remain the same from one version of REC to another.  No 
  329. doubt it is desirable to establish norms and a vocabulary for these aspects 
  330. of the language just as was done for the control structure.  For example, the 
  331. problem of data transmission can be considered.
  332.  
  333.     There are about three ways of passing information from one part of a 
  334. program to another --- at least three that have found a noticeably popular 
  335. acceptance. These are: by means of a calling sequence, by depositing the 
  336. information in known locations, or by means of a pushdown list.
  337.  
  338.  
  339.  
  340.     Calling sequences are associated with subroutine usage; one might 
  341. write
  342.  
  343.             CALL SUBROUTINE
  344.             (data # 1)
  345.             ( ... )
  346.             (data # n)
  347.         RETURN: ...
  348.  
  349.     Here, it is the program counter which localizes the area in which 
  350. data is stored. From the point of view of writing a program, especially in 
  351. assembly language, the registers following the subroutine call are a 
  352. convenient place to locate data, the more so if the computer being used does 
  353. not provide an automatic pushdown stack. This is particularly so if the data 
  354. is constant from one subroutine call to another, but differs from one calling 
  355. location to another.
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.     A second device for data transmission is to store information in a 
  364. known location which is accessible to all the subroutines and to the main 
  365. program.  A typical example of this type of communication is through COMMON 
  366. or labelled COMMON in FORTRAN programs. The method is particularly useful 
  367. when the data is never changed or only infrequently modified. Even though 
  368. this is its preferred use, it is not a real restriction because programs can 
  369. always store data in COMMON just before a subroutine jump. Speed can be 
  370. gained by thereby bypassing the way in which FORTRAN copies and restores the 
  371. arguments in subroutine calling sequences. Nevertheless the use of fixed 
  372. locations is most likely when the data is constant, or it is so widely used 
  373. throughout the program that it would be redundant to incorporate it in a 
  374. large number of calling sequences.
  375.  
  376.     The third technique of data communication is the use of a stack 
  377. pointer which locates the head of a structure known as a pushdown list. This 
  378. is the preferred method of handling temporary storage of the type which is 
  379. required in such applications as the execution of algebraic formulas. It is 
  380. nearly unavoidable whenever recursive programming is involved.
  381.  
  382.     The idea is to maintain a pointer to an array of temporary storage. 
  383. As the arguments of a function or subroutine are evaluated they are deposited 
  384. in the array and the pointer advanced to be ready for the next result.
  385.  
  386. When all of the arguments are present, the calculations are made and the 
  387. pointer moves backward, effectively erasing the arguments. Then the result of 
  388. the calculation is left in the last position on the array, in place of the 
  389. first argument if threre was one, and the process continues.
  390.  
  391.     Since each subroutine knows how many arguments it needs and how many 
  392. values it is going to deposit, the maintenance of the pointer and the 
  393. pushdown list is quite automatic. Errors can occur through setting up an 
  394. incorrect number or arguments, and it is always possible, especially in a 
  395. very deep recursion, that the pushdown list may grow beyond available space.  
  396. Some checking should always be done to prevent the pointer from straying out 
  397. of bounds.
  398.  
  399.     Primitive functions which have several arguments and which are coded 
  400. in machine language can easily locate their arguments through a displacement 
  401. relative to the stack pointer, but it is sometimes convenient to have a way 
  402. of directing a component of a composite subroutine to the nth argument. A 
  403. much more systematic way to make these arguments accessible is to give them 
  404. names, and set aside a special storage area for them. This leads to the idea 
  405. of a variable, even though its name may be nothing more than a serial number.
  406.  
  407.  
  408.  
  409.     Two activities concern the variables. First, its value has to be 
  410. transferred to the pushdown list when it occurs in a program so that it will 
  411. be available for use as an argument. Second, the value has to be transferred 
  412. from the pushdown list to the special storage area so as to define the 
  413. variable on entry into the subroutine.
  414.  
  415.     Two complications can occur, both aggravated when recursive 
  416. subroutines are allowed. One is that the same names may be in use in various 
  417. parts of the program, particularly when this happens both in the subroutine 
  418. and in the main program which called it. Then it is necessary that previous 
  419. values be set aside - not destroyed - when the subroutine is entered, and 
  420. that they be replaced upon exit.  Then all will work smoothly and the 
  421. conflict in variable names will not be noticed.
  422.  
  423.     The other complication which can occur is the one of free variables, 
  424. wherein we might not only want to refer to the kth argument of a subroutine, 
  425. but as well to the mth argument of a higher level subroutine which called it. 
  426. If no recursion is involved and one knows how many arguments each subroutine 
  427. had, the position of any given argument on the pushdown list can be 
  428. calculated; this is not possible when recursive subroutine chains are 
  429. permitted.
  430.  
  431.  
  432.     Rather, it is much more convenient to use the device of named 
  433. variables and copies of the arguments rather than working with offsets from 
  434. the stack pointer even though under restricted circumstances the latter is 
  435. more economical.
  436.  
  437.     Some argumentation also surrounds the decision as to whether an 
  438. operator ought to erase its own arguments, or whether the erasure ought to be 
  439. done by a separate operator. The argument in favor of automatic erasure is 
  440. that the pushdown list is then self-balancing, while the argument against 
  441. stems from the possibility of the iterated use of an operator.  In that case 
  442. it would seem futile to keep loading and erasing the same argument over and 
  443. over again.
  444.  
  445.     Finally we might want to get the nth argument directly off the 
  446. pushdown list without having to fetch it up to the top. This would facilitate 
  447. the definition of subroutines with an arbitrary number of arguments by 
  448. allowing them to be used directly without the intermediate step of storing 
  449. them as variables and fetching them out again later. However this direct 
  450. access will not work if some part of the subroutine itself involved a 
  451. recursive process, and thus direct access would not be usable in general.
  452.  
  453.  
  454.  
  455.     As a practical matter pushdown underflow and overflow have to be 
  456. detected and acted upon --- probably resulting in a fatal error message.
  457.  
  458.     Even though the definition of techniques of argument communication 
  459. does not form part of the official specification of REC, most varieties of 
  460. REC will naturally require data handling capabilities.  The current version 
  461. of REC has
  462.  
  463.     - An array, together with a pointer and limit registers, which can
  464.       be used as a pushdown list.
  465.     
  466.     - A space which can be used to store the values or addresses of 
  467.       variables.
  468.  
  469.     - A workspace into which text may be inserted and in which searches, 
  470.       deletions and substitutions may be carried out.
  471.  
  472.     Any other version of REC would be expected to have at least the first 
  473. two data structures.
  474.  
  475.  
  476.  
  477.  
  478.     In summary, the three data transference techniques and the error 
  479. detection aspect affect current REC programming in the following way:
  480.  
  481.     - A double push down list is used systematically; "double" referring 
  482.       to the fact that both ends of the (finite) list are available for 
  483.       argument storage.
  484.  
  485.     - Constants are introduced into a program through a subroutine which 
  486.       expects to find the constant as part of its calling sequence. 
  487.       Parameters may also be introduced into a subroutine through a 
  488.       calling sequence, but otherwise calling sequences are not much 
  489.       used. More elaborate compilers may even set aside variable space 
  490.       rather than calling sequence space for constants, referring to the 
  491.       constants only through pointers.
  492.  
  493.     - Variables or registers which are of central importance to a program 
  494.       are set aside, and manipulated through special operators.  This 
  495.       takes the form of  a workspace for text manipulation and a set of 
  496.       locations in which values or pointers to values may be stored.  
  497.       Otherwise there is not much data communication through fixed 
  498.       program areas.
  499.  
  500.  
  501.     - In order to conserve space, error detection and handling is kept to 
  502.       a minimum.  Pushdown list, workspace and compile area overflows 
  503.       cause a message to be issued and immediate termination of 
  504.       execution.  So does an attempt to read a source file or a memory 
  505.       buffer beyond its end during compilation (usually due to an excess 
  506.       of opening braces or parentheses).  Other errors are noted in a 
  507.       location reserved for this purpose; the question mark '?' is the 
  508.       predicate the programmer may use to find out whether an error has 
  509.       occurred.
  510.  
  511. ::REC3.HLP
  512. ::REC4.HLP
  513. ::REC5.HLP
  514. ::REC6.HLP
  515. :    Appendix.  List of REC Predicates and Operators
  516.  
  517. This section gives an index to the REC predicates and operators, ordered by 
  518. their ASCII codes.  [O] [P] and [C] indicate the corresponding character is 
  519. an operator, symbol or control flow character, respectively.  The notation 
  520. X/n under "Panel" means the description appears in panel n of section X in
  521. this help file; the notation X/Y/n:m means that the description appears in 
  522. panels n through m (or simply n) of subsection Y of the sub-help file
  523. invoked by selecting section X of this help file's menu.  A few items 
  524. are described more than once.
  525.  
  526. Character        Short description                Panel
  527.  
  528.    !    [O] Convert binary to ASCII hexadecimal.            E/C/7
  529.   "α"    [O] Load string α on the PDL. Nests alternately with 'ß'.      E/A/3:4
  530.    #    [O] Convert binary to decimal ASCII.                E/B/12
  531.    $    [O] Replace variable number by its table address.    E/C/6,    G/A/1
  532.    %    [O] Convert a number to the next shorter type.        E/A/10, E/B/10
  533.    &    [O] Exchange the top two PDL arguments.            E/B/12, E/C/2
  534.   'ß'    [O] Load string ß on the PDL. Nests alternately with "α".      E/A/3:4
  535.    (    [C] Start a REC expression.                 C/1,     C/3
  536.    )    [C] End a REC expression.                 C/1,     C/3
  537.  
  538.    *    [O] Logical AND or arithmetic product.                   E/B/7:8
  539.    +    [O] Logical OR or arithmetic sum.                E/B/7
  540.    ,    [C] No operation, used as a separator.                 C/8
  541.    -    [O] Logical exclusive OR, subtraction or sign of constant.    E/B/7
  542.    .    [O] Part of floating point constant to be loaded on the PDL.   E/B/3:6
  543.    /    [O] Division.                            E/B/3
  544.    0    [O] Part of numeric constant to be loaded on the PDL.    E/A/3, E/B/3:6
  545.    1    [O] Part of numeric constant to be loaded on the PDL.    E/A/3, E/B/3:6
  546.    2    [O] Part of numeric constant to be loaded on the PDL.    E/A/3, E/B/3:6
  547.    3    [O] Part of numeric constant to be loaded on the PDL.    E/A/3, E/B/3:6
  548.    4    [O] Part of numeric constant to be loaded on the PDL.    E/A/3, E/B/3:6
  549.    5    [O] Part of numeric constant to be loaded on the PDL.    E/A/3, E/B/3:6
  550.    6    [O] Part of numeric constant to be loaded on the PDL.    E/A/3, E/B/3:6
  551.    7    [O] Part of numeric constant to be loaded on the PDL.    E/A/3, E/B/3:6
  552.    8    [O] Part of numeric constant to be loaded on the PDL.    E/A/3, E/B/3:6
  553.    9    [O] Part of numeric constant to be loaded on the PDL.    E/A/3, E/B/3:6
  554.    :    [C] Repeat from start of expression.             C/1,     C/3
  555.    ;    [C] Take true exit from expression.             C/1,     C/3
  556.    >    [O] Restrict workspace.                        F/C/4
  557.    =    [P] Test string equality of top two PDL arguments.        E/A/9
  558.    >    [O] Reopen workspace (after <).                    F/C/4
  559.    ?    [P] Test occurrence of an error.                E/C/7
  560.  
  561.    @σ    [P] Call subroutine σ; @@ gets name/address from PDL top.     E/A/10:11
  562.    A    [P] Try moving WS pointer p1 forward one byte.            F/B/4
  563.    B    [P] Try moving p1 backward one byte.                F/B/4
  564.    C    [O] Compile a REC program/leave compilation area pointers.     G/B/1:3
  565.    D    [O] Delete the WS substring delimited by p1 and p2.        F/A/5
  566.    E    [P] Test equality of PDL top and WS substring at p1.        F/B/1
  567.    F    [P] Search WS starting at p1 for string matching PDL top.    F/A/4
  568.    G    [O] Load a string on the PDL given its address and length.    E/C/3
  569.    H    [P] Try hexadecimal ASCII to binary conversion on PDL top.     E/C/6:7
  570.    I    [O] Insert PDL top into the WS at p2.                F/A/4
  571.    J    [O] Move p1 to the beginning of the current WS text.        F/A/5
  572.    K    [O] Call operating system, leave return value(s) on PDL.    G/C/1
  573.    L    [O] Lift (pop) the top of the PDL.                E/A/5
  574.    M    [P] Test WS string for inclusion in lexicographic interval.    F/B/2:3
  575.    N    [P] Test top two PDL arguments for numerical inequality.    E/B/9
  576.    O    [P] Try decimal ASCII to binary conversion on PDL top.        E/B/11
  577.    P    [O] Save string in buffer if it will fit, note length.        E/C/5
  578.    Q    [O] Copy WS string between p1 and p2 to the PDL.        F/A/4
  579.    R    [O] Read a byte from the console keyboard onto the PDL.        E/A/8
  580.    S    [O] Store a string at the given address; pop both from the PDL. E/C/4
  581.    T    [O] Display PDL top on the console screen.            E/A/8
  582.    U    [P] Search for PDL top from p2, delimit intervening string.    F/B/1
  583.  
  584.    V    [P] Search for PDL top from p2, delimit from original p1.    F/B/2
  585.    W    [O] Print a string given its address and length on the PDL.    E/D/1
  586.    Xσ    [O] Execute user-supplied operator σ.                H/B/1
  587.    Y    [P] Move p1 and p2 according to PDL top.            F/B/5
  588.    Z    [O] Move p2 to the end of the WS text.                F/A/5
  589.   [α]    [C] A comment ignored by the compiler.  Comments nest in REC.     C/8
  590.    \    [O] Convert a number to the next longer type.            E/B/11
  591.    ]    [C] No operation; used only to balance left brackets.         C/8
  592.    ^    [O] Add one to PDL top.                        E/B/9
  593.    _    [O] Return to operating system.                    G/C/1
  594.    `    [P] Test console keyboard status.                G/C/2
  595.    a    [P] Try delimiting string of given length, starting at p1.    F/C/1
  596.    b    [P] Try delimiting string of given length, ending at p2.    F/C/1
  597.    c    [O] Create a block of given length on PDL, leave address too.    E/C/4
  598.    d    [P] Subtract one from top if nonzero; else pop and ret. false.    E/B/10
  599.    e    [P] Try extending WS text from p3 by amount given on PDL top.    F/C/2
  600.    f    [P] Replace WS string at p1 w/PDL top shorter than p2-p1.    F/C/2
  601.    g    [O] Get a byte from the given address, both remain on the PDL.    E/C/3
  602.    h    [O] Save/restore machine registers.                   E/C/8:9
  603.    i    [O] Input a byte from the given port.                E/D/2
  604.    j    [O] Move p2 to p1 (delimit leftmost null substring).        F/B/4
  605.    k    [O] Call operating system, no return values left on the PDL.    G/C/1
  606.  
  607.    l    [O] Put address of high PDL limit (current pz) on the PDL.    E/C/2
  608.    m    [O] Move PDL top to high end of the PDL.            E/A/5
  609.    n    [O] Retrieve last item sent by m to high PDL end.        E/A/5
  610.    o    [O] Output byte to the given port.                E/D/2
  611.    p    [O] Push address and length of the current top.            E/C/2
  612.    q    [O] Push current WS p1 and p2-p1.                F/B/4
  613.    r    [O] Replace address on the PDL by its (address-sized) contents.    E/C/5
  614.    s    [O] Save string in a buffer if it will fit.            E/C/5
  615.    t    [O] Display on the screen a string given address and length.    E/D/1
  616.    u    [O] Address-incrementing byte fetch.                E/C/3
  617.    v    [O] Address-updating string store.                E/C/4
  618.    w    [O] Copy/exchange WS pointers.                    F/C/3
  619.    xσ    [P] Execute predicate σ (x@ defines table to be used).           H/B/8:9
  620.    y    [O] Address-incrementing word fetch.                E/C/3
  621.    z    [O] Move p1 to p2 (delimit rightmost null substring).        F/B/4
  622.    {    [C] Start a subroutine group.                C/1,    C/6:7
  623.    |    [O] Concatenate top two PDL arguments.                E/A/10
  624.    }    [C] Terminate a subroutine group.            C/1,    C/6:7
  625.    ~    [O] Complement or negate PDL top.                E/B/9
  626.  
  627. :[REC.HLP]
  628.  
  629.  
  630.               REC -  A Regular Expression Compiler
  631.  
  632.  
  633.             Gerardo Cisneros and Harold V. McIntosh
  634.  
  635.          Departamento de Aplicacion de Microcomputadoras
  636.                 Instituto de Ciencias
  637.             Universidad Autonoma de Puebla
  638.  
  639.  
  640.             Copyright (c) 1976, 1985, 1990
  641.                   Gerardo Cisneros
  642.                    H. V. McIntosh
  643.