home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pccts1.zip / UPDT110.TXT < prev   
Text File  |  1993-09-08  |  63KB  |  2,109 lines

  1.  
  2.               The Purdue Compiler Construction Tool Set
  3.                       Version 1.10 Release Notes
  4.  
  5.                             ANTLR and DLG
  6.  
  7.                            August 31, 1993
  8.  
  9.                              Terence Parr
  10.            Army High Performance Computing Research Center,
  11.                            University of MN
  12.                            (parrt@acm.org)
  13.  
  14.                       Will Cohen and Hank Dietz
  15.                    School of Electrical Engineering
  16.                           Purdue University
  17.                        (cohenw@ecn.purdue.edu)
  18.                         (hankd@ecn.purdue.edu)
  19.  
  20.         This is the TEXT version, the original was in PostScript.
  21.          Greek letters have been replaced with uppercase Arabic.
  22.              Subscripts have been encoded as _i postfixes.  
  23.                  Sorry for any errors.  DLH - 930908
  24.  
  25. 1.  Introduction
  26.  
  27.  
  28.      This document describes the changes/enhancements in  PCCTS  since
  29. version 1.06.  As with the 1.06 release notes, these notes do not con-
  30. stitute the complete reference manual.  Unfortunately,  the  reference
  31. manual  is in the same condition as it was for the 1.00 release in the
  32. Spring of 1992.  We are working on a  total  rewrite  of  the  manual,
  33. which might end up in a book consisting of the theory behind practical
  34. k-token lookahead for k>1 (Terence Parr's Ph.D.  thesis), ANTLR imple-
  35. mentation notes, and the PCCTS user's manual.
  36.  
  37.      The 1.10 release of  PCCTS  has  four  main  enhancements:  fully
  38. implemented  semantic  predicates (<<...>>?), infinite lookahead (plus
  39. selective backtracking that uses it), increased  ANTLR  (see  -ck  and
  40. ZZUSE_MACROS sections) and DLG speed, and the ability to link multiple
  41. ANTLR parsers together.  A number of bug fixes have been  incorporated
  42. as well.  The tutorials have not been updated much for this release.
  43.  
  44.      To better support our user's, we have established a mailing  list
  45. called  pccts-users  that  you  can  subscribe  to by sending email to
  46. pccts-users-request@arc.umn.edu with a body of "subscribe  pccts-users
  47. your-name".   Users that have registered with the PCCTS mail server at
  48. pccts@ecn.purdue.edu have not been automatically subscribed.  Once you
  49. have subscribed, posting a message to the PCCTS community is as simple
  50. as sending email to pccts-users@ahpcrc.umn.edu (with any Subject:  and
  51. body).    You   can   also   send  a  body  of  help  to  pccts-users-
  52. request@ahpcrc.umn.edu to get help on using the mailing list server.
  53.  
  54.      We have finally agreed on a numbering scheme for PCCTS  releases:
  55. x.yz where x reflects the major release number (new tool additions), y
  56. reflects major new feature additions, and z  reflects  bug  fixes  and
  57. minor feature additions (minor releases).
  58.  
  59.  
  60.  
  61.                                                                 Page 1
  62.  
  63.                                                                  PCCTS
  64.  
  65.  
  66. 2.  Semantic Predicates
  67.  
  68.      The fundamental idea behind semantic predicates has  not  changed
  69. since  the  1.06  release -  semantic predicates indicate the semantic
  70. validity of continuing with the parse or of  predicting  a  particular
  71. production.   However, we now collect all predicates visible to a syn-
  72. tactically ambiguous parsing decision rather than just the  first  one
  73. encountered as in 1.06.  In addition, the context of the predicate can
  74. be computed and hoisted with the predicates; helpful warning are  also
  75. generated  for  incompletely disambiguated parser decisions.  The only
  76. backward incompatibilities are that parsing does  not  halt  automati-
  77. cally  if  a  semantic  validation  predicate  fails  and  the  -pr is
  78. obsolete - the specification of a predicate implies  that  it  may  be
  79. used  by  ANTLR  to validate and disambiguate as it sees fit.  In this
  80. section we discuss all of these issues.
  81.  
  82. 2.1.  Visible Semantic Predicates
  83.  
  84.      Given a syntactically ambiguous parser decision (or,  more  accu-
  85. rately,  a  non-deterministic  decision), ANTLR attempts to resolve it
  86. with semantic information - ANTLR searches for visible predicates.   A
  87. visible  predicate  is  a  semantic  predicate that could be evaluated
  88. without consuming an input token or executing a  user  action  (except
  89. initialization  actions, which generally define variables).  All visi-
  90. ble predicates reside on the left edge of productions; predicates  not
  91. on  the left edge can only function as validation predicates (see 1.06
  92. release notes).  Consider a simple example:
  93.  
  94.  
  95. a       :       <<pred_1>>?  ID A
  96.         |       <<pred_2>>?  ID B
  97.         ;
  98.  
  99.  
  100. Assuming that lookahead information is insufficient to predict produc-
  101. tions  of  rule  a, ANTLR would incorporate pred_1 into the prediction
  102. expression for the first production and pred_2 into the second predic-
  103. tion expression.  Multiple predicates can be hoisted (which may or may
  104. not be what you want):
  105.  
  106.  
  107. decl    :   <<pred_1>>? var
  108.         |   <<pred_2>>? ID
  109.         ;
  110. var     :   <<is_var(LATEXT(1))>>? ID
  111.         ;
  112.  
  113.  
  114. In this case, the prediction expression for  production  one  of  rule
  115. decl would resemble (with context computation turned off - see below):
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.                                                                 Page 2
  124.  
  125.                                                                  PCCTS
  126.  
  127.  
  128.  
  129. if ( pred_1 && is_var(LATEXT(1)) && LA(1)==ID ) {
  130.         var();
  131. }
  132.  ...
  133.  
  134.  
  135. Here, two visible predicates were found to disambiguate the prediction
  136. of  the  first  production of rule decl whereas only one was found for
  137. the prediction of the second production.
  138.  
  139.      The action of evaluating a predicate  in  a  decision  is  called
  140. hoisting.   In  the first example of this section, predicates were not
  141. moved since they reside at the decision point in rule a,  but  techni-
  142. cally  we say that they were hoisted into the decision.  In the second
  143. example,  pred_1  was  hoisted  from  decl  and  is_var(LATEXT(1)) was 
  144. hoisted from rule var1 to predict the first production of decl.
  145.  
  146. 2.2.  Context of Semantic Predicates
  147.  
  148.      In release 1.06, predicates were hoisted  without  computing  and
  149. hoisting the context of that predicate.  Context is important because,
  150. as we saw in the last section, predicates may be evaluated in  totally
  151. different  rules.   Imagine  a  rule that had many alternative produc-
  152. tions, two of which were syntactically nondeterministic because  of  a
  153. common  lookahead of ID (assuming that only one symbol of lookahead is
  154. available for simplicity).
  155.  
  156.  
  157. a       :       A ...
  158.         |       B ...
  159.         |       classname
  160.         |       C ...
  161.         |       varname
  162.         |       D ...
  163.         ;
  164. classname
  165.         :       <<pred_1>>? ID
  166.         ;
  167. varname
  168.         :       <<pred_2>>? ID
  169.         ;
  170.  
  171.  
  172. Simply incorporating pred_i into the production prediction expressions
  173. for alternatives three and five is not safe for two reasons:
  174.  
  175. [1]  Evaluation of pred_i may  cause  a  program  execution  error  if
  176.      evaluated  on the wrong type of data. pred_i will be evaluated on
  177.      any input, which is {A, B, C, D, ID}  in  our  case -  pred_i may
  178.      "core" if fed non-ID token types.
  179.  
  180. [2]  pred_i may give misleading results even if it  does  not  "core".
  181.      pred_i may  return  false  even  though  the  production  is  not
  182.  
  183.  
  184.  
  185.                                                                 Page 3
  186.  
  187.                                                                  PCCTS
  188.  
  189.  
  190.      dependent on the predicate for that token type.  For example:
  191.  
  192.  
  193.      a   :   (var | NUM) ...
  194.          |   <<!is_var(LATEXT(1))>>?  ID ...
  195.          ;
  196.      var :   <<is_var(LATEXT(1))>>?   ID
  197.          ;
  198.  
  199.  
  200.      The  first  production   will   never   match   a   NUM   because
  201.      is_var(LATEXT(1))  will  always  evaluate to false for that token
  202.      type since numbers are not variables ever (the predicate  in  var
  203.      is hoisted for use in the decision for rule a).
  204.  
  205. The way to solve both problems is to change pred_i to:
  206.  
  207.  
  208.         LA(1)==ID ? pred_i : 1
  209.  
  210.  
  211. The 1 merely indicates that if the lookahead is not an ID then  enable
  212. the  production  for  normal parsing - we have no semantic information
  213. that establishes the validity or invalidity of the production.
  214.  
  215.      Context computation similar to this is can now be done  automati-
  216. cally (-prc on).  Unfortunately, as mentioned previously in this docu-
  217. ment, computing full LL(k) lookahead is, in  general,  an  exponential
  218. problem;  hence, for large grammars you may want to keep this off with
  219. -prc off (default) and include context tests manually in  your  predi-
  220. cates.   The  old -pr option to turn on parsing with predicates is now
  221. ignored as the specification of a predicate indicates that  it  should
  222. be used.
  223.  
  224.      ANTLR does its best to warn the user when a possibly incompletely
  225. disambiguated grammar has been specified.  In other words, when a syn-
  226. tactically ambiguous decision is resolved  with  semantic  predicates,
  227. all  mutually  ambiguous  productions  must have at least one semantic
  228. predicate associated with it.  For example:
  229.  
  230.  
  231. a   :   <<pred>>?  ID ...
  232.     |   ID ...
  233.     ;
  234.  
  235.  
  236. This grammar will yield a warning when run through ANTLR with -w2  set
  237. because semantic information was not provided to indicate the validity
  238. of the second production:
  239.  
  240.  
  241. t.g, line 1: warning: alt 2 of the rule itself has no predicate to resolve ambiguity
  242.  
  243.  
  244.  
  245.  
  246.  
  247.                                                                 Page 4
  248.  
  249.                                                                  PCCTS
  250.  
  251.  
  252. However, rule a will behave  correctly  because  if  pred  fails,  the
  253. second production will be attempted as the default case (remember that
  254. a missing semantic predicate is equivalent to <<1>>?).  Adding a third
  255. production  that  began with ID would not behave correctly as the last
  256. ID-prefixed production would never be matched.
  257.  
  258.      As a more complicated example, consider the following incorrectly
  259. disambiguated grammar:
  260.  
  261.  
  262. a   :   b
  263.     |   <<pred_1>>? ID
  264.     |   <<pred_2>>? NUM
  265.     ;
  266.  
  267. b   :   <<pred_3>>? ID
  268.     |   NUM
  269.     ;
  270.  
  271.  
  272. Rule a cannot predict which production to match upon lookahead  ID  or
  273. NUM.  Alternatives 2 and 3 have been disambiguated, but the first pro-
  274. duction hoists a predicate that only "covers" ID's.  As a result,  the
  275. following message is generated by ANTLR:
  276.  
  277.  
  278. t.g, line 1: warning: alt 1 of the rule itself has no predicate to resolve ambiguity upon { NUM }
  279.  
  280.  
  281. This detection is a great help during grammar development.
  282.  
  283.      Ambiguity warnings are now turned off  for  decisions  that  have
  284. semantic predicates covering all ambiguous lookahead sequences.
  285.  
  286. 2.3.  Failure of predicates
  287.  
  288.      Predicates that are not used in disambiguating parsing  decisions
  289. are  called  validation predicates.  Previously, validation predicates
  290. that failed during parsing printed out a message  and  terminated  the
  291. parser:
  292.  
  293.  
  294.      if (!pred) {fprintf(stderr,"failed predicate: 'pred'\n);exit(1);}
  295.  
  296.  
  297. The latest release of ANTLR generates a call to a macro that the  user
  298. may define called zzfailed_pred(), which is passed a string represent-
  299. ing the predicate that failed:
  300.  
  301.  
  302.      if (!pred) {zzfailed_pred("pred");}
  303.  
  304.  
  305. while this solution is not ideal, it is much better than before.
  306.  
  307.  
  308.  
  309.                                                                 Page 5
  310.  
  311.                                                                  PCCTS
  312.  
  313.  
  314. 3.  Infinite lookahead and Backtracking
  315.  
  316.      There are a number of grammatical constructs  that  normal  LL(k)
  317. recursive-descent  parsing  cannot  handle.   The most obvious example
  318. would be left-recursion, but left-recursion can be  removed  by  well-
  319. known  algorithms.  The nastiest grammar construct is one in which two
  320. alternative productions cannot be distinguished without examining  all
  321. or  most  of  the production.  While left-factoring can handle many of
  322. these cases, some cannot be handled due to things like  action  place-
  323. ment,  non-identical  left-factors,  or  alternatives productions that
  324. cannot be reorganized  into  the  same  rule.   The  solution  to  the
  325. arbitrarily-large  common  left-factor  problem is simply to use arbi-
  326. trary lookahead; i.e., as much  lookahead  as  necessary  to  uniquely
  327. determine which production to apply.
  328.  
  329.      ANTLR 1.10 provides two mechanisms for using  "infinite"  amounts
  330. of  lookahead.  The first is to use semantic predicates in conjunction
  331. with a user-defined function that scans arbitrarily ahead using a  set
  332. of  macros  provided  in  this release.  The second is a more implicit
  333. scheme by which the user can annotate those sections of  the  grammar,
  334. which  defy  normal  LL(k) analysis, with syntactic predicates.  ANTLR
  335. will then generate code that simply tries out the  indicated  alterna-
  336. tive  production  to  see if it would match a portion of the remaining
  337. input.  If not, the generated parser would try the next viable  alter-
  338. native  production.   This  scheme is a form of selective backtracking
  339. (and, hence, can recognize the class of context free languages)  where
  340. most  of  a parser is deterministic and only the "hard" parts are done
  341. using trial-and-error.  As a direct consequence, ANTLR  can  now  gen-
  342. erate  parsers  with  the  semantic  flexibility  of  LL(k),  that are
  343. stronger than full LR(k) (in theory), and are nearly  linear  in  com-
  344. plexity;  note  that  the semantic predicates (first introduced in the
  345. 1.06 release) can take ANTLR-generated parsers beyond the context-free
  346. language limit into the context-sensitive.
  347.  
  348.      We begin this section by introducing the notion of infinite  loo-
  349. kahead through an example problem that we solve with semantic and then
  350. with syntactic predicates.  Following this, we describe in detail  the
  351. syntax  and  use of syntactic predicates, which employ infinite looka-
  352. head to perform selective backtracking.
  353.  
  354. 3.1.  Examples
  355.  
  356.      This section presents a simple  grammar  whose  productions  have
  357. common left-factors that we assume, for the sake of demonstration pur-
  358. poses, to be non left-factorable.  With nothing but the grammar, ANTLR
  359. would be unable to construct a deterministic parser.  We first provide
  360. a solution by writing a function that explicitly accesses the infinite
  361. lookahead  buffer  to  determine which production should be attempted.
  362. This solution is efficient, but would become somewhat tedious for  the
  363. programmer if it had to be done for each such problem in a large gram-
  364. mar.  Fortunately, an easier and more concise solution is provided  by
  365. syntactic  predicates,  which we also demonstrate using the same gram-
  366. mar.
  367.  
  368.  
  369.  
  370.  
  371.                                                                 Page 6
  372.  
  373.                                                                  PCCTS
  374.  
  375.  
  376.      Consider ML which has multiple assignment  and  list  statements.
  377. E.g.,
  378.  
  379.  
  380. stat:   list Assign list ";"    <<printf("list = list\n");>>
  381.     |   list ";"                <<printf("list\n");>>
  382.     ;
  383.  
  384.  
  385. This grammar is not LL(k) for any k as list can be  arbitrarily  long.
  386. The following grammar using semantic predicates to access the infinite
  387. lookahead buffer  to  explicitly  compute  which  production  will  be
  388. matched.
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.                                                                 Page 7
  434.  
  435.                                                                  PCCTS
  436.  
  437.  
  438.  
  439. /* example use of the infinite lookahead buffer macros
  440.  * compile with:
  441.  *              antlr list.g
  442.  *              dlg parser.dlg scan.c
  443.  *              cc -Iantlr_includes -DZZINF_LOOK -o list list.c scan.c err.c
  444.  */
  445. #header <<#include "charbuf.h">>
  446.  
  447. <<
  448. main() { ANTLR(stat(), stdin); }
  449.  
  450. /* Scan for a "=", but only before a ";" -- return 1 if found, else 0
  451.    This performs the same function as using the syntactic predicate:
  452.         (list Assign list ";")?
  453.    but uses a semantic predicate coupled with the infinite-lookahead feature.
  454.    It is somewhat faster as it does not actually *parse* the "list =", it just
  455.    scans ahead.
  456.  
  457.    MUST HAVE "ZZINF_LOOK" PREPROCESSOR FLAG DEFINED
  458.    (in #header or on compiler command line)
  459.    */
  460. which()
  461. {
  462.     int i;
  463.  
  464.     for (i=1; ZZINF_LA_VALID(i); i++)
  465.     {
  466.         if ( ZZINF_LA(i) == Assign ) return 1;
  467.         else if ( ZZINF_LA(i) == Semi ) return 0;
  468.     }
  469.     return 0;
  470. }
  471. >>
  472.  
  473. #token                  "[\ \t]+"        <<zzskip();>>
  474. #token                  "\n"             <<zzskip(); zzline++;>>
  475. #token Assign   "="
  476. #token Semi             ";"
  477.  
  478. stat:  <<which()>>? list Assign list ";" <<printf("list = list\n");>>
  479.     |   list ";"                         <<printf("list\n");>>
  480.     ;
  481.  
  482. list:   "\(" elem ("," elem)* "\)"
  483.     ;
  484.  
  485. elem:   ID
  486.     |   INT
  487.     ;
  488.  
  489. #token ID               "[a-zA-Z]+"
  490. #token INT              "[0-9]+"
  491.  
  492.  
  493.  
  494.  
  495.                                                                 Page 8
  496.  
  497.                                                                  PCCTS
  498.  
  499.  
  500. The infinite lookahead buffer may be accessed with the following  mac-
  501. ros:
  502.  
  503. ZZINF_LA(i)
  504.      Return the ith token of lookahead relative to the  current  posi-
  505.      tion.    Hence,   ZZINF_LA(1)..ZZINF_LA(k)   are   equivalent  to
  506.      LA(1)..LA(k).  The difference  is  that  i  can  range  from  the
  507.      current token of lookahead until the last token of lookahead with
  508.      ZZINF_LA(i).
  509.  
  510. ZZINF_LATEXT(i)
  511.      Identical to ZZINF_LA(i) except that the text of the ith token is
  512.      returned.
  513.  
  514. ZZINF_LA_VALID(i)
  515.      Returns 1 if i if at least i non-EOF tokens are left in the input
  516.      stream else it returns 0.
  517.  
  518. Naturally, the use of infinite lookahead  by  defining  ZZINF_LOOK  is
  519. inconsistent  with  interactive  parsers as the entire input stream is
  520. read in before parsing begins.
  521.  
  522.      As mentioned above, this method could be tedious for large  gram-
  523. mars, hence, ANTLR provides a more elegant solution.  The same problem
  524. can be solved with a syntactic predicate by changing rule stat in  the
  525. following way:
  526.  
  527.  
  528. stat:   ( list Assign list ";" )?       <<printf("list = list\n");>>
  529.     |   list ";"                        <<printf("list\n");>>
  530.     ;
  531.  
  532.  
  533. Using this implicit method, the need for the  semantic  predicate  and
  534. the which() function disappears.
  535.  
  536.      Let's now consider a small chunk of the vast C++ declaration syn-
  537. tax.   Can you tell exactly what type of object f is after having seen
  538. the left parenthesis?
  539.  
  540.  
  541. int f(
  542.  
  543.  
  544. The answer is "no.".  Object f could be an integer initialized to some
  545. previously defined symbol a:
  546.  
  547.  
  548. int f(a);
  549.  
  550.  
  551. or a function prototype or definition:
  552.  
  553.  
  554.  
  555.  
  556.  
  557.                                                                 Page 9
  558.  
  559.                                                                  PCCTS
  560.  
  561.  
  562.  
  563. int f(float a) {...}
  564.  
  565.  
  566. The following is a greatly simplified grammar for these  two  declara-
  567. tion types:
  568.  
  569.  
  570. decl    :   type ID "\("   expr_list   "\)"  ";"
  571.         |   type ID "\(" arg_decl_list "\)"  func_def
  572.         ;
  573.  
  574.  
  575. One notices that left-factoring type ID "\(" would be trivial  because
  576. our grammar is so small and the left-prefixes are identical.  However,
  577. if a user action were required before recognition of the reference  to
  578. rule type, left-factoring would not be possible:
  579.  
  580.  
  581. decl : <</* dummy init action so next action is not taken as init */>>
  582.        <<printf("var init\n");>>   type ID "\(" expr_list "\)" ";"
  583.      |
  584.        <<printf("func def\n");>>   type ID "\(" arg_decl_list "\)" func_def
  585.      ;
  586.  
  587. The solution to the problem involves looking arbitrarily  ahead  (type
  588. could  be arbitrarily big, in general) to determine what appears after
  589. the left-parenthesis.  This problem is  easily  solved  implicitly  by
  590. using the new (...)? syntactic predicate:
  591.  
  592. decl :
  593.       ( <<;>> <<printf("var init\n");>> type ID "\(" expr_list "\)" ";" )?
  594.      |
  595.       <<printf("func def\n");>>  type ID "\(" arg_decl_list "\)" func_def
  596.      ;
  597.  
  598. The (...)? says that it is impossible to decide, from the left edge of
  599. rule  decl  with  a  finite  amount  of lookahead, which production to
  600. predict.  Any grammar construct inside a (...)?   block  is  attempted
  601. and, if it fails, the next alternative production that could match the
  602. input is attempted.  This represents  selective  backtracking  and  is
  603. similar  to  allowing ANTLR parsers to guess without being "penalized"
  604. for being wrong.  Note that the first action  of  any  block  is  con-
  605. sidered  an  init action and, hence, cannot be disabled (by placing it
  606. inside {...}) since it may define variables; the first action  of  the
  607. block is a dummy action.
  608.  
  609.      At this point, some readers may argue that scanning  ahead  arbi-
  610. trarily  far, using the infinite lookahead via a semantic or syntactic
  611. predicate, renders the parser non-linear in  nature.   While  this  is
  612. true,  the  slowdown  is  negligible  as  the parser is mostly linear.
  613. Further, it is better to have a capability that  is  slightly  ineffi-
  614. cient than not to have the capability at all.
  615.  
  616.  
  617.  
  618.  
  619.                                                                Page 10
  620.  
  621.                                                                  PCCTS
  622.  
  623.  
  624. 3.2.  Syntactic Predicates
  625.  
  626.      Just as semantic predicates indicate when a production is  valid,
  627. syntactic  predicates  also  indicate when a production is a candidate
  628. for recognition.  The difference lies in the type of information  used
  629. to predict alternative productions.  Semantic predicates employ infor-
  630. mation about the "meaning" of the input (e.g., symbol  table  informa-
  631. tion)  whereas syntactic predicates employ structural information like
  632. normal LL(k) parsing decisions.  Syntactic predicates specify a  gram-
  633. matical  construct that must be seen on the input stream for a produc-
  634. tion to be valid.  Moreover, this construct may  match  input  streams
  635. that  are  arbitrarily  long;  normal  LL(k) parsers are restricted to
  636. using the next k symbols of lookahead.   This  section  describes  the
  637. form and use of syntactic predicates as well as their implementation.
  638.  
  639. 3.2.1.  Syntactic Predicate Form
  640.  
  641.      Syntactic predictions have the form
  642.  
  643.  
  644.         ( A )? B
  645.  
  646.  
  647. or, the shorthand form
  648.  
  649.  
  650.         ( A )?
  651.  
  652.  
  653. which is identical to
  654.  
  655.  
  656.         ( A )? A
  657.  
  658.  
  659. where A and B are arbitrary Extended BNF (EBNF) grammar fragments that
  660. do  not  define new nonterminals.  The notation is similar to the (A)*
  661. and (A)+ closure blocks already present in PCCTS.  The meaning of  the
  662. long  form  syntactic  predicate  is:   "If  A is matched on the input
  663. stream, attempt to recognize B." Note the similarity to  the  semantic
  664. predicate:
  665.  
  666.  
  667.         <<A>>? B
  668.  
  669.  
  670. which means: "If A evaluates to true at parser  run-time,  attempt  to
  671. match B."
  672.  
  673.      Decisions, which are nondeterministic (non-LL(k) for  finite  k),
  674. are resolved via (..)? in the following manner:
  675.  
  676.  
  677.  
  678.  
  679.  
  680.  
  681.                                                                Page 11
  682.  
  683.                                                                  PCCTS
  684.  
  685.  
  686.  
  687. a   :   Y_1
  688.     |   Y_2
  689.    ...
  690.     |   ( A_i )? Y_i
  691.    ...
  692.     |   Y_j
  693.    ...
  694.     |   Y_n
  695.     ;
  696.  
  697.  
  698. where productions i and j are  mutually  nondistinguishable  from  the
  699. left-edge.   If  production  i  fails, production j will be attempted.
  700. Typically, the number of syntactic predicates employed is n-1 where  n
  701. is  the number of mutually nondeterministic productions in a decision;
  702. the last production is attempted by default.
  703.  
  704.      When a production to be predicted must be predicted  with  itself
  705. (nothing less sophisticated is sufficient) or when efficiency is not a
  706. major concern, the short form is used:
  707.  
  708.  
  709. a   :   Y_1
  710.     |   Y_2
  711.    ...
  712.     |   ( Y_i )?
  713.    ...
  714.     |   Y_j
  715.    ...
  716.     |   Y_n
  717.     ;
  718.  
  719.  
  720. 3.2.2.  Modified LL(k) Parsing Scheme
  721.  
  722.      Decisions that are not augmented with  syntactic  predicates  are
  723. parsed  deterministically  with  finite  lookahead up to depth k as is
  724. normal for PCCTS-generated  parsers.   When  at  least  one  syntactic
  725. predicate  is present in a decision, rule recognition proceeds as fol-
  726. lows:
  727.  
  728.  
  729. [1]  Find the first viable production; i.e. the  first  production  in
  730.      the  alternative  list predicted by the current finite lookahead,
  731.      according  to   the   associated   finite-lookahead   prediction-
  732.      expression.
  733.  
  734. [2]  If the first element in that production is not a syntactic predi-
  735.      cate, predict that production and go to [4] else attempt to match
  736.      its predicting grammar fragment.
  737.  
  738. [3]  If the grammar fragment is matched, predict the  associated  pro-
  739.      duction and go to [4] else find the next viable production and go
  740.  
  741.  
  742.  
  743.                                                                Page 12
  744.  
  745.                                                                  PCCTS
  746.  
  747.  
  748.      to [2].
  749.  
  750. [4]  Proceed with the normal recognition of the  production  predicted
  751.      in [2] or [3].
  752.  
  753.  
  754. For successful predicates, both the predicting  grammar  fragment  and
  755. the remainder of the production are actually matched, hence, the short
  756. form, (A)?, actually matches A twice - once to  predict  and  once  to
  757. apply A normally.
  758.  
  759. 3.2.3.  Syntactic Predicate Placement
  760.  
  761.      Syntactic predicates may only appear as the first  element  of  a
  762. production because that is the only place decisions are required.  For
  763. example, the (..)? block in the first production of following  grammar
  764. has little utility.
  765.  
  766.  
  767. a   :   Y_1  ( A )? B
  768.     |   Y_2
  769.    ... 
  770.     |   Y_n
  771.     ;
  772.  
  773.  
  774. There is no question that B is to be matched after \   and  trying  to
  775. predict this situation is redundant.                1
  776.  
  777.      Syntactic predicates may appear on the left edge of  any  produc-
  778. tion  within  any  subrule,  not just in productions at the rule block
  779. level.
  780.  
  781. 3.2.4.  Nested Syntactic Predicate Invocation
  782.  
  783.      Because syntactic predicates may reference any defined  nontermi-
  784. nal  and  because  of the recursive nature of grammars, it is possible
  785. for the parser to return to a point in the grammar which  had  already
  786. requested  backtracking.  This nested invocation poses no problem from
  787. a theoretical point of view, but can cause unexpected  parsing  delays
  788. in practice.
  789.  
  790. 3.2.5.  Grammar Fragments within Syntactic Predicates
  791.  
  792.      The grammar fragments within (A)? may be any valid PCCTS  produc-
  793. tion  right-hand-side;  i.e.  any  expression  except  new nonterminal
  794. definitions.  A may contain semantic actions and semantic  predicates,
  795. although  only the semantic predicates will be executed during predic-
  796. tion.
  797.  
  798. 3.2.6.  Efficiency
  799.  
  800.      In terms of efficiency, the order of alternative productions in a
  801. decision  is  significant.   Productions in a PCCTS grammar are always
  802.  
  803.  
  804.  
  805.                                                                Page 13
  806.  
  807.                                                                  PCCTS
  808.  
  809.  
  810. attempted in the order specified.  For example, the  parsing  strategy
  811. outline above indicates that the following rule is most efficient when
  812. \  is less complex than \ .
  813.  1                       2
  814.  
  815. a       : ( Y_1 )?
  816.         |   Y_2
  817.         ;
  818.  
  819.  
  820.      Any parsing decisions made inside a (..)? block are  made  deter-
  821. ministically unless they themselves are prefixed with syntactic predi-
  822. cates.  For example,
  823.  
  824.  
  825. a       :    ( (A)+ X | (B)+ X )?
  826.         |    (A)* Y
  827.         ;
  828.  
  829.  
  830. specifies that the parser should attempt to  match  the  nonpredicated
  831. subrule
  832.  
  833.  
  834.         (       (A)+ X
  835.         |       (B)+ X
  836.         )
  837.  
  838.  
  839. using normal the normal finite-lookahead parsing strategy.  If a  sen-
  840. tence  recognizable  by  this  grammar  fragment is found on the input
  841. stream, then restore the state of the parser to what it was before the
  842. predicate  invocation  and  parse the grammar fragment again; else, if
  843. the attempt failed, apply the next production in the outer block:
  844.  
  845.  
  846.         (A)* Y
  847.  
  848.  
  849. 3.2.7.  Resolving Ambiguous C++ Statements
  850.  
  851.      Quoting from Ellis and Stroustrup ["The Annotated  C++  Reference
  852. Manual,"  Margaret A. Ellis and Bjarne Stroustrup, Addison Wesley Pub-
  853. lishing Company; Reading, Massachusetts; 1990],
  854.  
  855.      "There is an ambiguity in the grammar involving  expression-
  856.      statements  and  declarations... The general cases cannot be
  857.      resolved without backtracking... In particular,  the  looka-
  858.      head needed to disambiguate this case is not limited."
  859.  
  860. The authors use the following examples to make their point:
  861.  
  862.  
  863.  
  864.  
  865.  
  866.  
  867.                                                                Page 14
  868.  
  869.                                                                  PCCTS
  870.  
  871.  
  872.  
  873. T(*a)->m=7;     // expression-statement
  874. T(*a)(int);     // declaration
  875.  
  876.  
  877. Clearly, the two types of statements are not distinguishable from  the
  878. left  as  an arbitrary amount of symbols may be seen before a decision
  879. can be made; here, the -> symbol is the  first  clue  that  the  first
  880. example is a statement.  Quoting Ellis and Stroustrup further,
  881.  
  882.      "In a parser with backtracking the disambiguating  rule  can
  883.      be stated very simply:
  884.      [1] If it looks like a declaration, it is; otherwise
  885.      [2] if it looks like an expression, it is; otherwise
  886.      [3] it is a syntax error."
  887.  
  888. The solution in PCCTS using syntactic predicates is simply:
  889.  
  890.  
  891. stat:   (declaration)?
  892.     |   expression
  893.     ;
  894.  
  895.  
  896. The semantics of rule stat are exactly that of  the  quoted  solution.
  897. The  production  declaration will, however, be recognized twice upon a
  898. valid declaration and once upon an expression to decide that it is not
  899. a declaration.
  900.  
  901. 3.2.8.  Revisiting the ML Example
  902.  
  903.      To illustrate the utility of the full form  of  syntactic  predi-
  904. cates,  reconsider the grammar for the ML-style statements provided in
  905. the example section above:
  906.  
  907.  
  908. stat:   list "=" list ";"
  909.         |       list ";"
  910.         ;
  911.  
  912.  
  913. Rule stat is not LL because list could be arbitrarily long and, hence,
  914. predicting  which  production to apply beforehand is impossible with a
  915. finite lookahead depth.  There are two solutions  in  using  syntactic
  916. predicates,  one  more efficient than the other.  The first method is,
  917. as before, to specify:
  918.  
  919.  
  920. stat:   (list "=" list ";")?
  921.         |       list ";"
  922.         ;
  923.  
  924.  
  925. However, this specification unnecessarily matches the  list  following
  926.  
  927.  
  928.  
  929.                                                                Page 15
  930.  
  931.                                                                  PCCTS
  932.  
  933.  
  934. the  assignment  operator  twice.   A more efficient, but functionally
  935. equivalent, specification is as follows:
  936.  
  937.  
  938. stat:   (list "=")? list "=" list ";"
  939.         |       list ";"
  940.         ;
  941.  
  942.  
  943. This description indicates that, as soon as the "=" has been seen, the
  944. first production is uniquely predicted.
  945.  
  946. 3.2.9.  Syntactic Predicates Effect on Grammar Analysis
  947.  
  948.      ANTLR still constructs normal LL(k) decisions  throughout  predi-
  949. cated parsers.  Only when necessary are arbitrary lookahead predictors
  950. used.  Constructing LL(k) parsers is an exponential problem that ANTLR
  951. goes  to  great lengths to avoid or reduce in size on average.  Unfor-
  952. tunately, for large grammars and k values of more than 2  or  3  ANTLR
  953. can  take an impractical amount of time.  Part of the benefit of (..)?
  954. blocks is that, by definition, they defy LL(k) analysis.   Hence,  the
  955. exponential, full LL(k) grammar analysis is turned off for any produc-
  956. tion beginning with a syntactic predicate.  In  its  place,  a  linear
  957. approximation to LL(k) analysis, called LL'(k), is used.  This reduces
  958. the  number  of  times  that  arbitrary  lookahead  (..)?  blocks  are
  959. attempted  unnecessarily, though no finite lookahead decision is actu-
  960. ally required as the arbitrary  lookahead  mechanism  will  accurately
  961. predict the production.
  962.  
  963.      If the current finite lookahead can predict which  production  to
  964. apply, syntactic predicates are not evaluated.  For example, referring
  965. to the C++ declaration versus expression grammar example above, if the
  966. current  input  token were 42, rule stat would immediately attempt the
  967. second production - expression.  On the other  hand,  if  the  current
  968. input  token  were  ID,  then  the declaration rule would be attempted
  969. before attempting expression.   If  neither  productions  successfully
  970. match the input, a syntax occurs.
  971.  
  972.      When constructing finite lookahead  sets,  the  grammar  fragment
  973. within  the (..)? block is ignored.  In other words, FIRST ((A)? B) is
  974. FIRST (B).                                                k
  975.      k
  976. 3.2.10.  The Effect of Nondeterminism upon  Translation  and  Semantic
  977. Predicates
  978.  
  979.      Syntactic predicates are, by definition, not guaranteed to  match
  980. the current input.  Therefore, actions with side-effects, for which no
  981. "undo" exists, cannot be executed  during  nondeterministic  syntactic
  982. prediction  ("guess"  mode).  This section describes how ANTLR handles
  983. the execution of user-supplied actions and semantic predicates.
  984.  
  985. 3.2.10.1.  The Effect upon User Actions
  986.  
  987.      PCCTS language specifications do not allow the execution  of  any
  988.  
  989.  
  990.  
  991.                                                                Page 16
  992.  
  993.                                                                  PCCTS
  994.  
  995.  
  996. semantic  action  during  a  syntactic prediction as no undo mechanism
  997. exists; this conservative scheme avoids affecting the parser state  in
  998. an  irreversible manner.  The only exception to this rule is that ini-
  999. tialization actions, which usually define  variables  visible  to  the
  1000. entire rule/function, are not enclosed in if {..} statements to "gate"
  1001. them out; hence, initialization actions  with  side  effects  must  be
  1002. avoided by the PCCTS user.
  1003.  
  1004. 3.2.10.2.  The Effect upon Semantic Predicates
  1005.  
  1006.      Semantic predicates are always evaluated because  they  are  res-
  1007. tricted  to  side-effect-free expressions.  During arbitrary lookahead
  1008. prediction, the semantic predicates that are evaluated must  be  func-
  1009. tions of values computed when actions were turned on.  For example, if
  1010. your grammar has a predicate that examines the symbol table, all  sym-
  1011. bols needed to direct the parse during prediction must be entered into
  1012. the table before prediction has begun.  Consider the following grammar
  1013. fragment which recognizes simplified C declarations.
  1014.  
  1015.  
  1016. decl: "typedef" type declarator ";"                     /* define new type */
  1017.     | (type declarator "\{")? type declarator func_body /* define function */
  1018.     | type declarators ";"                              /* def/decl var(s) */
  1019.     ;
  1020.  
  1021. type:   built_in_type
  1022.     |   <<is_type(LATEXT(1))>>? ID
  1023.     ;
  1024.  
  1025. declarator
  1026.     :       ...
  1027.         /* recognizes a declarator such as "array[3]" */
  1028.         /* add symbols, both types and vars, to the symbol table */
  1029.     ;
  1030.  
  1031.  
  1032. This rule  is  unnecessarily  inefficient,  but  will  illustrate  the
  1033. evaluation  of semantic predicates during nondeterministic prediction.
  1034. For the purposes of our discussion, we restrict new types to be intro-
  1035. duced  using  a typedef (structures and unions are not allowed).  Con-
  1036. sider the recognition of the two sentences:
  1037.  
  1038.  
  1039.         typedef int My_int;
  1040.         My_int i;
  1041.  
  1042.  
  1043. The first production of rule  decl  will  match  the  first  sentence,
  1044. adding  My_int  to the symbol table as a type name.  Production two of
  1045. decl attempts to match the second sentence with its  syntactic  predi-
  1046. cate.  Rule type is entered, which evaluates is_type(LATEXT(1)) (where
  1047. is_type() is some user-defined function that looks up its symbol argu-
  1048. ment  in  the  symbol table and returns true if that symbol is defined
  1049. and is a type).  Because the text of the current token  of  lookahead,
  1050.  
  1051.  
  1052.  
  1053.                                                                Page 17
  1054.  
  1055.                                                                  PCCTS
  1056.  
  1057.  
  1058. My_int,  is a valid type, the predicate evaluates to true.  Production
  1059. two of type is applicable semantically  and  is,  therefore,  applied.
  1060. After  consuming My_int, the parser successfully applies declarator to
  1061. i.  The next input token is ; which does not match  .   The  nondeter-
  1062. ministic prediction fails and production three is predicted by default
  1063. and is applied.
  1064.  
  1065.      The second production of rule decl could not be rewritten as
  1066.  
  1067.  
  1068.         ( type declarator func_body )?      /* define function */
  1069.  
  1070.  
  1071. because, presumably, a func_body could define new types.  The  actions
  1072. that  add  these  new types to the symbol table would not be executed,
  1073. however, as the parser would be in  nondeterministic  mode.   Although
  1074. the semantic predicates would be evaluated correctly, the symbol table
  1075. would not hold the information necessary to parse  the  function  body
  1076. during nondeterministic prediction.  Also, this revision is very inef-
  1077. ficient as it would match the entire function, which could  be  large,
  1078. twice.
  1079.  
  1080. 3.2.11.  Comparing the Use of Semantic and Syntactic Predicates
  1081.  
  1082.      Language constructs exists that are totally  ambiguous  syntacti-
  1083. cally,  but  easily  distinguishable semantically.  For example, array
  1084. references and function calls in Fortran are identical  syntactically,
  1085. but  very different semantically.  The associated grammatical descrip-
  1086. tion is non-LL(k), non-LALR(k), and non-context-free; not  even  back-
  1087. tracking or infinite lookahead will help this problem.
  1088.  
  1089.  
  1090. expratom:   ID "\(" expr_list "\)"
  1091.         |   ID "\(" expr_list "\)"
  1092.        ...
  1093.         ;
  1094.  
  1095.  
  1096. where expr_list is some rule  matching  a  comma-separated  expression
  1097. list.   Putting (..)? around the first alternative production will not
  1098. change the fact that both productions match the same  sentence.   How-
  1099. ever, semantic predicates may be used to semantically disambiguate the
  1100. rule:
  1101.  
  1102.  
  1103. expratom:   <<isVar(LATEXT(1))>>?    ID "\(" expr_list "\)"
  1104.         |   <<isFunc(LATEXT(1))>>?   ID "\(" expr_list "\)"
  1105.        ...
  1106.         ;
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.                                                                Page 18
  1116.  
  1117.                                                                  PCCTS
  1118.  
  1119.  
  1120. 3.2.12.  Implementation
  1121.  
  1122.      The discussion thus far has described the functionality  of  syn-
  1123. tactic  predicates,  but  their implementation is an equally important
  1124. topic so that users can understand the  new  ANTLR  parsing  mechanism
  1125. (e.g.,  so  that  users  can follow along in a debugger while tracking
  1126. down bugs in their grammar).
  1127.  
  1128.      Because productions are assumed to  be  attempted  in  the  order
  1129. specified,  a  nested  if-then-else structure is generated.  To illus-
  1130. trate the integration of syntactic predicates into  the  normal  ANTLR
  1131. code generation scheme, consider the following abstract grammar.
  1132.  
  1133.  
  1134. a   :    Y_1
  1135.    ...
  1136.     |    ( A_i )? Y_i
  1137.    ...
  1138.     |    ( A_j )? Y_j
  1139.    ...
  1140.     |    Y_m
  1141.     ;
  1142.  
  1143.  
  1144. ANTLR generates the following, "slightly sanitized", code:
  1145.  
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155.  
  1156.  
  1157.  
  1158.  
  1159.  
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.                                                                Page 19
  1178.  
  1179.                                                                  PCCTS
  1180.  
  1181.  
  1182.  
  1183. a()
  1184. {
  1185.     zzGUESS_BLOCK
  1186.     if ( (T_1 , ..., T_k ) member LOOK_k (Y_1 ) ) {
  1187.         match Y_1 ;
  1188.     }
  1189.     else {
  1190.         zzGUESS
  1191.         if ( !zzrv && (T_1 , ..., T_k ) member LOOK_k (Y_i ) ) {
  1192.             match A_i ;
  1193.             zzGUESS_DONE
  1194.             match Y_i ;
  1195.         }
  1196.         else {
  1197.             if ( zzguessing ) zzGUESS_DONE;
  1198.             zzGUESS
  1199.             if ( !zzrv && (T_1 , ..., T_k ) member LOOK_k (Y_j ) ) {
  1200.                 match A_j ;
  1201.                 zzGUESS_DONE
  1202.                 match Y_j ;
  1203.             }
  1204.             else {
  1205.                 if ( zzguessing ) zzGUESS_DONE;
  1206.                 if ( (T_1 , ..., T_k ) member LOOK_k (Y_m ) ) {
  1207.                     match Y_m ;
  1208.                 }
  1209.                 else goto fail;
  1210.             }
  1211.         }
  1212.     }
  1213.     return;
  1214. fail:
  1215.     if ( zzguessing ) {zzGUESS_FAIL;}
  1216.     gen syntax error message;
  1217.     resynch parser;
  1218. }
  1219.  
  1220.  
  1221. where LOOK_k(Y_i) is the set of lookahead k-tuples that predict   Y_i.
  1222. This notation  is  used as a convenience here whereas  ANTLR generates
  1223. decisions that use as little lookahead as possible in practice.
  1224.  
  1225.      The macros/variables themselves are defined as follows:
  1226.  
  1227. zzGUESS_BLOCK
  1228.      Define a block of memory to hold the current parser state and the
  1229.      return value of setjmp(), zzrv.
  1230.  
  1231. zzGUESS
  1232.      Save the current parser state, turn on  guessing  mode  and  call
  1233.      setjmp()  to  record  the  current  C  run-time stack state.  The
  1234.      result of setjmp() is placed into zzrv.
  1235.  
  1236.  
  1237.  
  1238.  
  1239.                                                                Page 20
  1240.  
  1241.                                                                  PCCTS
  1242.  
  1243.  
  1244. zzGUESS_FAIL
  1245.      Long jump - restore the C run-time stack to  the  state  it  held
  1246.      before guessing began.
  1247.  
  1248. zzGUESS_DONE
  1249.      Restore the parser state to the previously saved contents.
  1250.  
  1251. zzguessing
  1252.      This variable is 1 if a prediction is currently  underway  and  0
  1253.      when  normal  parsing is proceeding.  User actions are turned off
  1254.      when this variable is 1.
  1255.  
  1256. zzrv
  1257.      This variable is the result of doing  the  setjmp()  call,  which
  1258.      returns  0 always.  When a longjmp() occurs, the C run-time stack
  1259.      will be reset to the state held at the time of the  setjmp()  and
  1260.      zzrv  will  be set to a nonzero value.  In the view of the C pro-
  1261.      gram, it will appear as if the setjmp() has returned without ever
  1262.      having  attempted the code in the if following it; execution con-
  1263.      tinues past the if the second time.
  1264.  
  1265. All semantic actions except initialization actions are enclosed in
  1266.  
  1267.  
  1268.         zzNON_GUESS_MODE {
  1269.                 user-defined-semantic-action;
  1270.         }
  1271.  
  1272.  
  1273. so  that   they   can   be   "turned   off"   during   a   prediction.
  1274. zzNON_GUESS_MODE is defined as follows:
  1275.  
  1276.  
  1277.         if ( !zzguessing )
  1278.  
  1279.  
  1280. The effect of this type of code generation is that a stack  of  parser
  1281. states is maintained such that nested nondeterministic predictions can
  1282. be made.
  1283.  
  1284.      As an optimization, when the prediction grammar  fragment  for  a
  1285. production is regular, simpler recognition schemes could be used.
  1286.  
  1287. 4.  DLG Enhancements
  1288.  
  1289.      There have been a number of changes to dlg  from  1.06  to  1.10.
  1290. The  main difference is that DLG execution speed is up to 7 times fas-
  1291. ter than the 1.06 version.  A -Wambiguity option  has  been  added  to
  1292. indicate  where  ambiguities in DLG specifications exists.  It numbers
  1293. the expressions and prints  out  for  an  accept  state  the  possible
  1294. expressions  that  could be recognized.  Also, a macro called ANTLRs()
  1295. has been added that behaves just like ANTLR() except that  it  accepts
  1296. input from a string rather than a stream:
  1297.  
  1298.  
  1299.  
  1300.  
  1301.                                                                Page 21
  1302.  
  1303.                                                                  PCCTS
  1304.  
  1305.  
  1306.  
  1307.         #define ANTLRs(rule, string)    {...}
  1308.  
  1309.  
  1310. 5.  Linear-Approximation Lookahead
  1311.  
  1312.      ANTLR-generated parsers predict which rule alternative  to  match
  1313. by  examining  up to k symbols of lookahead.  Unfortunately, computing
  1314. (during ANTLR grammar analysis) and examining  (during  parser  execu-
  1315. tion)  the set of possible k-sequences is an exponentially large prob-
  1316. lem.  A linear  approximation  to  this  full  lookahead  exists  that
  1317. requires  linear time to compute and to test; further, this approxima-
  1318. tion handles the majority of parsing lookahead  decisions.   To  avoid
  1319. the,  possibly  exponential,  computation  of  full  lookahead,  ANTLR
  1320. attempts to use the linear approximation first - computing full looka-
  1321. head  as  a last resort.  The reason that ANTLR occasionally goes "off
  1322. the deep end" when analyzing some big grammars is that ANTLR  found  a
  1323. parsing  decision that could not be solved with the approximate looka-
  1324. head and required exponential time to compute the full lookahead.
  1325.  
  1326.      Because the approximation has linear time and  space  complexity,
  1327. its  lookahead  depth  can be much deeper than that of the full looka-
  1328. head.  Consequently, the approximate lookahead is  sometimes  stronger
  1329. than the full lookahead because it can look farther ahead without con-
  1330. suming an impractical amount of system resources.  We  have  added  an
  1331. ANTLR  option,  called -ck n, that allows the user to specify how deep
  1332. the linear approximation analysis should go before giving up and  try-
  1333. ing  the  full  lookahead  computation.   This  new  feature  is  best
  1334. described with an example:
  1335.  
  1336. a       :       (A B|C D) E
  1337.         |       A D F
  1338.         ;
  1339.  
  1340. The full LL(2) lookahead (as would be computed by "antlr -k 2 ...") is
  1341. summarized in the following table
  1342.  
  1343.                                 LL(2)
  1344.                        ________________________ 
  1345.                       |Lookahead | Alternative |
  1346.                       |__________|_____________|
  1347.                       |   A B    |      1      |
  1348.                       |   C D    |      1      |
  1349.                       |   A D    |      2      |
  1350.                       |__________|_____________|
  1351.  
  1352. whereas the linear approximate lookahead, denoted LL'(2) (as would  be
  1353. computed by "antlr -ck 2 ..."), is
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360.  
  1361.  
  1362.  
  1363.                                                                Page 22
  1364.  
  1365.                                                                  PCCTS
  1366.  
  1367.  
  1368.                                LL'(2)
  1369.                       __________________________ 
  1370.                      | Lookahead  | Alternative |
  1371.                      |____________|_____________|
  1372.                      |{A,C} {B,D} |      1      |
  1373.                      | {A}   {D}  |      2      |
  1374.                      |____________|_____________|
  1375.  
  1376.  
  1377. where lookahead {A,C} {B,D} implies that the first symbol of lookahead
  1378. can  be either A or C and the second can be either B or D; this looka-
  1379. head therefore matches the set of sequences {A B, A  D,  C  B,  C  D},
  1380. which is like the cross product of the sets (note the loss of sequence
  1381. information, which results in the  approximation).   The  decision  is
  1382. LL(2), but is not LL'(2) because the sequence A D predicts both alter-
  1383. natives (i.e., A can be seen first by both and D can be seen  second).
  1384. However,  if ANTLR were allowed to look 3 symbols ahead - LL'(3) - the
  1385. linear approximation would be sufficient and the complex  LL(3)  would
  1386. not be computed.  The LL'(3) information ("antlr -ck 3") is summarized
  1387. in the following table:
  1388.  
  1389.  
  1390.                                  LL'(3)
  1391.                     ______________________________ 
  1392.                    |   Lookahead    | Alternative |
  1393.                    |________________|_____________|
  1394.                    |{A,C} {B,D} {E} |      1      |
  1395.                    | {A}   {D}  {F} |      2      |
  1396.                    |________________|_____________|
  1397.  
  1398.  
  1399. Notice that, now, the third symbol of  lookahead  alone  can  uniquely
  1400. identify which alternative to predict.
  1401.  
  1402.      Let's augment our example to have  one  LL(2)  decision  and  one
  1403. LL'(3) decision:
  1404.  
  1405.  
  1406. a   :   (A B | C D) E   /* LL'(3) */
  1407.     |   A D F b
  1408.     ;
  1409. b   :   (A B | C D) Z   /* LL(2) */
  1410.     |   A D Z
  1411.     ;
  1412.  
  1413.  
  1414. Although LL(3) ("antlr -k 3 ...") handles both the  LL'(3)  and  LL(2)
  1415. decisions,  we  can make ANTLR and the resulting parser more efficient
  1416. by specifying "antlr -ck 3 -k 2 ...".  The resulting parser  decisions
  1417. are illustrated in the following (sanitized) code fragment:
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.                                                                Page 23
  1426.  
  1427.                                                                  PCCTS
  1428.  
  1429.  
  1430.  
  1431. a()
  1432. {
  1433.     /* there are no sequence comparisons for rule 'a' because LL'(3)
  1434.      * is sufficient and full LL(3) analysis is not invoked
  1435.      */
  1436.     if ( LA(1)member{A,C} && LA(2)member{B,D} && LA(3)==E ) {
  1437.         if ( (LA(1)==A) ) {
  1438.             zzmatch(A); zzCONSUME;
  1439.             zzmatch(B); zzCONSUME;
  1440.         }
  1441.         else if ( (LA(1)==C) ) {
  1442.             zzmatch(C); zzCONSUME;
  1443.             zzmatch(D); zzCONSUME;
  1444.         }
  1445.         zzmatch(E); zzCONSUME;
  1446.     }
  1447.     else if ( (LA(1)==A) && (LA(2)==D) && (LA(3)==F) ) {
  1448.         zzmatch(A); zzCONSUME;
  1449.         zzmatch(D); zzCONSUME;
  1450.         zzmatch(F); zzCONSUME;
  1451.         b();
  1452.     }
  1453. }
  1454.  
  1455.  
  1456.  
  1457. b()
  1458. {
  1459.         /* LL(2) decision */
  1460.     if ( (LA(1)==A && LA(2)==B) || (LA(1)==C && LA(2)==D) ) {
  1461.         if ( (LA(1)==A) ) {
  1462.             zzmatch(A); zzCONSUME;
  1463.             zzmatch(B); zzCONSUME;
  1464.         }
  1465.         else if ( (LA(1)==C) ) {
  1466.             zzmatch(C); zzCONSUME;
  1467.             zzmatch(D); zzCONSUME;
  1468.         }
  1469.     }
  1470.     else if ( LA(1)==A && LA(2)==D ) {
  1471.         zzmatch(A); zzCONSUME;
  1472.         zzmatch(D); zzCONSUME;
  1473.         zzmatch(Z); zzCONSUME;
  1474.     }
  1475. }
  1476.  
  1477.  
  1478.      These  examples  are  small  and,  hence,  the  savings  are  not
  1479. apparent,  but the "compressed" approximation to full lookahead can be
  1480. used  to  reduce  the  ANTLR  execution  time  and  resulting   parser
  1481. speed/size.
  1482.  
  1483.  
  1484.  
  1485.  
  1486.  
  1487.                                                                Page 24
  1488.  
  1489.                                                                  PCCTS
  1490.  
  1491.  
  1492. 6.  Faster Compilation of ANTLR-Generated Parsers
  1493.  
  1494.      Previous versions of ANTLR used macros rather than function calls
  1495. for  many  operations during parsing.  Because the macros were invoked
  1496. numerous times, compilation of these  files  was  slow  and  generated
  1497. large  object  files.   The  operations  are now, by default, function
  1498. calls which makes compilation about 2 times as  fast  and  results  in
  1499. object files about half as large.  The macros can be used if necessary
  1500. by defining ZZUSE_MACROS on the compile line (-DZZUSE_MACROS).
  1501.  
  1502. 7.  Linking Together Multiple ANTLR Parsers
  1503.  
  1504.      Because of the lack of sophisticated "information hiding"  in  C,
  1505. many  ANTLR  program  symbols are globally visible and, hence, linking
  1506. multiple ANTLR-generated parsers together would cause many name colli-
  1507. sions.  To overcome this, we have introduced a new ANTLR directive:
  1508.  
  1509.  
  1510.         #parser "my_parser_name"
  1511.  
  1512.  
  1513. which prefixes all global,  externally  visible  symbols  with  prefix
  1514. my_parser_name_  (remember  this when debugging ANTLR parsers).  This,
  1515. clearly, renders the previous "generate prefix" option (-gp) obsolete.
  1516. Variables, functions and rule names are remapped through the inclusion
  1517. of a file called remap.h, which is automatically  generated  by  ANTLR
  1518. when it encounters a #parser directive.  In the future, we expect this
  1519. to be the name of a C++ object of some  class  Parser;  variables  and
  1520. functions will be referenced as my_parser_name.var_or_func.
  1521.  
  1522.      Consider the following ANTLR example.  Files  t.g  and  t2.g  are
  1523. identical except for the parser name.
  1524.  
  1525. File t.g
  1526.  
  1527.  
  1528.   #header <<#include "charbuf.h">>
  1529.  
  1530.   #parser "t"
  1531.  
  1532.   <<
  1533.   void parse_t()
  1534.   {
  1535.       ANTLR(a(), stdin);
  1536.   }
  1537.   >>
  1538.  
  1539.   #token "[\ \t\n]"       <<zzskip();>>
  1540.  
  1541.   a : INT INT
  1542.     ;
  1543.  
  1544.   #token INT "[0-9]+"
  1545.  
  1546.  
  1547.  
  1548.  
  1549.                                                                Page 25
  1550.  
  1551.                                                                  PCCTS
  1552.  
  1553.  
  1554. File t2.g
  1555.  
  1556.  
  1557.   #header <<#include "charbuf.h">>
  1558.  
  1559.   #parser "t2"
  1560.  
  1561.   <<
  1562.   void parse_t2()
  1563.   {
  1564.       ANTLR(a(), stdin);
  1565.   }
  1566.   >>
  1567.  
  1568.   #token "[\ \t\n]"       <<zzskip();>>
  1569.  
  1570.   a : INT INT
  1571.     ;
  1572.  
  1573.   #token INT "[0-9]+"
  1574.  
  1575.  
  1576. File main.c
  1577.  
  1578.  
  1579.   #include <stdio.h>
  1580.  
  1581.   extern void parse_ter();
  1582.   extern void parse_ter2();
  1583.  
  1584.   main()
  1585.   {
  1586.       parse_ter();
  1587.       parse_ter2();
  1588.   }
  1589.  
  1590.  
  1591. File makefile
  1592.  
  1593.  
  1594.  
  1595.  
  1596.  
  1597.  
  1598.  
  1599.  
  1600.  
  1601.  
  1602.  
  1603.  
  1604.  
  1605.  
  1606.  
  1607.  
  1608.  
  1609.  
  1610.  
  1611.                                                                Page 26
  1612.  
  1613.                                                                  PCCTS
  1614.  
  1615.  
  1616.  
  1617.   DLG_FILE = parser.dlg
  1618.   ERR_FILE = err.c
  1619.   HDR_FILE = stdpccts.h
  1620.   TOK_FILE = tokens.h
  1621.   K = 1
  1622.   ANTLR_H = ../h
  1623.   BIN = ../bin
  1624.   ANTLR = ../bin/antlr
  1625.   DLG = $(BIN)/dlg
  1626.   CFLAGS = -I. -I$(ANTLR_H) -g
  1627.   AFLAGS = -fe err.c -fl parser.dlg -ft tokens.h -fr remap.h -fm mode.h  \
  1628.            -gt -gk
  1629.   AFLAGS2= -fe t2_err.c -fl t2_parser.dlg -ft t2_tokens.h -fr t2_remap.h \
  1630.            -fm t2_mode.h -gt -gk
  1631.   DFLAGS = -C2 -i
  1632.   GRM = t.g
  1633.   SRC1 = scan.c t.c err.c
  1634.   SRC2 = t2.c t2_scan.c t2_err.c main.c
  1635.   OBJ1 = scan.o t.o err.o
  1636.   OBJ2 = t2.o t2_scan.o t2_err.o main.o
  1637.   CC=g++
  1638.  
  1639.   t: $(OBJ1) $(OBJ2)
  1640.       $(CC) -o t $(CFLAGS) $(OBJ1) $(OBJ2)
  1641.  
  1642.   t.o : mode.h tokens.h t.g
  1643.  
  1644.   scan.c mode.h : parser.dlg
  1645.       $(DLG) $(DFLAGS) parser.dlg scan.c
  1646.  
  1647.   t.c parser.dlg tokens.h : t.g
  1648.       $(ANTLR) $(AFLAGS) t.g
  1649.  
  1650.   t2.o : t2_mode.h t2_tokens.h t2.g
  1651.  
  1652.   t2_scan.c t2_mode.h : t2_parser.dlg
  1653.       $(DLG) $(DFLAGS) -m t2_mode.h t2_parser.dlg t2_scan.c
  1654.  
  1655.   t2.c t2_parser.dlg t2_tokens.h : t2.g
  1656.       $(ANTLR) $(AFLAGS2) t2.g
  1657.  
  1658.  
  1659. The input to the parser is 4 integers  because  each  of  the  invoked
  1660. parsers matches 2.
  1661.  
  1662.      The preprocessor symbol zzparser is set the  parser  name  string
  1663. specified in the #parser "name" directive.
  1664.  
  1665.      WARNING: the remapping of symbols to avoid collisions  is  not  a
  1666. foolproof  system.   For  example, if you have a rule named type and a
  1667. field in a structure named type, the field name will  get  renamed  as
  1668. well -  this  is  the  price  you  pay  for  being able to link things
  1669. together without C++.
  1670.  
  1671.  
  1672.  
  1673.                                                                Page 27
  1674.  
  1675.                                                                  PCCTS
  1676.  
  1677.  
  1678. 8.  Creating Customized Syntax Error Routines
  1679.  
  1680.      Many users have asked how to create their own zzsyn() error  han-
  1681. dling routine.  Here's how:
  1682.  
  1683. [1]  Make new zzsyn() with same parameters.
  1684.  
  1685. [2]  Define the preprocessor symbol USER_ZZSYN on the compile line  (-
  1686.      DUSER_ZZSYN).
  1687.  
  1688. 9.  Lexical Changes to ANTLR Input
  1689.  
  1690.      The manner in which ANTLR interprets user  actions  has  changed.
  1691. Strings,  character  literals,  and  C/C++  comments  are  now totally
  1692. ignored.  For example,
  1693.  
  1694.  
  1695. <<
  1696.         // nothing in here is examined $1 ' "
  1697.         /* or in here ' " $ #[jfd] '"''''" */
  1698.         '"' // that's a character
  1699.         "'" // that's an apostrophe
  1700.         "$1 is", $1 /* $1 inside string is ignored */
  1701. >>
  1702.  
  1703.  
  1704. As a result of this change, you may experience a slight difference  in
  1705. how  ANTLR  treats  your  actions.   Comments inside actions are still
  1706. passed through to the parser.
  1707.  
  1708.      C++ comments are now accepted outside of actions as well:
  1709.  
  1710.  
  1711.         // this rule does nothing
  1712.         a : ;
  1713.  
  1714.  
  1715. Watch out for this:
  1716.  
  1717.  
  1718.           ...
  1719.           << // a comment >>
  1720.           ...
  1721.         a : A
  1722.           ;
  1723.  
  1724.  
  1725. The C++ style comment in side the action will scarf til  end  of  line
  1726. and  ignore  the >> end action symbol.  This could be avoided, but I'm
  1727. feeling lazy just now.
  1728.  
  1729. 10.  New ANTLR Options
  1730.  
  1731.      Release 1.10 introduces the following ANTLR command-line options:
  1732.  
  1733.  
  1734.  
  1735.                                                                Page 28
  1736.  
  1737.                                                                  PCCTS
  1738.  
  1739.  
  1740. -    ANTLR now accepts input from stdin by using the - option; e.g.,
  1741.  
  1742.  
  1743.      antlr -
  1744.  
  1745.  
  1746.      A file called stdin.c is created as the output parser.
  1747.  
  1748. -ck nUse up to n symbols of lookahead when  using  compressed  (linear
  1749.      approximation)  lookahead.   This type of lookahead is very cheap
  1750.      to compute and is attempted before full LL(k) lookahead, which is
  1751.      of  exponential  complexity  in  the worst case.  In general, the
  1752.      compressed lookahead can be much deeper (e.g, -ck  10)  than  the
  1753.      full lookahead (which usually must be less than 4).
  1754.  
  1755. -fm mode_file
  1756.      Rename file with lexical mode definitions, mode.h, to file.
  1757.  
  1758. -fr file
  1759.      Rename file which remaps globally visible  symbols,  remap.h,  to
  1760.      file.  This file is only created if a #parser directive is found.
  1761.  
  1762. -prc on
  1763.      Turn on the computation and hoisting of predicate context.
  1764.  
  1765. -prc off
  1766.      Turn off the computation and hoisting of predicate context.  This
  1767.      option makes 1.10 behave like the 1.06 release with option -pr on
  1768.      (default).
  1769.  
  1770. -w1  Set low warning level.  Do not warn if semantic predicates and/or
  1771.      (...)? blocks are assumed to cover ambiguous alternatives.
  1772.  
  1773. -w2  Ambiguous parsing  decisions  yield  warnings  even  if  semantic
  1774.      predicates  or  (...)? blocks are used.  Warn if -prc on and some
  1775.      lookahead sequences are not disambiguated with a  hoisted  predi-
  1776.      cate.
  1777.  
  1778. 11.  ANTLR Generates "Androgynous" Code
  1779.  
  1780.      The distribution source of 1.06 PCCTS was generated using 1.06 on
  1781. a  32-bit  machine.  Unfortunately, the source code dumped bit sets to
  1782. arrays of unsigned's according to the word size of  the  machine  that
  1783. generated the parser - regardless of the word size of the various tar-
  1784. get machines.  To overcome this, ANTLR always dumps its  bit  sets  as
  1785. arrays  of  unsigned  char,  which are 8 bits (or more) on any machine
  1786. that we'd ever want to work on.  As  a  result,  ANTLR  itself  should
  1787. bootstrap  on  any machine with a C compiler a enough memory.  We have
  1788. gotten it to compile with 16-bit Microsoft and Borland  C  on  the  PC
  1789. with  only  a few whimpers.  The makefiles in the ANTLR and DLG direc-
  1790. tories have sections for each of the various compilers.
  1791.  
  1792.  
  1793.  
  1794.  
  1795.  
  1796.  
  1797.                                                                Page 29
  1798.  
  1799.                                                                  PCCTS
  1800.  
  1801.  
  1802. 12.  Printing out grammars
  1803.  
  1804.      Using the -p option generates grammar listings that are  somewhat
  1805. nicer.
  1806.  
  1807. 13.  C Grammar Changes
  1808.  
  1809.      The C grammar example has been augmented with a -both option that
  1810. prints out both K&R and ANSI C prototypes for functions defined in the
  1811. input file.  E.g.
  1812.  
  1813.  
  1814.         % proto -both
  1815.         void f(a,b)
  1816.         int a;
  1817.         char *b;
  1818.         {;}
  1819.         ^D
  1820.          void
  1821.         #ifdef __STDC__
  1822.         f( int a, char *b )
  1823.         #else
  1824.         f( a, b )
  1825.          int a;
  1826.          char *b;
  1827.         #endif
  1828.  
  1829.  
  1830. Functions that already employ ANSI C style  argument  definitions  are
  1831. handled as well.
  1832.  
  1833. 14.  C++ Now Compiles ANTLR Itself
  1834.  
  1835.      We have modified the source code of ANTLR to compile  under  C++.
  1836. It is not written to take advantage of C++'s extensions to C, however,
  1837. except in rare instances.  C++'s stricter type checking motivated  the
  1838. modification.
  1839.  
  1840. 15.  New Preprocessor Symbol
  1841.  
  1842.      ANTLR now generates a #define called ANTLR_VERSION that is set to
  1843. the version of ANTLR that generated the parser.  For this release, you
  1844. will see:
  1845.  
  1846.  
  1847.         #define ANTLR_VERSION 110
  1848.  
  1849.  
  1850. in the output files, which is an integer  equivalent  of  the  version
  1851. number.
  1852.  
  1853. 16.  Attribute Warning
  1854.  
  1855.      A number of users have had trouble with the charptr.h attributes.
  1856.  
  1857.  
  1858.  
  1859.                                                                Page 30
  1860.  
  1861.                                                                  PCCTS
  1862.  
  1863.  
  1864. Please  note that they do not make copies and that the memory is freed
  1865. after the scope exits.  For example, this is wrong because the  memory
  1866. for  the  $1 attribute of A or B in the (...) scope will be freed upon
  1867. exit even though $0 will still point to it.
  1868.  
  1869.  
  1870. #header<<#include "charptr.h">>
  1871.  
  1872. <<
  1873. #include "charptr.c"
  1874. main() { ANTLR(a(),stdin); }
  1875. >>
  1876.  
  1877. #token "[\ \t\n]"       << zzskip(); >>
  1878.  
  1879. a: "ick" ("A" << $0=$1; >>| "B" << $0=$1; >>) "ugh"
  1880.    << printf("$1, $2, $3 are %s, %s, %s\n",$1, $2, $3); >>
  1881.  ;
  1882.  
  1883.  
  1884. One should make a copy of the local attribute (or  use  charbuf.h)  as
  1885. the mem is freed at the end of the scope ($0=strdup($1);).
  1886.  
  1887. 17.  Generation of Line Information
  1888.  
  1889.      The normal form of line information is:
  1890.  
  1891.  
  1892.         # line_number "file"
  1893.  
  1894.  
  1895. However, many compilers, such as Borland C, prefer it as
  1896.  
  1897.  
  1898.         #line line_number "file"
  1899.  
  1900.  
  1901. This can be easily changed by looking  file  generic.h  in  the  antlr
  1902. directory for the following:
  1903.  
  1904.  
  1905. /* User may redefine how line information looks */
  1906. #define LineInfoFormatStr "# %d \"%s\"\n"
  1907.  
  1908.  
  1909. Simply change it as your compiler wants it  and  recompile  the  antlr
  1910. source.
  1911.  
  1912. 18.  Incompatibilities
  1913.  
  1914.      There should be very few incompatibilities with  your  1.06-based
  1915. grammars.  Should you find any please let us know.
  1916.  
  1917.      1.06 semantic predicates were not hoisted into parsing  decisions
  1918.  
  1919.  
  1920.  
  1921.                                                                Page 31
  1922.  
  1923.                                                                  PCCTS
  1924.  
  1925.  
  1926. without  the -pr flag (now obsolete).  In 1.10, the use of a predicate
  1927. indicates that it may be hoisted.
  1928.  
  1929.      Semantic predicates used to halt parser upon failure whereas 1.10
  1930. does not.
  1931.  
  1932.      The interpretation of strings, character literals,  and  comments
  1933. are now handled differently; see above.
  1934.  
  1935. 19.  Future Directions
  1936.  
  1937.      This section briefly describes some of  the  future  enhancements
  1938. either being discussed, planned, or developed.
  1939.  
  1940. o    A graphical user interface is planned  for  ANTLR  grammars  that
  1941.      will  allow the simultaneous display/manipulation of BNF and syn-
  1942.      tax diagram representations of user grammars.
  1943.  
  1944. o    A source-to-source translator-generator  called  SORCERER  is  in
  1945.      prototype form.  It's input looks like ANTLR and is integrated so
  1946.      that one description will contain lexical, syntactic,  and  tree-
  1947.      translation information.
  1948.  
  1949. o    A number of groups are working on  a  C++  grammar.   Things  are
  1950.      starting  to heat up as it is pretty much certain that 1.10 ANTLR
  1951.      is the minimum necessary system to parse C++.
  1952.  
  1953. o    A code-generator generator, called PIGG, is in prototype form.
  1954.  
  1955. o    An assembler generator is in prototype form.
  1956.  
  1957. o    DLG backtracking will be added.
  1958.  
  1959. o    A new "magic" token type, ".", will  be  introduced  which  means
  1960.      "match any single token."
  1961.  
  1962. o    A new operator will be introduced, "~",  which  will  allow  con-
  1963.      structs  like  ~(A|B|C) - implying "match a single token not from
  1964.      the set {A, B, C}."
  1965.  
  1966. o    A new ANTLR directive will be introduced:
  1967.  
  1968.  
  1969.      #tokclass name { token_list }
  1970.  
  1971.  
  1972.      that creates a set of tokens like the  #errclass  directive,  but
  1973.      one which can be referenced in the grammar.  For example:
  1974.  
  1975.  
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.                                                                Page 32
  1984.  
  1985.                                                                  PCCTS
  1986.  
  1987.  
  1988.  
  1989.      #tokclass AOP { "-" "+" }
  1990.      #tokclass MOP { "/" " }
  1991.      #tokclass OP  { AOP MOP }
  1992.       ...
  1993.      e : e1 ( AOP e1 )* ;
  1994.      e1: e2 ( MOP e2 )* ;
  1995.       ...
  1996.  
  1997.  
  1998. o    Simple left-factoring will be introduced to remove identical left
  1999.      factors  from  alternative  productions (assuming user actions do
  2000.      not interfere).
  2001.  
  2002. o    A version of ANTLR (called ANTLR-lite?) is being considered  that
  2003.      would   accept  most  ANTLR  description  syntax,  delay  grammar
  2004.      analysis to run time (where it could be done much more  quickly -
  2005.      with  nonexponential  complexity),  scan  for  tokens with an NFA
  2006.      regular-expression interpreter rather a DFA, and place all output
  2007.      in  one  nice little file.  The reduction in parser size would be
  2008.      substantial, but at a parser run-time cost.
  2009.  
  2010. 20.  Portability
  2011.  
  2012.      PCCTS 1.10 is known to compile "out of the box" on the  following
  2013. machines and/or operating systems:
  2014.  
  2015. [1]  DECSTATION 5000
  2016.  
  2017. [2]  SGI, Running IRIX 4.0.5
  2018.  
  2019. [3]  Sun SparcStation (cc, gcc, g++, Cfront)
  2020.  
  2021. [4]  DOS and OS/2, Microsft C 6.0, 16 bit
  2022.  
  2023. [5]  DOS and OS/2, Borland C/C++, 16 bit
  2024.  
  2025. [6]  OS/2, IBM C-Set/2, 32 bit
  2026.  
  2027. [7]  VAX C under VMS
  2028.  
  2029. [8]  Linux SLS 0.99, gcc/g++
  2030.  
  2031. [9]  NeXT box
  2032.  
  2033. [10] Amiga, AmigaDOS--SAS/C Development System V 5.10b
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.  
  2042.  
  2043.  
  2044.  
  2045.                                                                Page 33
  2046.  
  2047.                                                                  PCCTS
  2048.  
  2049.  
  2050. 21.  Beta Testers
  2051.  
  2052.      The following is a group of persons (listed alphabetically) that,
  2053. in  some  way,  have  helped  shape and/or debug the latest release of
  2054. PCCTS.
  2055.  
  2056. [1]  Steven Anderson, (sea@ahpcrc.umn.edu)
  2057.  
  2058. [2]  Douglas B. Cuthbertson, (cuthbertsond@gw1.hanscom.af.mil)
  2059.  
  2060. [3]  Peter Dahl, (dahl@mckinley.ee.umn.edu)
  2061.  
  2062. [4]  Ed Harfmann, (mdbs!ed@dynamo.ecn.purdue.edu)
  2063.  
  2064. [5]  Randy Helzerman, (helz@ecn.purdue.edu)
  2065.  
  2066. [6]  Stephen Hite, (shite@sinkhole.unf.edu)
  2067.  
  2068. [7]  Dana "Muck" Hoggatt, (mdbs!muck@dynamo.ecn.purdue.edu)
  2069.  
  2070. [8]  Roy Levow, (roy@gemini.cse.fau.edu)
  2071.  
  2072. [9]  John Mejia, (mejia@mckinley.ee.umn.edu)
  2073.  
  2074. [10] David Poole, (dpoole@nitrogen.oscs.montana.edu)
  2075.  
  2076. [11] Russell Quong, (quong@ecn.purdue.edu)
  2077.  
  2078. [12] Aaron Sawdey, (sawdey@mckinley.ee.umn.edu)
  2079.  
  2080. [13] Fred Scholldorf, (scholldorf@nuclear.physics.sunysb.edu)
  2081.  
  2082. [14] Sumana Srinivasan, (Sumana_Srinivasan@next.com)
  2083.  
  2084. [15] Ariel Tamches, (tamches@cs.wisc.edu)
  2085.  
  2086.  
  2087.  
  2088.  
  2089.  
  2090.  
  2091.  
  2092.  
  2093.  
  2094.  
  2095.  
  2096.  
  2097.  
  2098.  
  2099.  
  2100.  
  2101.  
  2102.  
  2103.  
  2104.  
  2105.  
  2106.  
  2107.                                                                Page 34
  2108.  
  2109.