home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / forth / dada / qparser.lst < prev    next >
File List  |  1986-02-27  |  30KB  |  1,056 lines

  1.  
  2. C:\QPARSER>lr1
  3.  
  4. QPARSER LALR(1) Parser Generator, version 2.5 *restricted use*
  5. COPYRIGHT (C) 1985, QCAD Systems, Inc.  All rights reserved.
  6.  
  7. Usage:
  8.   LR1 grammarfile[.GRM] [ -l reportfile[.TXT] ]
  9.         [ -t tablefile[.TBL] ]
  10.  
  11. Other options (* means default):
  12.   -l#   set report level to # (* = 0; max = 6)
  13.   -nt   no table output
  14.   -g#   set LALR stack to # (default = 50)
  15. The generator report levels are as follows:
  16.     0:  Grammar and conflict report
  17.     1:  Tokens and token numbers
  18.     2:  Final state machine
  19.     3:  Grammar statistics, initial item sets
  20.     4:  More item sets in more detail
  21. Each report level encompasses all lower level numbers.
  22.  
  23. C:\QPARSER>lr1 prolog6 -l2
  24.  
  25. QPARSER LALR(1) Parser Generator, version 2.5 *restricted use*
  26. COPYRIGHT (C) 1985, QCAD Systems, Inc.  All rights reserved.
  27. LALR(1) Parser Generator, version 2.5 &&&&&&&&&&&&&&&&
  28. COPYRIGHT (C) 1985, QCAD Systems, Inc.  All rights reserved.
  29. Grammar file  = prolog6.GRM
  30. Report file   = CON:
  31. Report level  = 2
  32. LALR stack size = 50
  33. Table file    = prolog6.TBL
  34.  
  35.  
  36. Memory available 28661
  37. ----------------------
  38. Productions
  39.  
  40.   1 Start      -> Prolog
  41.   2
  42.   2 Prolog     -> Prolog Clause
  43.   3            -> Clause
  44.   4
  45.   4 Clause     -> Goals '.'
  46.   5            -> Goals ':-' Goals '.'
  47.   6
  48.   6 Goals      -> Goals ',' Goal
  49.   7            -> Goal
  50.   8
  51.   8 Goal       -> Predicate '(' Components ')'
  52.   9
  53.   9 Components -> Components ',' Component
  54.  10            -> Component
  55.  11
  56.  11 Component  -> Functor '(' Components ')'
  57.  12            -> '<VARIABLE>'
  58.  13            -> Constant
  59.  14            -> List
  60.  15
  61.  15 Constant   -> '<NUMBER>'
  62.  16            -> '<ATOM>'
  63.  17
  64.  17 Functor    -> '<ATOM>'
  65.  18
  66.  18 Predicate  -> '<ATOM>'
  67.  19
  68.  19 List       -> '[' ']'
  69.  20            -> '[' Head ']'
  70.  21            -> '[' Head '|' Tail ']'
  71.  22
  72.  22 Head       -> Components
  73.  23
  74.  23 Tail       -> List
  75.  24
  76.  
  77. Memory available 27117
  78.  
  79. Terminal tokens
  80.  
  81.   1: (
  82.   2: )
  83.   3: ,
  84.   4: .
  85.   5: :-
  86.   6: <ATOM>
  87.   7: <NUMBER>
  88.   8: <VARIABLE>
  89.   9: <empty>
  90.  10: <eol>
  91.  11: <identifier>
  92.  12: <integer>
  93.  13: <real>
  94.  14: <stop>
  95.  15: <string>
  96.  16: [
  97.  17: ]
  98.  18: |
  99.  
  100. Nonterminal tokens
  101.  
  102.  19: Clause
  103.  20: Component
  104.  21: Components
  105.  22: Constant
  106.  23: Functor
  107.  24: Goal
  108.  25: Goals
  109.  26: Head
  110.  27: List
  111.  28: Predicate
  112.  29: Prolog
  113.  30: Start
  114.  31: Tail
  115. State building complete
  116. Memory available 26755
  117. Memory available 26730
  118. Mixed read-reduce states split
  119. 36 LALR items required
  120. Memory available 26525
  121. Memory available 26499
  122. READS completed
  123. INCLUDES completed: max stack= 4
  124. 36 LALR list items
  125. Memory available 26525
  126. 0 conflicts found.
  127. Resolution complete
  128. Untagged single productions removed
  129. Inaccessible state: 5
  130. Inaccessible state: 6
  131. Inaccessible state: 16
  132. Inaccessible state: 19
  133. Inaccessible state: 22
  134. Inaccessible state: 35
  135. Inaccessible states removed
  136. Read tables compressed
  137. Reduce tables compressed
  138. Parser table reduction complete
  139. States renumbered
  140.  
  141.  
  142. State Machine
  143.   Start state: 18, initial stack state: 18
  144. 0: HALT
  145. 1: REDUCE
  146.   18 [Predicate -> <ATOM> |]
  147.  - On stack state 34 => 20
  148.  - On stack state 22 => 20
  149.  - On stack state 21 => 20
  150.  - On stack state 18 => 20
  151. 2: REDUCE
  152.    4 [Clause -> Goals . |]
  153.  - On stack state 18 => 37
  154.    On stack state 34 => 3
  155. 3: REDUCE
  156.    2 [Prolog -> Prolog Clause |]
  157.  - On stack state 18 => 37
  158. 4: REDUCE
  159.    6 [Goals -> Goals , Goal |]
  160.  - On stack state 34 => 19
  161.  - On stack state 18 => 19
  162.    On stack state 21 => 24
  163. 5: REDUCE
  164.   15 [Constant -> <NUMBER> |]
  165.  - On stack state 23 => 27
  166.    On stack state 25 => 39
  167.    On stack state 29 => 32
  168.    On stack state 30 => 11
  169. 6: REDUCE
  170.   12 [Component -> <VARIABLE> |]
  171.  - On stack state 23 => 27
  172.    On stack state 25 => 39
  173.    On stack state 29 => 32
  174.    On stack state 30 => 11
  175. 7: REDUCE  (= 2)
  176.    5 [Clause -> Goals :- Goals . |]
  177.  - On stack state 18 => 37
  178.    On stack state 34 => 3
  179. 8: REDUCE
  180.   19 [List -> [ ] |]
  181.  - On stack state 23 => 27
  182.    On stack state 25 => 39
  183.    On stack state 29 => 32
  184.    On stack state 30 => 11
  185.    On stack state 31 => 33
  186. 9: REDUCE
  187.    8 [Goal -> Predicate ( Components ) |]
  188.  - On stack state 34 => 19
  189.  - On stack state 18 => 19
  190.    On stack state 21 => 24
  191.    On stack state 22 => 4
  192. 10: REDUCE  (= 8)
  193.   20 [List -> [ Head ] |]
  194.  - On stack state 23 => 27
  195.    On stack state 25 => 39
  196.    On stack state 29 => 32
  197.    On stack state 30 => 11
  198.    On stack state 31 => 33
  199. 11: REDUCE
  200.    9 [Components -> Components , Component |]
  201.  - On stack state 23 => 27
  202.    On stack state 25 => 39
  203.    On stack state 29 => 32
  204. 12: REDUCE  (= 6)
  205.   11 [Component -> Functor ( Components ) |]
  206.  - On stack state 23 => 27
  207.    On stack state 25 => 39
  208.    On stack state 29 => 32
  209.    On stack state 30 => 11
  210. 13: REDUCE  (= 8)
  211.   21 [List -> [ Head | Tail ] |]
  212.  - On stack state 23 => 27
  213.    On stack state 25 => 39
  214.    On stack state 29 => 32
  215.    On stack state 30 => 11
  216.    On stack state 31 => 33
  217. 14: REDUCE
  218.    1 [Start -> Prolog |]
  219.  - On stack state 18 => 0
  220. 15: REDUCE  (= 5)
  221.   16 [Constant -> <ATOM> |]
  222.  - On stack state 23 => 27
  223.    On stack state 25 => 39
  224.    On stack state 29 => 32
  225.    On stack state 30 => 11
  226. 16: REDUCE
  227.   17 [Functor -> <ATOM> |]
  228.  - On stack state 30 => 26
  229.  - On stack state 29 => 26
  230.  - On stack state 25 => 26
  231.  - On stack state 23 => 26
  232. 17: REDUCE
  233.   22 [Head -> Components |]
  234.  - On stack state 25 => 28
  235. 18: READ
  236.   On <ATOM> => 1
  237. 19: READ
  238.   On , => 22
  239.   On . => 2
  240.   On :- => 21
  241. 20: READ
  242.   On ( => 23
  243. 21: READ  (= 18)
  244.   On <ATOM> => 1
  245. 22: READ  (= 18)
  246.   On <ATOM> => 1
  247. 23: READ
  248.   On <ATOM> => 38
  249.   On <NUMBER> => 5
  250.   On <VARIABLE> => 6
  251.   On [ => 25
  252. 24: READ
  253.   On , => 22
  254.   On . => 7
  255. 25: READ
  256.   On <ATOM> => 38
  257.   On <NUMBER> => 5
  258.   On <VARIABLE> => 6
  259.   On [ => 25
  260.   On ] => 8
  261. 26: READ
  262.   On ( => 29
  263. 27: READ
  264.   On ) => 9
  265.   On , => 30
  266. 28: READ
  267.   On ] => 10
  268.   On | => 31
  269. 29: READ  (= 23)
  270.   On <ATOM> => 38
  271.   On <NUMBER> => 5
  272.   On <VARIABLE> => 6
  273.   On [ => 25
  274. 30: READ  (= 23)
  275.   On <ATOM> => 38
  276.   On <NUMBER> => 5
  277.   On <VARIABLE> => 6
  278.   On [ => 25
  279. 31: READ
  280.   On [ => 25
  281. 32: READ
  282.   On ) => 12
  283.   On , => 30
  284. 33: READ
  285.   On ] => 13
  286. 34: READ  (= 18)
  287.   On <ATOM> => 1
  288. 35: READ
  289. 36: READ
  290.   On , => 30
  291. 37: LOOK
  292.  - On { <ATOM> } => 34
  293.    On { <stop> } => 14
  294. 38: LOOK
  295.    On { } => 35
  296.  - On { ) , ] | } => 15
  297.    On { ( } => 16
  298. 39: LOOK
  299.    On { , } => 36
  300.  - On { ] | } => 17
  301.  
  302. No errors or warnings.
  303.  
  304. C:\QPARSER>
  305.  
  306. C:\QPARSER>gramchk
  307.  
  308. QPARSER Grammar Checker, version 2.4
  309. COPYRIGHT (C) 1985, QCAD Systems, Inc.  All rights reserved.
  310.  
  311.  
  312. Usage:
  313.   GRAMCHK grammarfile[.GRM] [ -l reportfile[.TXT] ]
  314.  
  315. Option:
  316.   -l#  report level:=# (default = 0)
  317.  
  318. The report levels are as follows:
  319.     0:  Grammar and inspection report
  320.     1:  Grammar cross-reference table
  321.     2:  First/follow/predecessor sets
  322.     3:  Grammar statistics
  323.  A large report level implies printing everything at a lower level
  324.  
  325. C:\QPARSER>gramchk prolog6 -l1
  326.  
  327. QPARSER Grammar Checker, version 2.4
  328. COPYRIGHT (C) 1985, QCAD Systems, Inc.  All rights reserved.
  329.  
  330. GRAMCHK grammar report and checking utility, version 2.4
  331. COPYRIGHT (C) 1985, QCAD Systems, Inc.  All rights reserved.
  332.  
  333. Grammar file  = prolog6.GRM
  334. Report file   = CON:
  335. Report level  = 1
  336. LALR stack size = 50
  337. Table file    = prolog6.TBL
  338.  
  339.  
  340. ----------------------
  341. Productions
  342.  
  343.   1 Start      -> Prolog
  344.   2
  345.   2 Prolog     -> Prolog Clause
  346.   3            -> Clause
  347.   4
  348.   4 Clause     -> Goals '.'
  349.   5            -> Goals ':-' Goals '.'
  350.   6
  351.   6 Goals      -> Goals ',' Goal
  352.   7            -> Goal
  353.   8
  354.   8 Goal       -> Predicate '(' Components ')'
  355.   9
  356.   9 Components -> Components ',' Component
  357.  10            -> Component
  358.  11
  359.  11 Component  -> Functor '(' Components ')'
  360.  12            -> '<VARIABLE>'
  361.  13            -> Constant
  362.  14            -> List
  363.  15
  364.  15 Constant   -> '<NUMBER>'
  365.  16            -> '<ATOM>'
  366.  17
  367.  17 Functor    -> '<ATOM>'
  368.  18
  369.  18 Predicate  -> '<ATOM>'
  370.  19
  371.  19 List       -> '[' ']'
  372.  20            -> '[' Head ']'
  373.  21            -> '[' Head '|' Tail ']'
  374.  22
  375.  22 Head       -> Components
  376.  23
  377.  23 Tail       -> List
  378.  24
  379.  
  380. ------------------
  381. Alphabetized productions
  382.  
  383.   4:  Clause -> Goals .
  384.   5:  Clause -> Goals :- Goals .
  385.  11:  Component -> Functor ( Components )
  386.  12:  Component -> <VARIABLE>
  387.  13:  Component -> Constant
  388.  14:  Component -> List
  389.   9:  Components -> Components , Component
  390.  10:  Components -> Component
  391.  15:  Constant -> <NUMBER>
  392.  16:  Constant -> <ATOM>
  393.  17:  Functor -> <ATOM>
  394.   8:  Goal -> Predicate ( Components )
  395.   6:  Goals -> Goals , Goal
  396.   7:  Goals -> Goal
  397.  22:  Head -> Components
  398.  19:  List -> [ ]
  399.  20:  List -> [ Head ]
  400.  21:  List -> [ Head | Tail ]
  401.  18:  Predicate -> <ATOM>
  402.   2:  Prolog -> Prolog Clause
  403.   3:  Prolog -> Clause
  404.   1: *Start -> Prolog
  405.  23:  Tail -> List
  406.  
  407. ------------------
  408. Token cross-reference table
  409. TERMINAL tokens
  410.  
  411.   1. (                8   11
  412.   2. )                8   11
  413.   3. ,                6    9
  414.   4. .                4    5
  415.   5. :-               5
  416.   6. <ATOM>          16   17   18
  417.   7. <NUMBER>        15
  418.   8. <VARIABLE>      12
  419.   9. <empty>
  420.  10. <eol>
  421.  11. <identifier>
  422.  12. <integer>
  423.  13. <real>
  424.  14. <stop>
  425.  15. <string>
  426.  16. [               19   20   21
  427.  17. ]               19   20   21
  428.  18. |               21
  429.  
  430.  
  431. NONTERMINAL tokens
  432.  
  433.  19. Clause           2    3    4*   5*
  434.  20. Component        9   10   11*  12*  13*  14*
  435.  21. Components       8    9*   9   10*  11   22
  436.  22. Constant        13   15*  16*
  437.  23. Functor         11   17*
  438.  24. Goal             6    7    8*
  439.  25. Goals            4    5    5    6*   6    7*
  440.  26. Head            20   21   22*
  441.  27. List            14   19*  20*  21*  23
  442.  28. Predicate        8   18*
  443.  29. Prolog           1    2*   2    3*
  444.  30. Start            1*
  445.  31. Tail            21   23*
  446.  
  447. ------------------------
  448. The following special terminals have appeared
  449.   in the grammar:
  450.  
  451. ------------------------
  452. Checking for useless productions and the possibility that
  453.  the goal symbol fails to derive any terminal string
  454. A complaint means that the grammar should be reduced
  455.  or repaired.
  456.  ... no useless productions
  457.  ... goal symbol derives at least one terminal string
  458. ------------------------
  459. Checking for any tokens, terminal or nonterminal,
  460.  that cannot be derived from the goal.
  461. If any such are found, the grammar is not strongly
  462.  connected and should be repaired.
  463.   ... no problems detected
  464. ------------------------
  465.  
  466. Nullable nonterminals: none found
  467. ------------------------
  468. Checking for any single production cycles, e.g.
  469.   A ->+ A
  470. If one exists, the grammar is ambiguous.
  471.   (A cycle may be reported more than once)
  472.  
  473.  ... no cycles detected
  474. ------------------------
  475. Checking for any nonterminals that fail to derive a single
  476.  terminal token.  A complaint is NOT an error.  You may choose
  477.  to add an error production for each such nonterminal in order
  478.  to improve error recovery.  Just create a unique error terminal
  479.  token, e.g. ERROR_01, then add the production X -> ERROR_01
  480.  
  481.   NOTE: No production of the form Clause -> x, where x is terminal
  482.   NOTE: No production of the form Components -> x, where x is terminal
  483.   NOTE: No production of the form Goal -> x, where x is terminal
  484.   NOTE: No production of the form Goals -> x, where x is terminal
  485.   NOTE: No production of the form Head -> x, where x is terminal
  486.   NOTE: No production of the form List -> x, where x is terminal
  487.   NOTE: No production of the form Prolog -> x, where x is terminal
  488.   NOTE: No production of the form Start -> x, where x is terminal
  489.   NOTE: No production of the form Tail -> x, where x is terminal
  490.  
  491. No errors or warnings.
  492.  
  493. C:\QPARSER>lr1 psg3
  494.  
  495. QPARSER LALR(1) Parser Generator, version 2.5 *restricted use*
  496. COPYRIGHT (C) 1985, QCAD Systems, Inc.  All rights reserved.
  497. LALR(1) Parser Generator, version 2.5 &&&&&&&&&&&&&&&&
  498. COPYRIGHT (C) 1985, QCAD Systems, Inc.  All rights reserved.
  499. ----------------------
  500. Productions
  501.  
  502.   1
  503.   1 PSG -> Program
  504.   2 Program -> ProgHead ProgParms ';' Pblk Pblock '.'
  505.   3
  506.   3 ProgHead -> 'PROGRAM' '<IDENTIFIER>'
  507.   4 ProgParms ->
  508.   5
  509.   5 Pblock -> LBList TYPList VRList PList Pbegin StmtList 'END'
  510.   6 Pbegin -> 'BEGIN'
  511.   7
  512.   7 Block -> 'BEGIN' StmtList 'END'
  513.   8
  514.   8 LBList -> 'LABEL' LabList ';'
  515.   9        ->
  516.  10 LabList -> LabList ',' '<INTEGER>'
  517.  11         -> '<INTEGER>'
  518.  12
  519.  12 VRList -> Var VList ';'
  520.  13        ->
  521.  14 Var -> 'VAR'
  522.  15 VList -> VList ';' VarItem
  523.  16       -> VarItem
  524.  17 VarItem -> IdentList ':' Type
  525.  18 IdentList -> IdentList ',' '<IDENTIFIER>'
  526.  19           -> '<IDENTIFIER>'
  527.  20
  528.  20 TYPList -> 'TYPE' TList ';'
  529.  21         ->
  530.  22 TList -> TList ';' TypItem
  531.  23       -> TypItem
  532.  24 TypItem -> '<IDENTIFIER>' '=' Type
  533.  25
  534.  25 Type -> SimpType
  535.  26      -> 'ARRAY' '[' Sint '..' Sint ']' 'OF' Type
  536.  27      -> 'RECORD' FieldList 'END'
  537.  28
  538.  28 SimpType -> '<IDENTIFIER>'
  539.  29
  540.  29
  541.  29 FieldList -> IdentList ':' Type
  542.  30           -> IdentList ':' Type ';' FieldList
  543.  31           -> 'CASE' SimpType 'OF' CaseList
  544.  32
  545.  32
  546.  32 CaseList -> CaseItem ';' CaseList
  547.  33          -> CaseItem
  548.  34 CaseItem -> ConstList ':' '(' FieldList ')'
  549.  35
  550.  35 PList -> PList PFDecl
  551.  36       ->
  552.  37 PFDecl -> ProcDecl
  553.  38        -> FuncDecl
  554.  39 ProcDecl -> ProcHead Parms ';' 'FORWARD' ';'
  555.  40          -> ProcHead Parms ';' Pblk Pblock ';'
  556.  41 ProcHead -> 'PROCEDURE' '<IDENTIFIER>'
  557.  42 FuncDecl -> FuncHead Parms ':' '<IDENTIFIER>' ';' 'FORWARD' ';'
  558.  43          -> FuncHead Parms ':' '<IDENTIFIER>' ';' Fblk Pblock ';'
  559.  44 FuncHead -> 'FUNCTION' '<IDENTIFIER>'
  560.  45 Parms ->
  561.  46          -> '(' ParmList ')'
  562.  47 ParmList -> ParmList ';' Parm
  563.  48          -> Parm
  564.  49 Parm -> 'VAR' IdentList ':' SimpType
  565.  50      -> IdentList ':' SimpType
  566.  51 Pblk ->
  567.  52 Fblk ->
  568.  53
  569.  53 StmtList -> StmtList ';' Stmt
  570.  54          -> Stmt
  571.  55 Stmt -> 'IF' Boolean Then Stmt
  572.  56      -> 'IF' Boolean Then Stmt Else Stmt
  573.  57      -> 'WHILE' Boolean Do Stmt
  574.  58      -> Repeat StmtList 'UNTIL' Boolean
  575.  59      -> 'FOR' VarHead ':=' Boolean 'TO' Boolean Fup Stmt
  576.  60      -> 'FOR' VarHead ':=' Boolean 'DOWNTO' Boolean Fdown Stmt
  577.  61      -> Variable ':=' Boolean
  578.  62      -> ProcCall
  579.  63      -> '<IDENTIFIER>'
  580.  64      -> 'GOTO' '<INTEGER>'
  581.  65      -> Label ':' Stmt
  582.  66      -> Block
  583.  67      -> ReadWrite '(' IOList ')'
  584.  68      ->
  585.  69 Then -> 'THEN'
  586.  70 Else -> 'ELSE'
  587.  71 Fup -> 'DO'
  588.  72 Fdown -> 'DO'
  589.  73 Do -> 'DO'
  590.  74 Repeat -> 'REPEAT'
  591.  75 Label -> '<INTEGER>'
  592.  76 ReadWrite -> 'READ'
  593.  77           -> 'WRITE'
  594.  78
  595.  78 IOList -> IOList ',' IOItem
  596.  79        -> IOItem
  597.  80 IOItem -> Boolean
  598.  81        -> '<string>'
  599.  82
  600.  82 ProcCall -> '<IDENTIFIER>' '(' BoolList ')'
  601.  83 BoolList -> BoolList ',' Boolean
  602.  84          -> Boolean
  603.  85
  604.  85 Boolean -> BoolTerm
  605.  86         -> Boolean 'OR' BoolTerm
  606.  87 BoolTerm -> BoolUnary
  607.  88          -> BoolTerm 'AND' BoolUnary
  608.  89 BoolUnary -> BoolPri
  609.  90           -> 'NOT' BoolPri
  610.  91 BoolPri -> Expr
  611.  92         -> Expr Relop Expr
  612.  93
  613.  93 Relop -> '<'
  614.  94       -> '>'
  615.  95       -> '<='
  616.  96       -> '>='
  617.  97       -> '='
  618.  98       -> '<>'
  619.  99
  620.  99 Expr -> Expr '+' Term
  621. 100      -> Expr '-' Term
  622. 101      -> Term
  623. 102 Term -> Term '*' Unary
  624. 103      -> Term '/' Unary
  625. 104      -> Term 'MOD' Unary
  626. 105      -> Term 'DIV' Unary
  627. 106      -> Unary
  628. 107 Unary -> Primary
  629. 108       -> '-' Primary
  630. 109 Primary -> '(' Boolean ')'
  631. 110         -> ProcCall
  632. 111         -> Variable
  633. 112         -> Constant
  634. 113
  635. 113 Variable -> VarHead VarExtension
  636. 114 VarHead -> '<IDENTIFIER>'
  637. 115 VarExtension -> VarExtension VarExt
  638. 116              ->
  639. 117 VarExt -> '[' BoolList ']'
  640. 118        -> '.' '<IDENTIFIER>'
  641. 119
  642. 119 Constant -> '<REAL>'
  643. 120          -> '<INTEGER>'
  644. 121          -> 'TRUE'
  645. 122          -> 'FALSE'
  646. 123 ConstList -> ConstList ',' Constant
  647. 124           -> Constant
  648. 125 Sint -> '<INTEGER>'
  649. 126      -> '-' '<INTEGER>'
  650.  
  651. State building complete
  652. Mixed read-reduce states split
  653. 401 LALR items required
  654. READS completed
  655. INCLUDES completed: max stack= 13
  656. 401 LALR list items
  657. ------------------------
  658. LOOKAHEAD conflict on tokens ELSE
  659. 205: LOOK , insymbol Stmt
  660.    On { ELSE } => 309
  661.    On { ; ELSE END UNTIL } => 310
  662. 309: READ , insymbol Stmt
  663.   70 [Else -> | ELSE] => 220
  664.  *56 [Stmt -> IF Boolean Then Stmt | Else Stmt] => 221
  665. 310: REDUCE , insymbol Stmt
  666.   55 [Stmt -> IF Boolean Then Stmt |]
  667.  ... fully resolved in favor of READ
  668. Lookahead state AFTER resolution:
  669. 205: LOOK , insymbol Stmt
  670.    On { ELSE } => 309
  671.    On { ; END UNTIL } => 310
  672. 1 conflict found and resolved.
  673.  PLEASE EXAMINE THE CONFLICT REPORT
  674.   ... parser may not do what you expect
  675. Resolution complete
  676. Untagged single productions removed
  677. Inaccessible states removed
  678. Read tables compressed
  679. Reduce tables compressed
  680. Parser table reduction complete
  681. States renumbered
  682.  
  683. 1 ERROR
  684.  
  685. C:\QPARSER>gramchk psg3
  686.  
  687. QPARSER Grammar Checker, version 2.4
  688. COPYRIGHT (C) 1985, QCAD Systems, Inc.  All rights reserved.
  689.  
  690. GRAMCHK grammar report and checking utility, version 2.4
  691. COPYRIGHT (C) 1985, QCAD Systems, Inc.  All rights reserved.
  692.  
  693. ----------------------
  694. Productions
  695.  
  696.   1
  697.   1 PSG -> Program
  698.   2 Program -> ProgHead ProgParms ';' Pblk Pblock '.'
  699.   3
  700.   3 ProgHead -> 'PROGRAM' '<IDENTIFIER>'
  701.   4 ProgParms ->
  702.   5
  703.   5 Pblock -> LBList TYPList VRList PList Pbegin StmtList 'END'
  704.   6 Pbegin -> 'BEGIN'
  705.   7
  706.   7 Block -> 'BEGIN' StmtList 'END'
  707.   8
  708.   8 LBList -> 'LABEL' LabList ';'
  709.   9        ->
  710.  10 LabList -> LabList ',' '<INTEGER>'
  711.  11         -> '<INTEGER>'
  712.  12
  713.  12 VRList -> Var VList ';'
  714.  13        ->
  715.  14 Var -> 'VAR'
  716.  15 VList -> VList ';' VarItem
  717.  16       -> VarItem
  718.  17 VarItem -> IdentList ':' Type
  719.  18 IdentList -> IdentList ',' '<IDENTIFIER>'
  720.  19           -> '<IDENTIFIER>'
  721.  20
  722.  20 TYPList -> 'TYPE' TList ';'
  723.  21         ->
  724.  22 TList -> TList ';' TypItem
  725.  23       -> TypItem
  726.  24 TypItem -> '<IDENTIFIER>' '=' Type
  727.  25
  728.  25 Type -> SimpType
  729.  26      -> 'ARRAY' '[' Sint '..' Sint ']' 'OF' Type
  730.  27      -> 'RECORD' FieldList 'END'
  731.  28
  732.  28 SimpType -> '<IDENTIFIER>'
  733.  29
  734.  29
  735.  29 FieldList -> IdentList ':' Type
  736.  30           -> IdentList ':' Type ';' FieldList
  737.  31           -> 'CASE' SimpType 'OF' CaseList
  738.  32
  739.  32
  740.  32 CaseList -> CaseItem ';' CaseList
  741.  33          -> CaseItem
  742.  34 CaseItem -> ConstList ':' '(' FieldList ')'
  743.  35
  744.  35 PList -> PList PFDecl
  745.  36       ->
  746.  37 PFDecl -> ProcDecl
  747.  38        -> FuncDecl
  748.  39 ProcDecl -> ProcHead Parms ';' 'FORWARD' ';'
  749.  40          -> ProcHead Parms ';' Pblk Pblock ';'
  750.  41 ProcHead -> 'PROCEDURE' '<IDENTIFIER>'
  751.  42 FuncDecl -> FuncHead Parms ':' '<IDENTIFIER>' ';' 'FORWARD' ';'
  752.  43          -> FuncHead Parms ':' '<IDENTIFIER>' ';' Fblk Pblock ';'
  753.  44 FuncHead -> 'FUNCTION' '<IDENTIFIER>'
  754.  45 Parms ->
  755.  46          -> '(' ParmList ')'
  756.  47 ParmList -> ParmList ';' Parm
  757.  48          -> Parm
  758.  49 Parm -> 'VAR' IdentList ':' SimpType
  759.  50      -> IdentList ':' SimpType
  760.  51 Pblk ->
  761.  52 Fblk ->
  762.  53
  763.  53 StmtList -> StmtList ';' Stmt
  764.  54          -> Stmt
  765.  55 Stmt -> 'IF' Boolean Then Stmt
  766.  56      -> 'IF' Boolean Then Stmt Else Stmt
  767.  57      -> 'WHILE' Boolean Do Stmt
  768.  58      -> Repeat StmtList 'UNTIL' Boolean
  769.  59      -> 'FOR' VarHead ':=' Boolean 'TO' Boolean Fup Stmt
  770.  60      -> 'FOR' VarHead ':=' Boolean 'DOWNTO' Boolean Fdown Stmt
  771.  61      -> Variable ':=' Boolean
  772.  62      -> ProcCall
  773.  63      -> '<IDENTIFIER>'
  774.  64      -> 'GOTO' '<INTEGER>'
  775.  65      -> Label ':' Stmt
  776.  66      -> Block
  777.  67      -> ReadWrite '(' IOList ')'
  778.  68      ->
  779.  69 Then -> 'THEN'
  780.  70 Else -> 'ELSE'
  781.  71 Fup -> 'DO'
  782.  72 Fdown -> 'DO'
  783.  73 Do -> 'DO'
  784.  74 Repeat -> 'REPEAT'
  785.  75 Label -> '<INTEGER>'
  786.  76 ReadWrite -> 'READ'
  787.  77           -> 'WRITE'
  788.  78
  789.  78 IOList -> IOList ',' IOItem
  790.  79        -> IOItem
  791.  80 IOItem -> Boolean
  792.  81        -> '<string>'
  793.  82
  794.  82 ProcCall -> '<IDENTIFIER>' '(' BoolList ')'
  795.  83 BoolList -> BoolList ',' Boolean
  796.  84          -> Boolean
  797.  85
  798.  85 Boolean -> BoolTerm
  799.  86         -> Boolean 'OR' BoolTerm
  800.  87 BoolTerm -> BoolUnary
  801.  88          -> BoolTerm 'AND' BoolUnary
  802.  89 BoolUnary -> BoolPri
  803.  90           -> 'NOT' BoolPri
  804.  91 BoolPri -> Expr
  805.  92         -> Expr Relop Expr
  806.  93
  807.  93 Relop -> '<'
  808.  94       -> '>'
  809.  95       -> '<='
  810.  96       -> '>='
  811.  97       -> '='
  812.  98       -> '<>'
  813.  99
  814.  99 Expr -> Expr '+' Term
  815. 100      -> Expr '-' Term
  816. 101      -> Term
  817. 102 Term -> Term '*' Unary
  818. 103      -> Term '/' Unary
  819. 104      -> Term 'MOD' Unary
  820. 105      -> Term 'DIV' Unary
  821. 106      -> Unary
  822. 107 Unary -> Primary
  823. 108       -> '-' Primary
  824. 109 Primary -> '(' Boolean ')'
  825. 110         -> ProcCall
  826. 111         -> Variable
  827. 112         -> Constant
  828. 113
  829. 113 Variable -> VarHead VarExtension
  830. 114 VarHead -> '<IDENTIFIER>'
  831. 115 VarExtension -> VarExtension VarExt
  832. 116              ->
  833. 117 VarExt -> '[' BoolList ']'
  834. 118        -> '.' '<IDENTIFIER>'
  835. 119
  836. 119 Constant -> '<REAL>'
  837. 120          -> '<INTEGER>'
  838. 121          -> 'TRUE'
  839. 122          -> 'FALSE'
  840. 123 ConstList -> ConstList ',' Constant
  841. 124           -> Constant
  842. 125 Sint -> '<INTEGER>'
  843. 126      -> '-' '<INTEGER>'
  844.  
  845. ------------------
  846. Alphabetized productions
  847.  
  848.   7:  Block -> BEGIN StmtList END
  849.  83:  BoolList -> BoolList , Boolean
  850.  84:  BoolList -> Boolean
  851.  91:  BoolPri -> Expr
  852.  92:  BoolPri -> Expr Relop Expr
  853.  87:  BoolTerm -> BoolUnary
  854.  88:  BoolTerm -> BoolTerm AND BoolUnary
  855.  89:  BoolUnary -> BoolPri
  856.  90:  BoolUnary -> NOT BoolPri
  857.  85:  Boolean -> BoolTerm
  858.  86:  Boolean -> Boolean OR BoolTerm
  859.  34:  CaseItem -> ConstList : ( FieldList )
  860.  32:  CaseList -> CaseItem ; CaseList
  861.  33:  CaseList -> CaseItem
  862. 123:  ConstList -> ConstList , Constant
  863. 124:  ConstList -> Constant
  864. 119:  Constant -> <REAL>
  865. 120:  Constant -> <INTEGER>
  866. 121:  Constant -> TRUE
  867. 122:  Constant -> FALSE
  868.  73:  Do -> DO
  869.  70:  Else -> ELSE
  870.  99:  Expr -> Expr + Term
  871. 100:  Expr -> Expr - Term
  872. 101:  Expr -> Term
  873.  52:  Fblk -> <empty>
  874.  72:  Fdown -> DO
  875.  29:  FieldList -> IdentList : Type
  876.  30:  FieldList -> IdentList : Type ; FieldList
  877.  31:  FieldList -> CASE SimpType OF CaseList
  878.  42:  FuncDecl -> FuncHead Parms : <IDENTIFIER> ; FORWARD ;
  879.  43:  FuncDecl -> FuncHead Parms : <IDENTIFIER> ; Fblk Pblock ;
  880.  44:  FuncHead -> FUNCTION <IDENTIFIER>
  881.  71:  Fup -> DO
  882.  80:  IOItem -> Boolean
  883.  81:  IOItem -> <string>
  884.  78:  IOList -> IOList , IOItem
  885.  79:  IOList -> IOItem
  886.  18:  IdentList -> IdentList , <IDENTIFIER>
  887.  19:  IdentList -> <IDENTIFIER>
  888.   8:  LBList -> LABEL LabList ;
  889.   9:  LBList -> <empty>
  890.  10:  LabList -> LabList , <INTEGER>
  891.  11:  LabList -> <INTEGER>
  892.  75:  Label -> <INTEGER>
  893.  37:  PFDecl -> ProcDecl
  894.  38:  PFDecl -> FuncDecl
  895.  35:  PList -> PList PFDecl
  896.  36:  PList -> <empty>
  897.   1: *PSG -> Program
  898.  49:  Parm -> VAR IdentList : SimpType
  899.  50:  Parm -> IdentList : SimpType
  900.  47:  ParmList -> ParmList ; Parm
  901.  48:  ParmList -> Parm
  902.  45:  Parms -> <empty>
  903.  46:  Parms -> ( ParmList )
  904.   6:  Pbegin -> BEGIN
  905.  51:  Pblk -> <empty>
  906.   5:  Pblock -> LBList TYPList VRList PList Pbegin StmtList END
  907. 109:  Primary -> ( Boolean )
  908. 110:  Primary -> ProcCall
  909. 111:  Primary -> Variable
  910. 112:  Primary -> Constant
  911.  82:  ProcCall -> <IDENTIFIER> ( BoolList )
  912.  39:  ProcDecl -> ProcHead Parms ; FORWARD ;
  913.  40:  ProcDecl -> ProcHead Parms ; Pblk Pblock ;
  914.  41:  ProcHead -> PROCEDURE <IDENTIFIER>
  915.   3:  ProgHead -> PROGRAM <IDENTIFIER>
  916.   4:  ProgParms -> <empty>
  917.   2:  Program -> ProgHead ProgParms ; Pblk Pblock .
  918.  76:  ReadWrite -> READ
  919.  77:  ReadWrite -> WRITE
  920.  93:  Relop -> <
  921.  94:  Relop -> >
  922.  95:  Relop -> <=
  923.  96:  Relop -> >=
  924.  97:  Relop -> =
  925.  98:  Relop -> <>
  926.  74:  Repeat -> REPEAT
  927.  28:  SimpType -> <IDENTIFIER>
  928. 125:  Sint -> <INTEGER>
  929. 126:  Sint -> - <INTEGER>
  930.  55:  Stmt -> IF Boolean Then Stmt
  931.  56:  Stmt -> IF Boolean Then Stmt Else Stmt
  932.  57:  Stmt -> WHILE Boolean Do Stmt
  933.  58:  Stmt -> Repeat StmtList UNTIL Boolean
  934.  59:  Stmt -> FOR VarHead := Boolean TO Boolean Fup Stmt
  935.  60:  Stmt -> FOR VarHead := Boolean DOWNTO Boolean Fdown Stmt
  936.  61:  Stmt -> Variable := Boolean
  937.  62:  Stmt -> ProcCall
  938.  63:  Stmt -> <IDENTIFIER>
  939.  64:  Stmt -> GOTO <INTEGER>
  940.  65:  Stmt -> Label : Stmt
  941.  66:  Stmt -> Block
  942.  67:  Stmt -> ReadWrite ( IOList )
  943.  68:  Stmt -> <empty>
  944.  53:  StmtList -> StmtList ; Stmt
  945.  54:  StmtList -> Stmt
  946.  22:  TList -> TList ; TypItem
  947.  23:  TList -> TypItem
  948.  20:  TYPList -> TYPE TList ;
  949.  21:  TYPList -> <empty>
  950. 102:  Term -> Term * Unary
  951. 103:  Term -> Term / Unary
  952. 104:  Term -> Term MOD Unary
  953. 105:  Term -> Term DIV Unary
  954. 106:  Term -> Unary
  955.  69:  Then -> THEN
  956.  24:  TypItem -> <IDENTIFIER> = Type
  957.  25:  Type -> SimpType
  958.  26:  Type -> ARRAY [ Sint .. Sint ] OF Type
  959.  27:  Type -> RECORD FieldList END
  960. 107:  Unary -> Primary
  961. 108:  Unary -> - Primary
  962.  15:  VList -> VList ; VarItem
  963.  16:  VList -> VarItem
  964.  12:  VRList -> Var VList ;
  965.  13:  VRList -> <empty>
  966.  14:  Var -> VAR
  967. 117:  VarExt -> [ BoolList ]
  968. 118:  VarExt -> . <IDENTIFIER>
  969. 115:  VarExtension -> VarExtension VarExt
  970. 116:  VarExtension -> <empty>
  971. 114:  VarHead -> <IDENTIFIER>
  972.  17:  VarItem -> IdentList : Type
  973. 113:  Variable -> VarHead VarExtension
  974. ------------------------
  975. The following special terminals have appeared
  976.   in the grammar:
  977.   <string>
  978. ------------------------
  979. Checking for useless productions and the possibility that
  980.  the goal symbol fails to derive any terminal string
  981. A complaint means that the grammar should be reduced
  982.  or repaired.
  983.  ... no useless productions
  984.  ... goal symbol derives at least one terminal string
  985. ------------------------
  986. Checking for any tokens, terminal or nonterminal,
  987.  that cannot be derived from the goal.
  988. If any such are found, the grammar is not strongly
  989.  connected and should be repaired.
  990.   ... no problems detected
  991. ------------------------
  992.  
  993. Nullable nonterminals: Fblk LBList PList Parms Pblk ProgParms Stmt StmtList
  994.   TYPList VRList VarExtension
  995. ------------------------
  996. Checking for any single production cycles, e.g.
  997.   A ->+ A
  998. If one exists, the grammar is ambiguous.
  999.   (A cycle may be reported more than once)
  1000.  
  1001.  ... no cycles detected
  1002. ------------------------
  1003. Checking for any nonterminals that fail to derive a single
  1004.  terminal token.  A complaint is NOT an error.  You may choose
  1005.  to add an error production for each such nonterminal in order
  1006.  to improve error recovery.  Just create a unique error terminal
  1007.  token, e.g. ERROR_01, then add the production X -> ERROR_01
  1008.  
  1009.   NOTE: No production of the form Block -> x, where x is terminal
  1010.   NOTE: No production of the form BoolList -> x, where x is terminal
  1011.   NOTE: No production of the form BoolPri -> x, where x is terminal
  1012.   NOTE: No production of the form BoolTerm -> x, where x is terminal
  1013.   NOTE: No production of the form BoolUnary -> x, where x is terminal
  1014.   NOTE: No production of the form Boolean -> x, where x is terminal
  1015.   NOTE: No production of the form CaseItem -> x, where x is terminal
  1016.   NOTE: No production of the form CaseList -> x, where x is terminal
  1017.   NOTE: No production of the form ConstList -> x, where x is terminal
  1018.   NOTE: No production of the form Expr -> x, where x is terminal
  1019.   NOTE: No production of the form Fblk -> x, where x is terminal
  1020.   NOTE: No production of the form FieldList -> x, where x is terminal
  1021.   NOTE: No production of the form FuncDecl -> x, where x is terminal
  1022.   NOTE: No production of the form FuncHead -> x, where x is terminal
  1023.   NOTE: No production of the form IOList -> x, where x is terminal
  1024.   NOTE: No production of the form LBList -> x, where x is terminal
  1025.   NOTE: No production of the form PFDecl -> x, where x is terminal
  1026.   NOTE: No production of the form PList -> x, where x is terminal
  1027.   NOTE: No production of the form PSG -> x, where x is terminal
  1028.   NOTE: No production of the form Parm -> x, where x is terminal
  1029.   NOTE: No production of the form ParmList -> x, where x is terminal
  1030.   NOTE: No production of the form Parms -> x, where x is terminal
  1031.   NOTE: No production of the form Pblk -> x, where x is terminal
  1032.   NOTE: No production of the form Pblock -> x, where x is terminal
  1033.   NOTE: No production of the form Primary -> x, where x is terminal
  1034.   NOTE: No production of the form ProcCall -> x, where x is terminal
  1035.   NOTE: No production of the form ProcDecl -> x, where x is terminal
  1036.   NOTE: No production of the form ProcHead -> x, where x is terminal
  1037.   NOTE: No production of the form ProgHead -> x, where x is terminal
  1038.   NOTE: No production of the form ProgParms -> x, where x is terminal
  1039.   NOTE: No production of the form Program -> x, where x is terminal
  1040.   NOTE: No production of the form StmtList -> x, where x is terminal
  1041.   NOTE: No production of the form TList -> x, where x is terminal
  1042.   NOTE: No production of the form TYPList -> x, where x is terminal
  1043.   NOTE: No production of the form Term -> x, where x is terminal
  1044.   NOTE: No production of the form TypItem -> x, where x is terminal
  1045.   NOTE: No production of the form Type -> x, where x is terminal
  1046.   NOTE: No production of the form Unary -> x, where x is terminal
  1047.   NOTE: No production of the form VList -> x, where x is terminal
  1048.   NOTE: No production of the form VRList -> x, where x is terminal
  1049.   NOTE: No production of the form VarExt -> x, where x is terminal
  1050.   NOTE: No production of the form VarExtension -> x, where x is terminal
  1051.   NOTE: No production of the form VarItem -> x, where x is terminal
  1052.   NOTE: No production of the form Variable -> x, where x is terminal
  1053.  
  1054. No errors or warnings.
  1055.  
  1056.