Byron Hale wrote:
The compiler does not have a problem with "NUM," but has problems with "LBRACKET" and "LBRACKET," when declaring type "lbr_num_rbr_o." Note that top-level recognizes the constructors in question, after the compiler fails.
Simplified code:
datatype type_specifierK = INT | VOID and relopK = LE | LT | GT | GE | EQ | NE and addopK = PLUS | MINUS and mulopK = TIMES | OVER and arithopK = addopK | mulopK and tokenK = ENDFILE | ERROR | ELSE | IF | RETURN | WHILE | ID | NUM | ASSIGN | SEMI | COMMA | LPAREN | RPAREN | LBRACKET | RBRACKET | LCURLY | RCURLY | arithopK | relopK | type_specifierK withtype lbr_num_rbr_o = (LBRACKET * NUM * RBRACKET) option ;
This won't work. Your datatype definition is creating LBRACKET, NUM and RBRACKET as value constructors but in the withtype part you're trying to use them as type constructors. You must have declared NUM previously as a type constructor. When I try your example NUM is also reported as an undeclared type constructor.
Regards, David.