
  1. <adventure> = <optional_options> <units> <start> 
                 ;

  2. <optional_options> = 
  3.                    ! 'OPTIONS' <options> 
                        ;

  4. <options> = <option> 
  5.           ! <options> <option> 
               ;

  6. <option> = ID '.' 
  7.          ! ID ID '.' 
  8.          ! ID Integer '.' 
              ;

  9. <units> = <unit> 
 10.         ! <units> <unit> 
             ;

 11. <unit> = <default> 
 12.        ! <object_default> 
 13.        ! <location_default> 
 14.        ! <actor_default> 
 15.        ! <messages> 
 16.        ! <rule> 
 17.        ! <synonyms> 
 18.        ! <syntax> 
 19.        ! <verb> 
 20.        ! <location> 
 21.        ! <object> 
 22.        ! <container> 
 23.        ! <actor> 
 24.        ! <event> 
            ;

 25. <default> = 'DEFAULT' 'ATTRIBUTES' <attributes> 
               ;

 26. <location_default> = 'LOCATION' 'ATTRIBUTES' <attributes> 
                        ;

 27. <object_default> = 'OBJECT' 'ATTRIBUTES' <attributes> 
                      ;

 28. <actor_default> = 'ACTOR' 'ATTRIBUTES' <attributes> 
                     ;

 29. <attributes> = <attribute> '.' 
 30.              ! <attributes> <attribute> '.' 
                  ;

 31. <attribute> = ID 
 32.             ! 'NOT' ID 
 33.             ! ID <optional_minus> Integer 
 34.             ! ID STRING 
                 ;

 35. <synonyms> = 'SYNONYMS' <synonym_list> 
                ;

 36. <synonym_list> = <synonym> 
 37.                ! <synonym_list> <synonym> 
                    ;

 38. <synonym> = <id_list> '=' ID '.' 
               ;

 39. <messages> = 'MESSAGE' <message_list> 
                ;

 40. <message_list> = <message> 
 41.                ! <message_list> <message> 
                    ;

 42. <message> = ID ':' <statements> 
               ;

 43. <syntax> = 'SYNTAX' <syntax_list> 
              ;

 44. <syntax_list> = <syntax_item> 
 45.               ! <syntax_list> <syntax_item> 
                   ;

 46. <syntax_item> = ID '=' <syntax_elements> <optional_class_restrictions> 
                   ;

 47. <syntax_elements> = <syntax_element> 
 48.                   ! <syntax_elements> <syntax_element> 
                       ;

 49. <syntax_element> = ID 
 50.                  ! '(' ID ')' <optional_indicators> 
                      ;

 51. <optional_indicators> = 
 52.                       ! <optional_indicators> <indicator> 
                           ;

 53. <indicator> = '*' 
 54.             ! '!' 
                 ;

 55. <optional_class_restrictions> = '.' 
 56.                               ! 'WHERE' <class_restrictions> 
                                   ;

 57. <class_restrictions> = <class_restriction> 
 58.                      ! <class_restrictions> 'AND' <class_restriction> 
                          ;

 59. <class_restriction> = ID 'ISA' <classes> 'ELSE' <statements> 
                         ;

 60. <classes> = <class_identifier> 
 61.           ! <classes> 'OR' <class_identifier> 
               ;

 62. <class_identifier> = 'OBJECT' 
 63.                    ! 'ACTOR' 
 64.                    ! 'CONTAINER' 
 65.                    ! 'INTEGER' 
 66.                    ! 'STRING' 
 67.                    ! 'CONTAINER' 'OBJECT' 
 68.                    ! 'CONTAINER' 'ACTOR' 
                        ;

 69. <optional_verbs> = 
 70.                  ! <optional_verbs> <verb> 
                      ;

 71. <verb> = <verb_header> <verb_body> <verb_tail> 
            ;

 72. <verb_header> = 'VERB' <id_list> 
                   ;

 73. <verb_body> = <simple_verb_body> 
 74.             ! <verb_alternatives> 
                 ;

 75. <verb_alternatives> = <verb_alternative> 
 76.                     ! <verb_alternatives> <verb_alternative> 
                         ;

 77. <verb_alternative> = 'WHEN' ID <simple_verb_body> 
                        ;

 78. <simple_verb_body> = <optional_checks> <optional_does> 
                        ;

 79. <verb_tail> = 'END' 'VERB' <optional_id> '.' 
                 ;

 80. <optional_checks> = 
 81.                   ! 'CHECK' <statements> 
 82.                   ! 'CHECK' <check_list> 
                       ;

 83. <check_list> = <check> 
 84.              ! <check_list> 'AND' <check> 
                  ;

 85. <check> = <expression> 'ELSE' <statements> 
             ;

 86. <optional_does> = 
 87.                 ! <does> 
                     ;

 88. <does> = 'DOES' <optional_qual> <statements> 
            ;

 89. <location> = <location_header> <location_body> <location_tail> 
                ;

 90. <location_header> = 'LOCATION' ID <optional_name> 
                       ;

 91. <location_body> = 
 92.                 ! <location_body> <location_body_part> 
                     ;

 93. <location_body_part> = <description> 
 94.                      ! <does> 
 95.                      ! <is> <attributes> 
 96.                      ! <exit> 
 97.                      ! <verb> 
                          ;

 98. <location_tail> = 'END' 'LOCATION' <optional_id> '.' 
                     ;

 99. <optional_exits> = 
100.                  ! <optional_exits> <exit> 
                      ;

101. <exit> = 'EXIT' <id_list> 'TO' ID <optional_exit_body> '.' 
            ;

102. <optional_exit_body> = 
103.                      ! <optional_checks> <optional_does> 'END' 'EXIT' 
                            <optional_id> 
                          ;

104. <object> = <object_header> <object_body> <object_tail> 
              ;

105. <object_header> = 'OBJECT' ID <optional_where> <optional_names> 
                       <optional_where> 
                     ;

106. <object_body> = 
107.               ! <object_body> <object_body_part> 
                   ;

108. <object_body_part> = <properties> 
109.                    ! <description> 
110.                    ! <article> 
111.                    ! <mentioned> 
112.                    ! <is> <attributes> 
113.                    ! <verb> 
                        ;

114. <object_tail> = 'END' 'OBJECT' <optional_id> '.' 
                   ;

115. <optional_attributes> = 
116.                       ! <optional_attributes> <is> <attributes> 
                           ;

117. <is> = 'IS' 
118.      ! 'ARE' 
119.      ! 'HAS' 
          ;

120. <optional_description> = 
121.                        ! <description> 
                            ;

122. <description> = 'DESCRIPTION' 
123.               ! 'DESCRIPTION' <statements> 
                   ;

124. <article> = 'ARTICLE' 
125.           ! 'ARTICLE' <statements> 
               ;

126. <mentioned> = 'MENTIONED' <statements> 
                 ;

127. <optional_name> = 
128.                 ! <name> 
                     ;

129. <optional_names> = 
130.                  ! <optional_names> <name> 
                      ;

131. <name> = 'NAME' <ids> 
            ;

132. <properties> = 'CONTAINER' <container_body> 
                  ;

133. <container> = <container_header> <container_body> <container_tail> 
                 ;

134. <container_header> = 'CONTAINER' ID 
                        ;

135. <container_body> = <optional_limits> <optional_header> <optional_empty> 
                      ;

136. <container_tail> = 'END' 'CONTAINER' <optional_id> '.' 
                      ;

137. <optional_limits> = 
138.                   ! 'LIMITS' <limits> 
                       ;

139. <limits> = <limit> 
140.          ! <limits> <limit> 
              ;

141. <limit> = <limit_attribute> 'THEN' <statements> 
             ;

142. <limit_attribute> = <attribute> 
143.                   ! 'COUNT' Integer 
                       ;

144. <optional_header> = 
145.                   ! 'HEADER' <statements> 
                       ;

146. <optional_empty> = 
147.                  ! 'ELSE' <statements> 
                      ;

148. <event> = <event_header> <statements> <event_tail> 
             ;

149. <event_header> = 'EVENT' ID 
                    ;

150. <event_tail> = 'END' 'EVENT' <optional_id> '.' 
                  ;

151. <actor> = <actor_header> <actor_body> <actor_tail> 
             ;

152. <actor_header> = 'ACTOR' ID <optional_where> <optional_names> 
                      <optional_where> 
                    ;

153. <actor_body> = 
154.              ! <actor_body> <actor_body_part> 
                  ;

155. <actor_body_part> = <properties> 
156.                   ! <description> 
157.                   ! <is> <attributes> 
158.                   ! <verb> 
159.                   ! <script> 
                       ;

160. <actor_tail> = 'END' 'ACTOR' <optional_id> '.' 
                  ;

161. <optional_actor_script> = 
162.                         ! <optional_actor_script> <script> 
                             ;

163. <script> = 'SCRIPT' <integer_or_id> '.' <optional_description> 
                <step_list> 
              ;

164. <step_list> = <step> 
165.             ! <step_list> <step> 
                 ;

166. <step> = 'STEP' <statements> 
167.        ! 'STEP' 'AFTER' Integer <statements> 
168.        ! 'STEP' 'WAIT' 'UNTIL' <expression> <statements> 
            ;

169. <rule> = 'WHEN' <expression> '=>' <statements> 
            ;

170. <start> = 'START' <where> '.' <optional_statements> 
             ;

171. <optional_statements> = 
172.                       ! <statements> 
                           ;

173. <statements> = <statement> 
174.              ! <statements> <statement> 
                  ;

175. <statement> = <output_statement> 
176.             ! <special_statement> 
177.             ! <manipulation_statement> 
178.             ! <event_statement> 
179.             ! <assignment_statement> 
180.             ! <actor_statement> 
181.             ! <comparison_statement> 
                 ;

182. <output_statement> = STRING 
183.                    ! 'DESCRIBE' <what> '.' 
184.                    ! 'SAY' <expression> '.' 
185.                    ! 'LIST' <what> '.' 
                        ;

186. <special_statement> = 'QUIT' '.' 
187.                     ! 'LOOK' '.' 
188.                     ! 'SAVE' '.' 
189.                     ! 'RESTORE' '.' 
190.                     ! 'RESTART' '.' 
191.                     ! 'SCORE' <optional_integer> '.' 
192.                     ! 'VISITS' Integer '.' 
193.                     ! 'SYSTEM' STRING '.' 
                         ;

194. <manipulation_statement> = 'EMPTY' <what> <optional_where> '.' 
195.                          ! 'LOCATE' <what> <where> '.' 
                              ;

196. <event_statement> = 'CANCEL' ID '.' 
197.                   ! 'SCHEDULE' ID <optional_where> 'AFTER' <expression> 
                         '.' 
                       ;

198. <assignment_statement> = 'MAKE' <what> <something> '.' 
199.                        ! 'INCREASE' <attribute_reference> 
                              <optional_by_clause> '.' 
200.                        ! 'DECREASE' <attribute_reference> 
                              <optional_by_clause> '.' 
201.                        ! 'SET' <attribute_reference> 'TO' <expression> 
                              '.' 
                            ;

202. <optional_by_clause> = 
203.                      ! 'BY' <expression> 
                          ;

204. <comparison_statement> = <if_statement> 
205.                        ! <depending_statement> 
                            ;

206. <if_statement> = 'IF' <expression> 'THEN' <statements> 
                      <optional_elsif_list> <optional_else_part> 'END' 'IF' 
                      '.' 
                    ;

207. <optional_elsif_list> = 
208.                       ! <elsif_list> 
                           ;

209. <elsif_list> = 'ELSIF' <expression> 'THEN' <statements> 
210.              ! <elsif_list> 'ELSIF' <expression> 'THEN' <statements> 
                  ;

211. <optional_else_part> = 
212.                      ! 'ELSE' <statements> 
                          ;

213. <depending_statement> = 'DEPENDING' 'ON' <primary> <depend_cases> 'END' 
                             'DEPEND' '.' 
                           ;

214. <depend_cases> = <depend_case> 
215.                ! <depend_cases> <depend_case> 
                    ;

216. <depend_case> = 'ELSE' <statements> 
217.               ! <right_hand_side> ':' <statements> 
                   ;

218. <actor_statement> = 'USE' 'SCRIPT' <integer_or_id> <optional_for_actor> 
                         '.' 
                       ;

219. <optional_for_actor> = 
220.                      ! 'FOR' ID 
                          ;

221. <expression> = <term> 
222.              ! <expression> 'OR' <term> 
                  ;

223. <term> = <factor> 
224.        ! <term> 'AND' <factor> 
            ;

225. <factor> = <primary> 
226.          ! <primary> <right_hand_side> 
              ;

227. <right_hand_side> = <optional_not> <where> 
228.                   ! <binop> <primary> 
229.                   ! <optional_not> <relop> <primary> 
230.                   ! <is> <something> 
231.                   ! <optional_not> 'CONTAINS' <factor> 
232.                   ! <optional_not> 'BETWEEN' <factor> 'AND' <factor> 
                       ;

233. <primary> = <optional_minus> Integer 
234.           ! STRING 
235.           ! <what> 
236.           ! 'SCORE' 
237.           ! <aggregate> <where> 
238.           ! '(' <expression> ')' 
239.           ! <attribute_reference> 
240.           ! 'RANDOM' <primary> 'TO' <primary> 
               ;

241. <aggregate> = 'COUNT' 
242.             ! 'SUM' 'OF' ID 
243.             ! 'MAX' 'OF' ID 
                 ;

244. <something> = <optional_not> ID 
                 ;

245. <what> = 'OBJECT' 
246.        ! 'LOCATION' 
247.        ! 'ACTOR' 
248.        ! ID 
            ;

249. <optional_where> = 
250.                  ! <where> 
                      ;

251. <where> = 'HERE' 
252.         ! 'NEARBY' 
253.         ! 'AT' <what> 
254.         ! 'IN' <what> 
             ;

255. <binop> = '+' 
256.         ! '-' 
257.         ! '*' 
258.         ! '/' 
             ;

259. <relop> = '<>' 
260.         ! '=' 
261.         ! '==' 
262.         ! '>=' 
263.         ! '<=' 
264.         ! '>' 
265.         ! '<' 
             ;

266. <optional_qual> = 
267.                 ! 'BEFORE' 
268.                 ! 'AFTER' 
269.                 ! 'ONLY' 
                     ;

270. <optional_not> = 
271.                ! 'NOT' 
                    ;

272. <optional_id> = 
273.               ! ID 
                   ;

274. <ids> = ID 
275.       ! <ids> ID 
           ;

276. <id_list> = ID 
277.           ! <id_list> ',' ID 
               ;

278. <optional_integer> = 
279.                    ! Integer 
                        ;

280. <optional_minus> = 
281.                  ! '-' 
                      ;

282. <attribute_reference> = ID 'OF' <what> 
                           ;

283. <integer_or_id> = Integer 
284.                 ! ID 
                     ;

285. ID = IDENT 
286.    ! 'DEFAULT' 
287.    ! 'ARTICLE' 
288.    ! 'MESSAGE' 
289.    ! 'QUIT' 
290.    ! 'SAVE' 
291.    ! 'RESTORE' 
292.    ! 'RESTART' 
293.    ! 'WAIT' 
294.    ! 'BETWEEN' 
295.    ! 'CONTAINS' 
296.    ! 'ON' 
297.    ! 'IN' 
298.    ! 'AFTER' 
299.    ! 'BEFORE' 
300.    ! 'CHECK' 
301.    ! 'DEPEND' 
302.    ! 'EXIT' 
303.    ! 'FOR' 
304.    ! 'INTEGER' 
305.    ! 'ISA' 
306.    ! 'LIMITS' 
        ;

*******  Shift-Reduce conflict in state  121 Symbol: 'DEFAULT' Production:   25
         Resolved by modification (Reduce:   25)
*******  Shift-Reduce conflict in state  121 Symbol: 'MESSAGE' Production:   25
         Resolved by modification (Reduce:   25)
*******  Shift-Reduce conflict in state  129 Symbol: 'DEFAULT' Production:   27
         Resolved by modification (Reduce:   27)
*******  Shift-Reduce conflict in state  129 Symbol: 'MESSAGE' Production:   27
         Resolved by modification (Reduce:   27)
*******  Shift-Reduce conflict in state  130 Symbol: 'HERE' Production:  249
         Resolved by modification (Shift: 'HERE')
*******  Shift-Reduce conflict in state  130 Symbol: 'NEARBY' Production:  249
         Resolved by modification (Shift: 'NEARBY')
*******  Shift-Reduce conflict in state  130 Symbol: 'AT' Production:  249
         Resolved by modification (Shift: 'AT')
*******  Shift-Reduce conflict in state  130 Symbol: 'IN' Production:  249
         Resolved by modification (Shift: 'IN')
*******  Shift-Reduce conflict in state  134 Symbol: 'ARTICLE' Production:  131
         Resolved by modification (Reduce:  131)
*******  Shift-Reduce conflict in state  134 Symbol: 'IN' Production:  131
         Resolved by modification (Reduce:  131)
*******  Shift-Reduce conflict in state  134 Symbol: 'EXIT' Production:  131
         Resolved by modification (Reduce:  131)
*******  Shift-Reduce conflict in state  137 Symbol: 'DEFAULT' Production:   26
         Resolved by modification (Reduce:   26)
*******  Shift-Reduce conflict in state  137 Symbol: 'MESSAGE' Production:   26
         Resolved by modification (Reduce:   26)
*******  Shift-Reduce conflict in state  141 Symbol: 'DEFAULT' Production:   28
         Resolved by modification (Reduce:   28)
*******  Shift-Reduce conflict in state  141 Symbol: 'MESSAGE' Production:   28
         Resolved by modification (Reduce:   28)
*******  Shift-Reduce conflict in state  142 Symbol: 'HERE' Production:  249
         Resolved by modification (Shift: 'HERE')
*******  Shift-Reduce conflict in state  142 Symbol: 'NEARBY' Production:  249
         Resolved by modification (Shift: 'NEARBY')
*******  Shift-Reduce conflict in state  142 Symbol: 'AT' Production:  249
         Resolved by modification (Shift: 'AT')
*******  Shift-Reduce conflict in state  142 Symbol: 'IN' Production:  249
         Resolved by modification (Shift: 'IN')
*******  Shift-Reduce conflict in state  146 Symbol: 'DEFAULT' Production:   39
         Resolved by modification (Reduce:   39)
*******  Shift-Reduce conflict in state  146 Symbol: 'MESSAGE' Production:   39
         Resolved by modification (Reduce:   39)
*******  Shift-Reduce conflict in state  149 Symbol: 'QUIT' Production:   42
         Resolved by modification (Shift: 'QUIT')
*******  Shift-Reduce conflict in state  149 Symbol: 'SAVE' Production:   42
         Resolved by modification (Shift: 'SAVE')
*******  Shift-Reduce conflict in state  149 Symbol: 'RESTORE' Production:   42
         Resolved by modification (Shift: 'RESTORE')
*******  Shift-Reduce conflict in state  149 Symbol: 'RESTART' Production:   42
         Resolved by modification (Shift: 'RESTART')
*******  Shift-Reduce conflict in state  155 Symbol: 'DEFAULT' Production:   35
         Resolved by modification (Reduce:   35)
*******  Shift-Reduce conflict in state  155 Symbol: 'MESSAGE' Production:   35
         Resolved by modification (Reduce:   35)
*******  Shift-Reduce conflict in state  161 Symbol: 'DEFAULT' Production:   43
         Resolved by modification (Reduce:   43)
*******  Shift-Reduce conflict in state  161 Symbol: 'MESSAGE' Production:   43
         Resolved by modification (Reduce:   43)
*******  Shift-Reduce conflict in state  172 Symbol: 'QUIT' Production:   59
         Resolved by modification (Shift: 'QUIT')
*******  Shift-Reduce conflict in state  172 Symbol: 'SAVE' Production:   59
         Resolved by modification (Shift: 'SAVE')
*******  Shift-Reduce conflict in state  172 Symbol: 'RESTORE' Production:   59
         Resolved by modification (Shift: 'RESTORE')
*******  Shift-Reduce conflict in state  172 Symbol: 'RESTART' Production:   59
         Resolved by modification (Shift: 'RESTART')
*******  Shift-Reduce conflict in state  214 Symbol: 'EXIT' Production:   95
         Resolved by modification (Reduce:   95)
*******  Shift-Reduce conflict in state  237 Symbol: 'ARTICLE' Production:  138
         Resolved by modification (Reduce:  138)
*******  Shift-Reduce conflict in state  240 Symbol: 'QUIT' Production:  141
         Resolved by modification (Shift: 'QUIT')
*******  Shift-Reduce conflict in state  240 Symbol: 'SAVE' Production:  141
         Resolved by modification (Shift: 'SAVE')
*******  Shift-Reduce conflict in state  240 Symbol: 'RESTORE' Production:  141
         Resolved by modification (Shift: 'RESTORE')
*******  Shift-Reduce conflict in state  240 Symbol: 'RESTART' Production:  141
         Resolved by modification (Shift: 'RESTART')
*******  Shift-Reduce conflict in state  247 Symbol: 'ARTICLE' Production:  112
         Resolved by modification (Reduce:  112)
*******  Shift-Reduce conflict in state  282 Symbol: 'DEFAULT' Production:    3
         Resolved by modification (Reduce:    3)
*******  Shift-Reduce conflict in state  282 Symbol: 'MESSAGE' Production:    3
         Resolved by modification (Reduce:    3)


