1 package org.simantics.scl.compiler.internal.parsing.parser;
3 import java.io.DataInputStream;
4 import java.io.IOException;
5 import java.util.ArrayList;
6 import java.util.Arrays;
7 import java.util.Collections;
8 import org.simantics.scl.compiler.internal.parsing.exceptions.SCLSyntaxErrorException;
10 import org.simantics.scl.compiler.internal.parsing.Token;
12 public abstract class SCLParser {
13 public static final boolean TRACE = false;
15 private static final int INITIAL_CAPACITY = 16;
16 private static final int STATE_COUNT = 363;
17 private static final int TERMINAL_COUNT = 86;
18 private static final int NONTERMINAL_COUNT = 52;
19 private static final int PRODUCT_COUNT = 139;
21 private static final int[] ACTION_ROW_ID = new int[STATE_COUNT];
22 private static final int[] ACTION_COLUMN_ID = new int[TERMINAL_COUNT];
23 private static final short[] ACTION_TABLE = new short[6765];
24 private static final int[] ERROR_TABLE = new int[976];
25 private static final int[] GOTO_ROW_ID = new int[STATE_COUNT];
26 private static final int[] GOTO_COLUMN_ID = new int[NONTERMINAL_COUNT];
27 private static final short[] GOTO_TABLE = new short[1953];
28 private static final int[] PRODUCT_LHS = new int[PRODUCT_COUNT];
30 private static final short STATE_MASK = (short)0x0fff;
31 private static final short REDUCE_MASK = (short)0x8000;
32 private static final short POP_MASK = (short)0x4000;
33 private static final short PUSH_MASK = (short)0x2000;
34 private static final short ERROR_ACTION = (short)0xffff;
35 private static final short ACCEPT_ACTION = (short)0xfffe;
37 public static final String[] TERMINAL_NAMES = new String[] {
126 public static final String[] NONTERMINAL_NAMES = new String[] {
163 "symbolWithoutMinus",
183 DataInputStream input = new DataInputStream(SCLParser.class.getResourceAsStream("SCLParser.dat"));
184 for(int i=0;i<ACTION_ROW_ID.length;++i)
185 ACTION_ROW_ID[i] = input.readInt();
186 for(int i=0;i<ACTION_COLUMN_ID.length;++i)
187 ACTION_COLUMN_ID[i] = input.readInt();
188 for(int i=0;i<ACTION_TABLE.length;++i)
189 ACTION_TABLE[i] = input.readShort();
190 for(int i=0;i<ERROR_TABLE.length;++i)
191 ERROR_TABLE[i] = input.readInt();
192 for(int i=0;i<GOTO_ROW_ID.length;++i)
193 GOTO_ROW_ID[i] = input.readInt();
194 for(int i=0;i<GOTO_COLUMN_ID.length;++i)
195 GOTO_COLUMN_ID[i] = input.readInt();
196 for(int i=0;i<GOTO_TABLE.length;++i)
197 GOTO_TABLE[i] = input.readShort();
198 for(int i=0;i<PRODUCT_LHS.length;++i)
199 PRODUCT_LHS[i] = input.readInt();
201 } catch(IOException e) {
206 private static short getAction(int state, int symbol) {
207 int id = TERMINAL_COUNT*state + symbol;
208 if( ((ERROR_TABLE[id>>5] >> (id&31))&1) != 0 )
210 return ACTION_TABLE[ACTION_ROW_ID[state] + ACTION_COLUMN_ID[symbol]];
213 private static short getGoto(int state, int symbol) {
214 return GOTO_TABLE[GOTO_ROW_ID[state] + GOTO_COLUMN_ID[symbol]];
217 protected abstract Token nextToken();
219 private Object[] symbolStack = new Object[INITIAL_CAPACITY];
220 private int symbolStackLength = 0;
222 private int[] stateStack = new int[INITIAL_CAPACITY];
223 private int[] symbolStackPositionStack = new int[INITIAL_CAPACITY];
224 private int stateStackLength = 0;
227 private int reductionLength;
229 protected int length() {
230 return reductionLength;
233 protected Object get(int i) {
234 if(i < 0 || i >= reductionLength)
235 throw new IndexOutOfBoundsException();
236 return symbolStack[symbolStackLength+i];
239 private String parseErrorDescription(int state, Token token, int tokenId) {
240 StringBuilder b = new StringBuilder();
241 b.append("Unexpected token '").append(token)
242 .append("' (").append(TERMINAL_NAMES[tokenId])
243 .append("). Expected one of ");
244 ArrayList<String> possibleTerminals = new ArrayList<String>();
245 for(int i=0;i<TERMINAL_COUNT;++i)
246 if(getAction(state, i) != ERROR_ACTION)
247 possibleTerminals.add(TERMINAL_NAMES[i]);
248 Collections.sort(possibleTerminals);
249 for(int i=0;i<possibleTerminals.size();++i) {
252 b.append(possibleTerminals.get(i));
258 protected abstract RuntimeException syntaxError(Token token, String description);
260 private static String describeAction(boolean isGoto, int action) {
261 if(action == ERROR_ACTION)
263 if(action == ACCEPT_ACTION)
265 StringBuilder b = new StringBuilder();
269 if((action & REDUCE_MASK) != 0) {
270 action ^= REDUCE_MASK;
276 if((action & POP_MASK) != 0) {
280 if((action & PUSH_MASK) != 0) {
284 b.append(' ').append(action);
288 private void printState(int state) {
289 System.out.print("state=" + state + ":");
290 for(int i=symbolStackLength-1,j=stateStackLength-1;i>=0;--i) {
291 Object s = symbolStack[i];
292 if(s instanceof Token)
293 System.out.print(" " + TERMINAL_NAMES[((Token)s).id]);
295 System.out.print(" null");
297 System.out.print(" " + s.getClass().getSimpleName());
298 while(j>=0 && symbolStackPositionStack[j]==i)
299 System.out.print(" (" + stateStack[j--] + ")");
301 System.out.println();
304 private Object parse(int state) {
306 Token token = nextToken();
307 int tokenId = token.id;
309 System.out.println("---> token " + TERMINAL_NAMES[tokenId] + " \"" + token.text + "\" <---");
313 short action = getAction(state, tokenId);
315 System.out.println(" -> action=" + describeAction(false, action));
316 //System.out.println(STATE_DESCRIPTIONS[state]);
317 if((action & REDUCE_MASK) != 0) {
318 if(action == ACCEPT_ACTION)
319 return symbolStack[symbolStackLength-1];
320 if(action == ERROR_ACTION)
321 throw syntaxError(token, parseErrorDescription(state, token, tokenId));
322 int popAmount = (action >>> 13)&3;
325 System.out.println(" POP " + popAmount);
327 stateStackLength -= popAmount;
328 action &= STATE_MASK;
330 int reductionBegin = symbolStackPositionStack[--stateStackLength];
332 reductionLength = symbolStackLength-reductionBegin;
333 symbolStackLength = reductionBegin;
335 if(symbolStackLength == symbolStack.length)
336 symbolStack = Arrays.copyOf(symbolStack, symbolStackLength*2);
337 Object symbol = reduce(action);
339 symbolStack[symbolStackLength] = symbol;
341 state = stateStack[stateStackLength];
346 System.out.println(" nonterminal=" + NONTERMINAL_NAMES[PRODUCT_LHS[action]]);
348 action = getGoto(state, PRODUCT_LHS[action]);
350 System.out.println(" -> action=" + describeAction(true, action));
353 if((action & POP_MASK) != 0) {
357 if((action & PUSH_MASK) != 0) {
358 if(stateStackLength == stateStack.length) {
359 stateStack = Arrays.copyOf(stateStack, stateStackLength*2);
360 symbolStackPositionStack = Arrays.copyOf(symbolStackPositionStack, stateStackLength*2);
362 symbolStackPositionStack[stateStackLength] = symbolStackLength;
363 stateStack[stateStackLength++] = state;
365 state = action & STATE_MASK;
370 if((action & POP_MASK) != 0) {
374 if((action & PUSH_MASK) != 0) {
375 if(stateStackLength == stateStack.length) {
376 stateStack = Arrays.copyOf(stateStack, stateStackLength*2);
377 symbolStackPositionStack = Arrays.copyOf(symbolStackPositionStack, stateStackLength*2);
379 symbolStackPositionStack[stateStackLength] = symbolStackLength;
380 stateStack[stateStackLength++] = state;
384 state = action & STATE_MASK;
387 if(symbolStackLength == symbolStack.length)
388 symbolStack = Arrays.copyOf(symbolStack, symbolStackLength*2);
389 symbolStack[symbolStackLength++] = token;
396 public Object parseModule() {
399 public Object parseCommands() {
402 public Object parseImport() {
405 public Object parseType() {
408 public Object parseExp() {
411 public Object parseEquationBlock() {
416 protected Object reduce(int productionId) {
418 switch(productionId) {
420 return reduceModule();
422 return reduceOneCommand();
424 return reduceManyCommands();
426 return reduceImport();
428 return reduceArrow();
430 return reduceLocalTypeAnnotation();
432 return reduceEquationBlock();
434 return reduceModuleHeader();
436 return reduceTypeAnnotation();
438 return reduceValueDefinition();
440 return reduceDataDefinition();
442 return reduceTypeDefinition();
444 return reduceClassDefinition();
446 return reduceInstanceDefinition();
448 return reduceDerivingInstanceDefinition();
450 return reduceDocumentationString();
452 return reduceAnnotation();
454 return reducePrecedenceDefinition();
456 return reduceJustImport();
458 return reduceImportJava();
460 return reduceEffectDefinition();
462 return reduceRuleDefinition();
464 return reduceMappingRelationDefinition();
466 return reduceRelationDefinition();
468 return reduceRulesetDefinition();
470 return reduceStatementCommand();
472 return reduceImportCommand();
474 return reduceGuardStatement();
476 return reduceLetStatement();
478 return reduceBindStatement();
480 return reduceRuleStatement();
482 return reduceCHRStatement();
484 return reduceVerboseCHRStatement();
486 return reduceConstraintStatement();
488 return reduceLocalInclude();
490 return reduceDeclarations();
492 return reduceField();
494 return reduceFieldShorthand();
496 return reduceWildcard();
498 return reduceVarId();
500 return reduceEscapedSymbol();
502 return reduceTupleConstructor();
504 return reduceBinary();
506 return reduceSimpleRhs();
508 return reduceGuardedRhs();
510 return reduceConstructor();
512 return reduceRecordConstructor();
514 return reduceContext();
516 return reduceFundeps();
518 return reduceTypeVar();
520 return reduceTupleType();
522 return reduceListType();
524 return reduceListTypeConstructor();
526 return reduceTupleTypeConstructor();
528 return reduceLambda();
530 return reduceLambdaMatch();
536 return reduceMatch();
540 return reduceSelect();
542 return reduceCHRSelect();
544 return reduceEnforce();
548 return reduceHashedId();
550 return reduceBlank();
552 return reduceInteger();
554 return reduceFloat();
556 return reduceString();
560 return reduceTuple();
562 return reduceViewPattern();
564 return reduceRightSection();
566 return reduceLeftSection();
568 return reduceListLiteral();
570 return reduceRange();
572 return reduceListComprehension();
576 return reduceRecord();
578 return reduceTransformation();
582 return reduceRuleDeclarations();
584 return reduceStatements();
586 return reduceImportShowing();
588 return reduceImportHiding();
590 return reduceImportValueItem();
592 return reduceFieldDescription();
594 return reduceGuardedExpEq();
596 return reduceFundep();
598 return reduceQueryRuleDeclaration();
600 return reduceAnnotation();
602 return reduceGuardQuery();
604 return reduceEqualsQuery();
606 return reduceBindQuery();
608 return reduceCompositeQuery();
610 return reduceApply();
612 return reduceSymbol();
614 return reduceEscapedId();
616 return reduceMinus();
620 return reduceGreater();
624 return reduceFieldAccess();
626 return reduceIdAccessor();
628 return reduceStringAccessor();
630 return reduceExpAccessor();
634 return reduceQueryBlock();
636 return reduceVerboseCHRConjunction();
638 return reduceStringLiteral();
640 return reduceSymbol();
642 return reduceEscapedId();
646 return reduceGreater();
650 return reduceGuardQualifier();
652 return reduceLetQualifier();
654 return reduceBindQualifier();
656 return reduceThenQualifier();
658 return reduceCHRConjunction();
660 return reduceCHRAtom();
662 return reduceCHREquals();
664 return reduceCHRBinds();
666 return reduceSimpleCaseRhs();
668 return reduceGuardedCaseRhs();
670 return reduceGuardedExpArrow();
672 return reduceGuardEquation();
674 return reduceBasicEquation();
676 return reduceEffect();
678 return reduceJustEtype();
680 return reduceForAll();
682 return reduceApplyType();
684 return reduceDummy();
687 throw new RuntimeException("Internal parser error.");
689 } catch(SCLSyntaxErrorException e) {
690 StringBuilder b = new StringBuilder();
691 b.append("Failed to reduce");
692 for(int i=0;i<length();++i) {
694 b.append("\n (").append(i).append(") \"").append(obj).append('\"');
695 if(obj instanceof Token)
696 b.append(" (").append(TERMINAL_NAMES[((Token)obj).id]).append(")");
698 b.append(" [").append(obj.getClass().getSimpleName()).append("]");
700 throw new RuntimeException(b.toString(), e);
705 * module ::= (declaration (SEMICOLON declaration)*)?
707 protected abstract Object reduceModule();
709 * commands ::= command?
711 protected abstract Object reduceOneCommand();
713 * commands ::= commands SEMICOLON command
715 protected abstract Object reduceManyCommands();
717 * import ::= (IMPORT | INCLUDE) BEGIN_STRING END_STRING (AS ID)? importSpec?
719 protected abstract Object reduceImport();
721 * type ::= (etype (ARROW | IMPLIES))* etype
723 protected abstract Object reduceArrow();
725 * exp ::= bexp (HASTYPE type)?
727 protected abstract Object reduceLocalTypeAnnotation();
729 * equationBlock ::= (equation (SEMICOLON equation)*)?
731 protected abstract Object reduceEquationBlock();
733 * declaration ::= MODULE LBRACE (field (COMMA field)*)? RBRACE
735 protected abstract Object reduceModuleHeader();
737 * declaration ::= (var COMMA)* var HASTYPE type
739 protected abstract Object reduceTypeAnnotation();
741 * declaration ::= bexp rhs
743 protected abstract Object reduceValueDefinition();
745 * declaration ::= DATA ID ID* (EQUALS (constructor BAR)* constructor)?
747 protected abstract Object reduceDataDefinition();
749 * declaration ::= TYPE ID ID* EQUALS type
751 protected abstract Object reduceTypeDefinition();
753 * declaration ::= CLASS context? ID ID* (BAR fundeps | (BAR fundeps)? WHERE declarations)?
755 protected abstract Object reduceClassDefinition();
757 * declaration ::= INSTANCE context? ID atype atype* (WHERE declarations)?
759 protected abstract Object reduceInstanceDefinition();
761 * declaration ::= DERIVING INSTANCE context? ID atype atype*
763 protected abstract Object reduceDerivingInstanceDefinition();
765 * declaration ::= BEGIN_STRING END_STRING
767 protected abstract Object reduceDocumentationString();
769 * declaration ::= ANNOTATION_ID aexp*
771 protected abstract Object reduceAnnotation();
773 * declaration ::= (INFIX | INFIXL | INFIXR) INTEGER (var COMMA)* var
775 protected abstract Object reducePrecedenceDefinition();
777 * declaration ::= import
779 protected abstract Object reduceJustImport();
781 * declaration ::= IMPORTJAVA BEGIN_STRING END_STRING WHERE declarations
783 protected abstract Object reduceImportJava();
785 * declaration ::= EFFECT ID BEGIN_STRING END_STRING BEGIN_STRING END_STRING
787 protected abstract Object reduceEffectDefinition();
789 * declaration ::= (RULE | ABSTRACT_RULE) ID (EXTENDS (ID COMMA)* ID)? WHERE ruleDeclarations
791 protected abstract Object reduceRuleDefinition();
793 * declaration ::= MAPPING_RELATION ID atype*
795 protected abstract Object reduceMappingRelationDefinition();
797 * declaration ::= bexp FOLLOWS ruleDeclarations
799 protected abstract Object reduceRelationDefinition();
801 * declaration ::= RULESET ID WHERE statements
803 protected abstract Object reduceRulesetDefinition();
805 * command ::= statement
807 protected abstract Object reduceStatementCommand();
811 protected abstract Object reduceImportCommand();
815 protected abstract Object reduceGuardStatement();
817 * statement ::= exp rhs
819 protected abstract Object reduceLetStatement();
821 * statement ::= exp BINDS exp
823 protected abstract Object reduceBindStatement();
825 * statement ::= exp FOLLOWS queryBlock
827 protected abstract Object reduceRuleStatement();
829 * statement ::= chrQuery IMPLIES chrQuery
831 protected abstract Object reduceCHRStatement();
833 * statement ::= WHEN verboseChrQuery THEN_AFTER_WHEN verboseChrQuery
835 protected abstract Object reduceVerboseCHRStatement();
837 * statement ::= CONSTRAINT constructor
839 protected abstract Object reduceConstraintStatement();
841 * statement ::= INCLUDE ID aexp
843 protected abstract Object reduceLocalInclude();
845 * declarations ::= LBRACE (declaration (SEMICOLON (declaration SEMICOLON)* declaration)?)? RBRACE
847 protected abstract Object reduceDeclarations();
849 * field ::= ID EQUALS exp
851 protected abstract Object reduceField();
855 protected abstract Object reduceFieldShorthand();
859 protected abstract Object reduceWildcard();
863 protected abstract Object reduceVarId();
865 * var ::= ESCAPED_SYMBOL
867 protected abstract Object reduceEscapedSymbol();
869 * var ::= LPAREN COMMA COMMA* RPAREN
871 protected abstract Object reduceTupleConstructor();
873 * bexp ::= MINUS? lexp (symbol lexp)*
875 protected abstract Object reduceBinary();
877 * rhs ::= EQUALS exp (WHERE statements)?
879 protected abstract Object reduceSimpleRhs();
881 * rhs ::= guardedExpEq guardedExpEq* (WHERE statements)?
883 protected abstract Object reduceGuardedRhs();
885 * constructor ::= (ANNOTATION_ID aexp)* ID atype*
887 protected abstract Object reduceConstructor();
889 * constructor ::= (ANNOTATION_ID aexp)* ID LBRACE fieldDeclaration (COMMA fieldDeclaration)* RBRACE
891 protected abstract Object reduceRecordConstructor();
893 * context ::= LPAREN type (COMMA type)* RPAREN IMPLIES
895 protected abstract Object reduceContext();
897 * fundeps ::= (fundep COMMA)* fundep
899 protected abstract Object reduceFundeps();
903 protected abstract Object reduceTypeVar();
905 * atype ::= LPAREN (type (COMMA (type COMMA)* type)?)? RPAREN
907 protected abstract Object reduceTupleType();
909 * atype ::= LBRACKET type RBRACKET
911 protected abstract Object reduceListType();
913 * atype ::= LBRACKET RBRACKET
915 protected abstract Object reduceListTypeConstructor();
917 * atype ::= LPAREN COMMA COMMA* RPAREN
919 protected abstract Object reduceTupleTypeConstructor();
921 * aexp ::= LAMBDA aexp aexp* ARROW exp
923 protected abstract Object reduceLambda();
925 * aexp ::= LAMBDA_MATCH LBRACE case (SEMICOLON case)* RBRACE
927 protected abstract Object reduceLambdaMatch();
929 * aexp ::= LET statements IN exp
931 protected abstract Object reduceLet();
933 * aexp ::= IF exp THEN exp (ELSE exp)?
935 protected abstract Object reduceIf();
937 * aexp ::= MATCH exp WITH LBRACE case (SEMICOLON case)* RBRACE
939 protected abstract Object reduceMatch();
941 * aexp ::= (DO | MDO | EDO) statements
943 protected abstract Object reduceDo();
945 * aexp ::= (SELECT | SELECT_FIRST | SELECT_DISTINCT) exp WHERE queryBlock
947 protected abstract Object reduceSelect();
949 * aexp ::= CHR_SELECT exp WHERE verboseChrQuery
951 protected abstract Object reduceCHRSelect();
953 * aexp ::= ENFORCE queryBlock
955 protected abstract Object reduceEnforce();
959 protected abstract Object reduceVar();
961 * aexp ::= ATTACHED_HASH ID
963 protected abstract Object reduceHashedId();
967 protected abstract Object reduceBlank();
971 protected abstract Object reduceInteger();
975 protected abstract Object reduceFloat();
977 * aexp ::= stringLiteral
979 protected abstract Object reduceString();
983 protected abstract Object reduceChar();
985 * aexp ::= LPAREN (exp (COMMA (exp COMMA)* exp)?)? RPAREN
987 protected abstract Object reduceTuple();
989 * aexp ::= LPAREN exp ARROW exp RPAREN
991 protected abstract Object reduceViewPattern();
993 * aexp ::= LPAREN symbolWithoutMinus lexp RPAREN
995 protected abstract Object reduceRightSection();
997 * aexp ::= LPAREN lexp symbol RPAREN
999 protected abstract Object reduceLeftSection();
1001 * aexp ::= LBRACKET (exp (COMMA (exp COMMA)* exp)?)? RBRACKET
1003 protected abstract Object reduceListLiteral();
1005 * aexp ::= LBRACKET exp DOTDOT exp RBRACKET
1007 protected abstract Object reduceRange();
1009 * aexp ::= LBRACKET exp BAR listQualifier (COMMA listQualifier)* RBRACKET
1011 protected abstract Object reduceListComprehension();
1013 * aexp ::= ID AT aexp
1015 protected abstract Object reduceAs();
1017 * aexp ::= ID LBRACE (field (COMMA field)*)? RBRACE
1019 protected abstract Object reduceRecord();
1021 * aexp ::= TRANSFORMATION ID WHERE queryBlock
1023 protected abstract Object reduceTransformation();
1025 * aexp ::= EQ LBRACE equationBlock RBRACE
1027 protected abstract Object reduceEq();
1029 * ruleDeclarations ::= LBRACE (ruleDeclaration (SEMICOLON (ruleDeclaration SEMICOLON)* ruleDeclaration)?)? RBRACE
1031 protected abstract Object reduceRuleDeclarations();
1033 * statements ::= LBRACE (statement (SEMICOLON (statement SEMICOLON)* statement)?)? RBRACE
1035 protected abstract Object reduceStatements();
1037 * importSpec ::= LPAREN (importItem (COMMA (importItem COMMA)* importItem)?)? RPAREN
1039 protected abstract Object reduceImportShowing();
1041 * importSpec ::= HIDING LPAREN (importItem (COMMA importItem)*)? RPAREN
1043 protected abstract Object reduceImportHiding();
1047 protected abstract Object reduceImportValueItem();
1049 * fieldDeclaration ::= ID HASTYPE type
1051 protected abstract Object reduceFieldDescription();
1053 * guardedExpEq ::= BAR exp (COMMA exp)* EQUALS exp
1055 protected abstract Object reduceGuardedExpEq();
1057 * fundep ::= ID ID* ARROW ID
1059 protected abstract Object reduceFundep();
1061 * ruleDeclaration ::= query
1063 protected abstract Object reduceQueryRuleDeclaration();
1067 protected abstract Object reduceGuardQuery();
1069 * query ::= exp EQUALS exp
1071 protected abstract Object reduceEqualsQuery();
1073 * query ::= exp BINDS exp
1075 protected abstract Object reduceBindQuery();
1077 * query ::= QUERY_OP queryBlock
1079 protected abstract Object reduceCompositeQuery();
1081 * lexp ::= faexp faexp*
1083 protected abstract Object reduceApply();
1087 protected abstract Object reduceSymbol();
1089 * symbol ::= ESCAPED_ID
1091 protected abstract Object reduceEscapedId();
1095 protected abstract Object reduceMinus();
1099 protected abstract Object reduceLess();
1101 * symbol ::= GREATER
1103 protected abstract Object reduceGreater();
1105 * symbol ::= SEPARATED_DOT
1107 protected abstract Object reduceDot();
1109 * faexp ::= aexp ((ATTACHED_HASH | ATTACHED_DOT) accessor)*
1111 protected abstract Object reduceFieldAccess();
1115 protected abstract Object reduceIdAccessor();
1117 * accessor ::= BEGIN_STRING END_STRING
1119 protected abstract Object reduceStringAccessor();
1121 * accessor ::= LPAREN exp RPAREN
1123 protected abstract Object reduceExpAccessor();
1125 * case ::= exp caseRhs
1127 protected abstract Object reduceCase();
1129 * queryBlock ::= LBRACE (query (SEMICOLON (query SEMICOLON)* query)?)? RBRACE
1131 protected abstract Object reduceQueryBlock();
1133 * verboseChrQuery ::= LBRACE chrQuery (SEMICOLON chrQuery)* RBRACE
1135 protected abstract Object reduceVerboseCHRConjunction();
1137 * stringLiteral ::= BEGIN_STRING (SUSPEND_STRING exp CONTINUE_STRING)* END_STRING
1139 protected abstract Object reduceStringLiteral();
1141 * listQualifier ::= exp
1143 protected abstract Object reduceGuardQualifier();
1145 * listQualifier ::= exp EQUALS exp
1147 protected abstract Object reduceLetQualifier();
1149 * listQualifier ::= exp BINDS exp
1151 protected abstract Object reduceBindQualifier();
1153 * listQualifier ::= THEN exp (BY exp)?
1155 protected abstract Object reduceThenQualifier();
1157 * chrQuery ::= (chrQueryPart COMMA)* chrQueryPart
1159 protected abstract Object reduceCHRConjunction();
1161 * chrQueryPart ::= exp
1163 protected abstract Object reduceCHRAtom();
1165 * chrQueryPart ::= exp EQUALS exp
1167 protected abstract Object reduceCHREquals();
1169 * chrQueryPart ::= exp BINDS exp
1171 protected abstract Object reduceCHRBinds();
1173 * caseRhs ::= ARROW exp (WHERE statements)?
1175 protected abstract Object reduceSimpleCaseRhs();
1177 * caseRhs ::= guardedExpArrow guardedExpArrow* (WHERE statements)?
1179 protected abstract Object reduceGuardedCaseRhs();
1181 * guardedExpArrow ::= BAR exp (COMMA exp)* ARROW exp
1183 protected abstract Object reduceGuardedExpArrow();
1187 protected abstract Object reduceGuardEquation();
1189 * equation ::= exp EQUALS exp
1191 protected abstract Object reduceBasicEquation();
1193 * etype ::= LESS ID (COMMA ID)* GREATER btype
1195 protected abstract Object reduceEffect();
1199 protected abstract Object reduceJustEtype();
1201 * etype ::= FORALL ID ID* (SEPARATED_DOT | ATTACHED_DOT) type
1203 protected abstract Object reduceForAll();
1205 * btype ::= atype atype*
1207 protected abstract Object reduceApplyType();
1209 * dummy ::= COMMENT EOL
1211 protected abstract Object reduceDummy();
1213 protected void postReduce(Object reduced) {