From e60a1823088689141ee0d6f02da6acba9587c218 Mon Sep 17 00:00:00 2001 From: dtischle Date: Tue, 21 Nov 2023 09:36:03 +0100 Subject: [PATCH] init branch with slight changes to the code in gapc.cc and signature.cc --- src/alt.cc | 1 + src/cpp.cc | 14 +- src/cpp.hh | 1 + src/gapc.cc | 8 + src/lexer.cc | 2462 +++++++++++++ src/location.hh | 332 ++ src/options.hh | 1 + src/parser.cc | 3116 +++++++++++++++++ src/parser.hh | 829 +++++ src/parser.output | 6119 +++++++++++++++++++++++++++++++++ src/parser.y | 3 +- src/position.hh | 11 + src/prefix.cc | 6 + src/signature.cc | 161 + src/signature.hh | 1 + src/stack.hh | 8 + src/symbol.cc | 2 +- src/version.cc | 5 + src/version.txt | 1 + testdata/grammar/aliglob2.gap | 3 +- 20 files changed, 13075 insertions(+), 9 deletions(-) create mode 100644 src/lexer.cc create mode 100644 src/location.hh create mode 100644 src/parser.cc create mode 100644 src/parser.hh create mode 100644 src/parser.output create mode 100644 src/position.hh create mode 100644 src/prefix.cc create mode 100644 src/stack.hh create mode 100644 src/version.cc create mode 100644 src/version.txt diff --git a/src/alt.cc b/src/alt.cc index 774a6fc03..554502bff 100644 --- a/src/alt.cc +++ b/src/alt.cc @@ -1306,6 +1306,7 @@ void Alt::Multi::print(std::ostream &s) { s << " > "; } +// ret_ variablen in out.cc hier veränderbar void Alt::Base::init_ret_decl(unsigned int i, const std::string &prefix) { std::ostringstream o; diff --git a/src/cpp.cc b/src/cpp.cc index 58cf819af..d16f73192 100644 --- a/src/cpp.cc +++ b/src/cpp.cc @@ -1033,7 +1033,7 @@ void Printer::Cpp::print_eqs(const std::list &l, char c) { } -void Printer::Cpp::print_most_decl(const Symbol::NT &nt) { +void Printer::Cpp::print_most_decl(const Symbol::NT &nt) { // header instance variables in class out for resulting out.hh ::Type::Base *type = new Type::Size(); for (size_t t = nt.track_pos(); t < nt.track_pos() + nt.tracks(); ++t) { stream << indent() << *type << " t_" << t << "_left_most;" << endl; @@ -1075,7 +1075,7 @@ void Printer::Cpp::print_window_inc(const Symbol::NT &nt) { } -void Printer::Cpp::print(const Statement::Table_Decl &t) { +void Printer::Cpp::print(const Statement::Table_Decl &t) { // Should print statements in Header of out.hh in_class = true; bool wmode = ast && ast->window_mode; bool checkpoint = ast && ast->checkpoint && !ast->checkpoint->is_buddy; @@ -1928,8 +1928,11 @@ void Printer::Cpp::print_subseq_typedef(const AST &ast) { << ", unsigned> TUSubsequence;\n\n"; } +void Printer::Cpp::enum_graph_print(){ + stream << indent() << "unsigned int parentID" << endl; +} -void Printer::Cpp::header(const AST &ast) { +void Printer::Cpp::header(const AST &ast) { //generates out.hh prints if (!ast.code_mode().subopt_buddy()) { stream << endl << make_comments(id_string, "//") << endl << endl; stream << "#ifndef " << class_name << "_hh" << endl @@ -2149,7 +2152,7 @@ void Printer::Cpp::print_stats_fn(const AST &ast) { void Printer::Cpp::header_footer(const AST &ast) { dec_indent(); - stream << indent() << " private:" << endl; + stream << indent() << " private:" << endl; // printed unter bei cyk() inc_indent(); if (ast.checkpoint && !ast.checkpoint->is_buddy) { nt_tables &tabulated = ast.grammar()->tabulated; @@ -2506,9 +2509,8 @@ void Printer::Cpp::print_value_pp(const AST &ast) { stream << indent() << "} else {" << endl; inc_indent(); stream << indent() << "out << res << '\\n';" << endl; - dec_indent(); + indent(); stream << indent() << '}' << endl; - dec_indent(); stream << indent() << '}' << endl << endl; } diff --git a/src/cpp.hh b/src/cpp.hh index c93963bd7..b4b1f5d54 100644 --- a/src/cpp.hh +++ b/src/cpp.hh @@ -177,6 +177,7 @@ class Cpp : public Base { void print(const Type::Multi &expr); + void enum_graph_print(); void header(const AST &ast); void header_footer(const AST &ast); void footer(const AST &ast); diff --git a/src/gapc.cc b/src/gapc.cc index 71e6b0c5c..a51db6367 100644 --- a/src/gapc.cc +++ b/src/gapc.cc @@ -450,6 +450,7 @@ class Main { */ void back(Instance *i = 0, Instance *instance_buddy = 0) { Instance *instance = i; + if (!i || instance_buddy) { if (opts.backtrack || opts.subopt || opts.kbacktrack) { instance = driver.ast.split_instance_for_backtrack(opts.instance); @@ -679,6 +680,8 @@ class Main { + opts.plot_grammar_file + " > foo.pdf' to generate a PDF."); } + + driver.ast.set_class_name(opts.class_name); @@ -692,6 +695,11 @@ class Main { Printer::Cpp hh(driver.ast, opts.h_stream()); hh.set_argv(argv, argc); hh.class_name = opts.class_name; + if (opts.product == "enum_graph") { + hh.enum_graph_print(); // Works kindly, but on wrong spot in the script. need any way to include this only with enum_graph in header method + } + // opts.product == enum_graph einfach polymorphe header methode schreiben + hh.header(driver.ast); hh.begin_fwd_decls(); driver.ast.print_code(hh); diff --git a/src/lexer.cc b/src/lexer.cc new file mode 100644 index 000000000..5c9313bf7 --- /dev/null +++ b/src/lexer.cc @@ -0,0 +1,2462 @@ +#line 2 "src/lexer.cc" + +#line 4 "src/lexer.cc" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 4 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include +#include +#include +#include + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#ifndef SIZE_MAX +#define SIZE_MAX (~(size_t)0) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +/* begin standard C++ headers. */ + +/* TODO: this is always defined, so inline it */ +#define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) +#else +#define yynoreturn +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an + * integer in range [0..255] for use as an array index. + */ +#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN (yy_start) = 1 + 2 * +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START (((yy_start) - 1) / 2) +#define YYSTATE YY_START +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart( yyin ) +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else +#define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +extern int yyleng; + +extern FILE *yyin, *yyout; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + #define YY_LINENO_REWIND_TO(ptr) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) +#define unput(c) yyunput( c, (yytext_ptr) ) + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + int yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] + +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = NULL; +static int yy_init = 0; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void yyrestart ( FILE *input_file ); +void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ); +void yy_delete_buffer ( YY_BUFFER_STATE b ); +void yy_flush_buffer ( YY_BUFFER_STATE b ); +void yypush_buffer_state ( YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state ( void ); + +static void yyensure_buffer_stack ( void ); +static void yy_load_buffer_state ( void ); +static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file ); +#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER ) + +YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); +YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len ); + +void *yyalloc ( yy_size_t ); +void *yyrealloc ( void *, yy_size_t ); +void yyfree ( void * ); + +#define yy_new_buffer yy_create_buffer +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +#define yywrap() (/*CONSTCOND*/1) +#define YY_SKIP_YYWRAP +typedef flex_uint8_t YY_CHAR; + +FILE *yyin = NULL, *yyout = NULL; + +typedef int yy_state_type; + +extern int yylineno; +int yylineno = 1; + +extern char *yytext; +#ifdef yytext_ptr +#undef yytext_ptr +#endif +#define yytext_ptr yytext + +static yy_state_type yy_get_previous_state ( void ); +static yy_state_type yy_try_NUL_trans ( yy_state_type current_state ); +static int yy_get_next_buffer ( void ); +static void yynoreturn yy_fatal_error ( const char* msg ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + (yytext_ptr) = yy_bp; \ + yyleng = (int) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; +#define YY_NUM_RULES 69 +#define YY_END_OF_BUFFER 70 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static const flex_int16_t yy_accept[285] = + { 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 70, 68, 63, 61, 67, 62, 49, 54, + 60, 68, 57, 60, 60, 60, 64, 60, 60, 60, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 60, 63, 62, 66, + 37, 36, 40, 42, 41, 55, 56, 58, 59, 34, + 33, 69, 34, 63, 61, 62, 44, 47, 50, 51, + 52, 0, 53, 38, 35, 0, 64, 66, 45, 43, + 46, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 24, 66, 66, 66, 66, 66, 66, 66, + + 66, 66, 66, 66, 66, 66, 66, 66, 66, 48, + 63, 0, 0, 62, 66, 37, 40, 39, 55, 58, + 0, 65, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 26, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 0, 66, 32, 0, 66, 66, 17, 66, 66, + 66, 66, 66, 25, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 3, + 13, 22, 66, 19, 0, 66, 0, 65, 66, 66, + 14, 30, 66, 66, 66, 66, 66, 66, 66, 66, + + 2, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 27, 66, 0, 66, 66, 66, 6, 66, 66, + 66, 4, 66, 66, 1, 66, 66, 66, 23, 28, + 66, 66, 66, 66, 66, 66, 0, 66, 7, 66, + 66, 66, 9, 12, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 0, 31, 11, 29, 66, 15, 66, + 66, 21, 66, 66, 31, 66, 66, 5, 66, 16, + 66, 8, 10, 66, 66, 66, 66, 66, 18, 66, + 66, 66, 20, 0 + } ; + +static const YY_CHAR yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 5, 6, 7, 8, 8, 8, 9, 10, 8, + 8, 11, 12, 8, 13, 14, 15, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 8, 8, 17, + 18, 19, 1, 1, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 8, 1, 8, 8, 21, 1, 22, 23, 24, 25, + + 26, 27, 28, 29, 30, 20, 31, 32, 33, 34, + 35, 36, 20, 37, 38, 39, 40, 41, 42, 43, + 44, 20, 8, 45, 8, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static const YY_CHAR yy_meta[46] = + { 0, + 1, 1, 2, 1, 1, 1, 3, 1, 1, 4, + 5, 1, 1, 6, 1, 6, 1, 1, 1, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 1 + } ; + +static const flex_int16_t yy_base[296] = + { 0, + 0, 44, 561, 560, 44, 45, 555, 554, 550, 549, + 55, 61, 558, 565, 555, 553, 565, 550, 536, 565, + 565, 544, 565, 41, 54, 39, 55, 534, 533, 532, + 535, 47, 38, 51, 59, 62, 63, 71, 68, 70, + 67, 85, 74, 75, 81, 94, 503, 109, 115, 107, + 0, 565, 0, 565, 532, 0, 565, 0, 565, 565, + 565, 565, 0, 544, 542, 539, 565, 565, 565, 565, + 565, 87, 565, 565, 565, 527, 96, 528, 565, 565, + 565, 108, 80, 112, 117, 113, 116, 118, 119, 114, + 121, 132, 527, 123, 133, 136, 135, 137, 141, 142, + + 147, 150, 148, 153, 151, 152, 154, 156, 159, 565, + 183, 187, 506, 188, 167, 0, 0, 565, 0, 0, + 532, 178, 169, 182, 165, 185, 187, 192, 183, 188, + 193, 198, 524, 196, 200, 194, 201, 202, 209, 211, + 212, 214, 219, 216, 222, 224, 228, 225, 230, 227, + 229, 513, 233, 565, 254, 246, 234, 522, 235, 247, + 248, 257, 259, 521, 260, 263, 261, 262, 265, 266, + 268, 267, 269, 270, 271, 276, 272, 277, 278, 520, + 519, 518, 288, 295, 499, 279, 514, 513, 289, 292, + 514, 513, 298, 303, 304, 306, 307, 308, 309, 311, + + 512, 313, 314, 320, 315, 318, 321, 322, 325, 323, + 326, 508, 329, 477, 331, 335, 337, 496, 339, 344, + 351, 492, 346, 353, 489, 354, 356, 355, 483, 450, + 357, 358, 359, 361, 360, 37, 438, 362, 448, 363, + 366, 378, 447, 445, 372, 379, 368, 381, 383, 373, + 387, 389, 395, 432, 443, 441, 440, 386, 439, 394, + 400, 402, 399, 403, 565, 404, 405, 437, 413, 436, + 414, 431, 427, 408, 415, 418, 416, 419, 424, 420, + 425, 421, 422, 565, 465, 471, 477, 483, 489, 240, + 495, 501, 507, 513, 519 + + } ; + +static const flex_int16_t yy_def[296] = + { 0, + 284, 1, 285, 285, 286, 286, 287, 287, 288, 288, + 289, 289, 284, 284, 284, 284, 284, 284, 284, 284, + 284, 284, 284, 284, 284, 284, 290, 284, 284, 284, + 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, + 290, 290, 290, 290, 290, 290, 284, 284, 284, 290, + 291, 284, 292, 284, 284, 293, 284, 294, 284, 284, + 284, 284, 295, 284, 284, 284, 284, 284, 284, 284, + 284, 284, 284, 284, 284, 284, 290, 290, 284, 284, + 284, 290, 290, 290, 290, 290, 290, 290, 290, 290, + 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, + + 290, 290, 290, 290, 290, 290, 290, 290, 290, 284, + 284, 284, 284, 284, 290, 291, 292, 284, 293, 294, + 295, 284, 290, 290, 290, 290, 290, 290, 290, 290, + 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, + 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, + 290, 284, 290, 284, 284, 290, 290, 290, 290, 290, + 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, + 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, + 290, 290, 290, 290, 284, 290, 284, 284, 290, 290, + 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, + + 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, + 290, 290, 290, 284, 290, 290, 290, 290, 290, 290, + 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, + 290, 290, 290, 290, 290, 290, 284, 290, 290, 290, + 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, + 290, 290, 290, 284, 290, 290, 290, 290, 290, 290, + 290, 290, 290, 290, 284, 290, 290, 290, 290, 290, + 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, + 290, 290, 290, 0, 284, 284, 284, 284, 284, 284, + 284, 284, 284, 284, 284 + + } ; + +static const flex_int16_t yy_nxt[611] = + { 0, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 21, 24, 25, 21, 26, 27, 28, 29, 30, 31, + 31, 32, 33, 34, 31, 35, 36, 37, 31, 38, + 39, 31, 31, 31, 31, 40, 41, 42, 43, 44, + 45, 46, 31, 31, 47, 48, 54, 54, 49, 74, + 284, 284, 69, 75, 55, 55, 61, 62, 70, 61, + 284, 63, 61, 62, 284, 61, 71, 63, 76, 72, + 77, 73, 284, 50, 85, 284, 284, 253, 82, 86, + 284, 284, 87, 284, 284, 88, 83, 284, 284, 84, + 89, 97, 99, 284, 284, 104, 91, 93, 284, 92, + + 76, 90, 72, 94, 95, 96, 98, 284, 100, 76, + 111, 77, 106, 112, 101, 107, 112, 105, 125, 114, + 284, 284, 108, 109, 102, 284, 284, 284, 103, 284, + 284, 284, 284, 93, 284, 123, 284, 129, 113, 94, + 115, 126, 127, 124, 113, 284, 284, 128, 284, 284, + 284, 130, 132, 134, 284, 284, 131, 133, 135, 138, + 284, 284, 140, 284, 284, 284, 284, 284, 136, 284, + 137, 139, 284, 144, 143, 146, 142, 148, 284, 141, + 284, 145, 284, 149, 111, 150, 147, 112, 112, 112, + 153, 112, 114, 122, 156, 284, 284, 151, 284, 158, + + 284, 284, 136, 155, 137, 284, 284, 284, 160, 284, + 157, 284, 113, 284, 284, 284, 113, 113, 164, 159, + 162, 161, 284, 165, 284, 284, 163, 284, 166, 284, + 172, 167, 284, 169, 168, 284, 171, 284, 284, 170, + 284, 284, 284, 284, 177, 78, 284, 284, 284, 173, + 175, 174, 176, 180, 182, 190, 178, 184, 183, 284, + 284, 284, 181, 179, 186, 187, 187, 191, 189, 188, + 284, 193, 284, 284, 284, 284, 284, 192, 284, 284, + 284, 284, 284, 284, 284, 284, 199, 202, 195, 284, + 284, 284, 284, 196, 194, 198, 197, 208, 200, 204, + + 207, 284, 284, 201, 203, 284, 206, 205, 284, 211, + 209, 284, 210, 212, 217, 213, 284, 284, 215, 284, + 284, 284, 284, 218, 284, 216, 284, 284, 284, 223, + 221, 284, 219, 284, 284, 284, 284, 220, 284, 284, + 222, 224, 284, 227, 284, 228, 226, 235, 284, 225, + 284, 230, 284, 233, 231, 238, 239, 284, 229, 284, + 232, 234, 240, 236, 284, 241, 284, 284, 284, 284, + 284, 284, 284, 284, 284, 284, 284, 246, 245, 284, + 250, 284, 244, 242, 229, 284, 284, 255, 243, 247, + 251, 284, 284, 248, 284, 229, 284, 249, 252, 284, + + 284, 256, 284, 257, 259, 258, 260, 284, 284, 229, + 229, 262, 284, 284, 263, 284, 284, 284, 284, 261, + 264, 284, 269, 270, 266, 268, 284, 284, 284, 284, + 267, 284, 284, 284, 284, 284, 277, 284, 284, 271, + 284, 272, 273, 278, 284, 275, 282, 274, 276, 284, + 284, 281, 284, 284, 284, 280, 284, 265, 284, 279, + 284, 284, 254, 284, 283, 51, 51, 51, 51, 51, + 51, 53, 53, 53, 53, 53, 53, 56, 56, 56, + 56, 56, 56, 58, 58, 58, 58, 58, 58, 60, + 60, 60, 60, 60, 60, 116, 284, 116, 116, 116, + + 116, 117, 284, 117, 117, 284, 117, 119, 119, 284, + 119, 119, 119, 120, 120, 120, 237, 120, 120, 121, + 121, 284, 121, 121, 121, 284, 284, 284, 188, 188, + 214, 284, 284, 284, 284, 284, 185, 284, 154, 152, + 284, 284, 122, 66, 65, 64, 118, 110, 284, 81, + 80, 79, 68, 67, 66, 65, 64, 284, 59, 59, + 57, 57, 52, 52, 13, 284, 284, 284, 284, 284, + 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, + 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, + 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, + + 284, 284, 284, 284, 284, 284, 284, 284, 284, 284 + } ; + +static const flex_int16_t yy_chk[611] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 2, 5, 6, 2, 26, + 236, 33, 24, 26, 5, 6, 11, 11, 24, 11, + 32, 11, 12, 12, 34, 12, 25, 12, 27, 25, + 27, 25, 35, 2, 33, 36, 37, 236, 32, 34, + 41, 39, 34, 40, 38, 34, 32, 43, 44, 32, + 35, 40, 41, 83, 45, 43, 36, 38, 42, 37, + + 72, 35, 72, 38, 38, 39, 40, 46, 42, 77, + 48, 77, 44, 48, 42, 45, 49, 43, 83, 49, + 50, 82, 46, 46, 42, 84, 86, 90, 42, 87, + 85, 88, 89, 50, 91, 82, 94, 87, 48, 50, + 50, 84, 85, 82, 49, 92, 95, 86, 97, 96, + 98, 88, 90, 92, 99, 100, 89, 91, 94, 96, + 101, 103, 98, 102, 105, 106, 104, 107, 95, 108, + 95, 97, 109, 102, 101, 104, 100, 106, 125, 99, + 115, 103, 123, 107, 111, 108, 105, 111, 112, 114, + 115, 112, 114, 122, 123, 124, 129, 109, 126, 125, + + 127, 130, 115, 122, 115, 128, 131, 136, 127, 134, + 124, 132, 111, 135, 137, 138, 112, 114, 131, 126, + 129, 128, 139, 132, 140, 141, 130, 142, 134, 144, + 139, 135, 143, 136, 135, 145, 138, 146, 148, 137, + 150, 147, 151, 149, 144, 290, 153, 157, 159, 140, + 142, 141, 143, 147, 149, 157, 145, 151, 150, 156, + 160, 161, 148, 146, 153, 155, 155, 159, 156, 155, + 162, 161, 163, 165, 167, 168, 166, 160, 169, 170, + 172, 171, 173, 174, 175, 177, 167, 170, 163, 176, + 178, 179, 186, 165, 162, 166, 165, 176, 168, 172, + + 175, 183, 189, 169, 171, 190, 174, 173, 184, 179, + 177, 193, 178, 183, 190, 184, 194, 195, 186, 196, + 197, 198, 199, 193, 200, 189, 202, 203, 205, 198, + 196, 206, 194, 204, 207, 208, 210, 195, 209, 211, + 197, 199, 213, 203, 215, 204, 202, 211, 216, 200, + 217, 206, 219, 209, 207, 215, 216, 220, 205, 223, + 208, 210, 217, 213, 221, 219, 224, 226, 228, 227, + 231, 232, 233, 235, 234, 238, 240, 226, 224, 241, + 233, 247, 223, 220, 231, 245, 250, 238, 221, 227, + 234, 242, 246, 228, 248, 247, 249, 232, 235, 258, + + 251, 240, 252, 242, 246, 245, 248, 260, 253, 241, + 251, 250, 263, 261, 252, 262, 264, 266, 267, 249, + 253, 274, 262, 263, 258, 261, 269, 271, 275, 277, + 260, 276, 278, 280, 282, 283, 275, 279, 281, 264, + 273, 266, 267, 276, 272, 271, 281, 269, 274, 270, + 268, 280, 259, 257, 256, 278, 255, 254, 244, 277, + 243, 239, 237, 230, 282, 285, 285, 285, 285, 285, + 285, 286, 286, 286, 286, 286, 286, 287, 287, 287, + 287, 287, 287, 288, 288, 288, 288, 288, 288, 289, + 289, 289, 289, 289, 289, 291, 229, 291, 291, 291, + + 291, 292, 225, 292, 292, 222, 292, 293, 293, 218, + 293, 293, 293, 294, 294, 294, 214, 294, 294, 295, + 295, 212, 295, 295, 295, 201, 192, 191, 188, 187, + 185, 182, 181, 180, 164, 158, 152, 133, 121, 113, + 93, 78, 76, 66, 65, 64, 55, 47, 31, 30, + 29, 28, 22, 19, 18, 16, 15, 13, 10, 9, + 8, 7, 4, 3, 284, 284, 284, 284, 284, 284, + 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, + 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, + 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, + + 284, 284, 284, 284, 284, 284, 284, 284, 284, 284 + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +extern int yy_flex_debug; +int yy_flex_debug = 0; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +char *yytext; +#line 1 "src/lexer.l" +/* {{{ + + This file is part of gapc (GAPC - Grammars, Algebras, Products - Compiler; + a system to compile algebraic dynamic programming programs) + + Copyright (C) 2008-2011 Georg Sauthoff + email: gsauthof@techfak.uni-bielefeld.de or gsauthof@sdf.lonestar.org + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +}}} */ +#line 25 "src/lexer.l" + + +#include "parser.hh" + +#include "lexer.h" + +typedef yy::Parser::token token; + +#include + +#include "driver.hh" + +namespace scanner { + + +static Driver *driver; + +struct state_t { + +state_t() +: offset(0), last_nl(0), filename(0) {} + +long offset; +long last_nl; +std::string *filename; + +}; + +state_t state; + +static bool first_call = true; + +void init(Driver *d) +{ + driver = d; + state.offset = 0; + state.last_nl = 0; + state.filename = driver->filename(); + first_call = true; +} + +std::stack states; + +} + + +#define YY_USER_ACTION do { \ + yylloc->step(); \ + yylloc->columns(yyleng); \ + scanner::state.offset+=yyleng; \ +} while(0); + +/* By default yylex returns int, we use token_type. + Unfortunately yyterminate by default returns 0, which is + not of token_type. -> see info bison */ +#define yyterminate() return token::END + +static void new_line(yy::Parser::location_type *yylloc) +{ + yylloc->lines(); + yylloc->step(); + scanner::state.last_nl = scanner::state.offset; + yylloc->setOffset(scanner::state.last_nl); + yylloc->set_file(yyin); +} + +#line 764 "src/lexer.cc" +/* debug */ + +#line 767 "src/lexer.cc" + +#define INITIAL 0 +#define SKIP_LINE 1 +#define SKIP_COMMENT 2 +#define STRING_QUOTE 3 +#define CHAR_QUOTE 4 +#define INCLUDE 5 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +static int yy_init_globals ( void ); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int yylex_destroy ( void ); + +int yyget_debug ( void ); + +void yyset_debug ( int debug_flag ); + +YY_EXTRA_TYPE yyget_extra ( void ); + +void yyset_extra ( YY_EXTRA_TYPE user_defined ); + +FILE *yyget_in ( void ); + +void yyset_in ( FILE * _in_str ); + +FILE *yyget_out ( void ); + +void yyset_out ( FILE * _out_str ); + + int yyget_leng ( void ); + +char *yyget_text ( void ); + +int yyget_lineno ( void ); + +void yyset_lineno ( int _line_number ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap ( void ); +#else +extern int yywrap ( void ); +#endif +#endif + +#ifndef YY_NO_UNPUT + +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy ( char *, const char *, int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen ( const char * ); +#endif + +#ifndef YY_NO_INPUT +#ifdef __cplusplus +static int yyinput ( void ); +#else +static int input ( void ); +#endif + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else +#define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + int n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int yylex (void); + +#define YY_DECL int yylex (void) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK /*LINTED*/break; +#endif + +#define YY_RULE_SETUP \ + if ( yyleng > 0 ) \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ + (yytext[yyleng - 1] == '\n'); \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; + + if ( !(yy_init) ) + { + (yy_init) = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer( yyin, YY_BUF_SIZE ); + } + + yy_load_buffer_state( ); + } + + { +#line 103 "src/lexer.l" + + +#line 106 "src/lexer.l" + /* gets pasted in yylex at the beginning */ + + yylloc->step(); + yylloc->setOffset(scanner::state.last_nl); + yylloc->set_file(yyin); + + if (scanner::first_call) { + scanner::first_call = false; + return start_symbol; + } + + + /* ------------------------------------------------------------------------ */ + /* keywords */ + /* ------------------------------------------------------------------------ */ + +#line 1010 "src/lexer.cc" + + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); + + /* Support of yytext. */ + *yy_cp = (yy_hold_char); + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = (yy_start); + yy_current_state += YY_AT_BOL(); +yy_match: + do + { + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 285 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + ++yy_cp; + } + while ( yy_current_state != 284 ); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 122 "src/lexer.l" +{ return token::IMPORT; } + YY_BREAK +case 2: +YY_RULE_SETUP +#line 124 "src/lexer.l" +{ return token::INPUT; } + YY_BREAK +case 3: +YY_RULE_SETUP +#line 126 "src/lexer.l" +{ return token::TYPE; } + YY_BREAK +case 4: +YY_RULE_SETUP +#line 128 "src/lexer.l" +{ return token::EXTERN; } + YY_BREAK +case 5: +YY_RULE_SETUP +#line 130 "src/lexer.l" +{ return token::SIGNATURE; } + YY_BREAK +case 6: +YY_RULE_SETUP +#line 132 "src/lexer.l" +{ return token::CHOICE; } + YY_BREAK +case 7: +YY_RULE_SETUP +#line 134 "src/lexer.l" +{ return token::ALGEBRA; } + YY_BREAK +case 8: +YY_RULE_SETUP +#line 136 "src/lexer.l" +{ return token::IMPLEMENTS; } + YY_BREAK +case 9: +YY_RULE_SETUP +#line 138 "src/lexer.l" +{ return token::EXTENDS; } + YY_BREAK +case 10: +YY_RULE_SETUP +#line 140 "src/lexer.l" +{ return token::PARAMETERS; } + YY_BREAK +case 11: +YY_RULE_SETUP +#line 142 "src/lexer.l" +{ return token::ALPHABET; } + YY_BREAK +/* answer { return token::ANSWER; } -> just the return type of axiom alg fn */ +case 12: +YY_RULE_SETUP +#line 146 "src/lexer.l" +{ return token::GRAMMAR; } + YY_BREAK +case 13: +YY_RULE_SETUP +#line 148 "src/lexer.l" +{ return token::USES; } + YY_BREAK +case 14: +YY_RULE_SETUP +#line 150 "src/lexer.l" +{ return token::AXIOM; } + YY_BREAK +case 15: +YY_RULE_SETUP +#line 152 "src/lexer.l" +{ return token::INSTANCE; } + YY_BREAK +case 16: +YY_RULE_SETUP +#line 154 "src/lexer.l" +{ return token::TABULATED; } + YY_BREAK +case 17: +YY_RULE_SETUP +#line 156 "src/lexer.l" +{ return token::AUTOMATIC; } + YY_BREAK +case 18: +YY_RULE_SETUP +#line 158 "src/lexer.l" +{ return token::WITH_OVERLAY; } + YY_BREAK +case 19: +YY_RULE_SETUP +#line 160 "src/lexer.l" +{ return token::WITH; } + YY_BREAK +case 20: +YY_RULE_SETUP +#line 162 "src/lexer.l" +{ return token::SUCHTHAT_OVERLAY; } + YY_BREAK +case 21: +YY_RULE_SETUP +#line 164 "src/lexer.l" +{ return token::SUCHTHAT; } + YY_BREAK +case 22: +YY_RULE_SETUP +#line 167 "src/lexer.l" +{ return token::VOID; } + YY_BREAK +/* ------------------------------------------------------------------------ */ +/* algebra types */ +/* ------------------------------------------------------------------------ */ +case 23: +YY_RULE_SETUP +#line 173 "src/lexer.l" +{ + yylval->sval = new std::string(yytext); + return token::MODE; } + YY_BREAK +/* ------------------------------------------------------------------------ */ +/* statements */ +/* ------------------------------------------------------------------------ */ +case 24: +YY_RULE_SETUP +#line 181 "src/lexer.l" +{ return token::IF; } + YY_BREAK +case 25: +YY_RULE_SETUP +#line 183 "src/lexer.l" +{ return token::ELSE; } + YY_BREAK +case 26: +YY_RULE_SETUP +#line 185 "src/lexer.l" +{ return token::FOR; } + YY_BREAK +case 27: +YY_RULE_SETUP +#line 187 "src/lexer.l" +{ return token::WHILE; } + YY_BREAK +case 28: +YY_RULE_SETUP +#line 189 "src/lexer.l" +{ return token::RETURN; } + YY_BREAK +case 29: +YY_RULE_SETUP +#line 191 "src/lexer.l" +{ return token::CONTINUE; } + YY_BREAK +case 30: +YY_RULE_SETUP +#line 193 "src/lexer.l" +{ return token::BREAK; } + YY_BREAK +/* ------------------------------------------------------------------------ */ +/* include files */ +/* ------------------------------------------------------------------------ */ +case 31: +YY_RULE_SETUP +#line 199 "src/lexer.l" +{ BEGIN INCLUDE; } + YY_BREAK + +case 32: +/* rule 32 can match eol */ +YY_RULE_SETUP +#line 204 "src/lexer.l" +{ + std::string s(yytext); + std::string t(s.substr(1, s.size()-2)); + + scanner::states.push(scanner::state); + scanner::state = scanner::state_t(); + scanner::state.filename = new std::string(t); + yylloc->begin.filename = new std::string(t); + yylloc->end.filename = new std::string(t); + + scanner::driver->push_buffer(t); + + yylloc->set_file(yyin); + + BEGIN INITIAL; +} + YY_BREAK +case 33: +YY_RULE_SETUP +#line 221 "src/lexer.l" +; + YY_BREAK +case 34: +YY_RULE_SETUP +#line 223 "src/lexer.l" +{ return token::UNEXPECTED_CHARACTER; } + YY_BREAK + +/* ------------------------------------------------------------------------ */ +/* comments */ +/* ------------------------------------------------------------------------ */ +case 35: +YY_RULE_SETUP +#line 232 "src/lexer.l" +{ BEGIN SKIP_LINE; } + YY_BREAK + +case 36: +/* rule 36 can match eol */ +YY_RULE_SETUP +#line 235 "src/lexer.l" +{ new_line(yylloc); BEGIN INITIAL; } + YY_BREAK +case 37: +YY_RULE_SETUP +#line 236 "src/lexer.l" +; + YY_BREAK + +case 38: +YY_RULE_SETUP +#line 239 "src/lexer.l" +{ BEGIN SKIP_COMMENT; } + YY_BREAK + +case 39: +YY_RULE_SETUP +#line 242 "src/lexer.l" +{ BEGIN INITIAL; } + YY_BREAK +case 40: +YY_RULE_SETUP +#line 243 "src/lexer.l" +; + YY_BREAK +case 41: +YY_RULE_SETUP +#line 244 "src/lexer.l" +; + YY_BREAK +case 42: +/* rule 42 can match eol */ +YY_RULE_SETUP +#line 245 "src/lexer.l" +{ new_line(yylloc); } + YY_BREAK + +/* ------------------------------------------------------------------------ */ +/* operators */ +/* ------------------------------------------------------------------------ */ +case 43: +YY_RULE_SETUP +#line 251 "src/lexer.l" +{ return token::EQ; } + YY_BREAK +case 44: +YY_RULE_SETUP +#line 253 "src/lexer.l" +{ return token::NEQ; } + YY_BREAK +case 45: +YY_RULE_SETUP +#line 255 "src/lexer.l" +{ return token::LT; } + YY_BREAK +case 46: +YY_RULE_SETUP +#line 257 "src/lexer.l" +{ return token::GT; } + YY_BREAK +case 47: +YY_RULE_SETUP +#line 259 "src/lexer.l" +{ return token::AND; } + YY_BREAK +case 48: +YY_RULE_SETUP +#line 261 "src/lexer.l" +{ return token::OR; } + YY_BREAK +case 49: +YY_RULE_SETUP +#line 263 "src/lexer.l" +{ return token::NOT; } + YY_BREAK +case 50: +YY_RULE_SETUP +#line 265 "src/lexer.l" +{ return token::INC; } + YY_BREAK +case 51: +YY_RULE_SETUP +#line 267 "src/lexer.l" +{ return token::IEQ; } + YY_BREAK +case 52: +YY_RULE_SETUP +#line 269 "src/lexer.l" +{ return token::DEC; } + YY_BREAK +case 53: +YY_RULE_SETUP +#line 271 "src/lexer.l" +{ return token::DEQ; } + YY_BREAK +/* ------------------------------------------------------------------------ */ +/* chars, strings */ +/* ------------------------------------------------------------------------ */ +case 54: +YY_RULE_SETUP +#line 277 "src/lexer.l" +{ BEGIN STRING_QUOTE; return yy::Parser::token_type(yytext[0]); } + YY_BREAK + +case 55: +/* rule 55 can match eol */ +YY_RULE_SETUP +#line 280 "src/lexer.l" +{ yylval->sval = new std::string(yytext); return token::STRING; } + YY_BREAK +case 56: +YY_RULE_SETUP +#line 281 "src/lexer.l" +{ BEGIN INITIAL; return yy::Parser::token_type(yytext[0]); } + YY_BREAK + +case 57: +YY_RULE_SETUP +#line 284 "src/lexer.l" +{ BEGIN CHAR_QUOTE; return yy::Parser::token_type(yytext[0]); } + YY_BREAK + +case 58: +/* rule 58 can match eol */ +YY_RULE_SETUP +#line 287 "src/lexer.l" +{ yylval->sval = new std::string(yytext); return token::STRING; } + YY_BREAK +case 59: +YY_RULE_SETUP +#line 288 "src/lexer.l" +{ BEGIN INITIAL; return yy::Parser::token_type(yytext[0]); } + YY_BREAK + +/* ------------------------------------------------------------------------ */ +/* special characters */ +/* ------------------------------------------------------------------------ */ +case 60: +YY_RULE_SETUP +#line 295 "src/lexer.l" +{ return yy::Parser::token_type(yytext[0]); } + YY_BREAK +case 61: +/* rule 61 can match eol */ +YY_RULE_SETUP +#line 297 "src/lexer.l" +{ yylloc->lines(yyleng-1); new_line(yylloc); } + YY_BREAK +case 62: +YY_RULE_SETUP +#line 299 "src/lexer.l" +; + YY_BREAK +case 63: +YY_RULE_SETUP +#line 301 "src/lexer.l" +{ yylloc->columns(yyleng*8-yyleng); } + YY_BREAK +/* ------------------------------------------------------------------------ */ +/* sval aka string , number ... */ +/* ------------------------------------------------------------------------ */ +case 64: +YY_RULE_SETUP +#line 306 "src/lexer.l" +{ yylval->sval = new std::string(yytext); return token::NUMBER; } + YY_BREAK +case 65: +YY_RULE_SETUP +#line 308 "src/lexer.l" +{ + yylval->sval = new std::string(yytext); return token::FLOAT; +} + YY_BREAK +case 66: +YY_RULE_SETUP +#line 312 "src/lexer.l" +{ yylval->sval = new std::string(yytext); return token::STRING; } + YY_BREAK +/* ignore carriage return - stupid windows users ... */ +case 67: +YY_RULE_SETUP +#line 315 "src/lexer.l" +; + YY_BREAK +case YY_STATE_EOF(INITIAL): +case YY_STATE_EOF(SKIP_LINE): +case YY_STATE_EOF(SKIP_COMMENT): +case YY_STATE_EOF(STRING_QUOTE): +case YY_STATE_EOF(CHAR_QUOTE): +case YY_STATE_EOF(INCLUDE): +#line 317 "src/lexer.l" +{ + yypop_buffer_state(); + if (!YY_CURRENT_BUFFER) + yyterminate(); + else { + assert(!scanner::states.empty()); + scanner::state = scanner::states.top(); + scanner::states.pop(); + yylloc->begin.filename = yylloc->end.filename = scanner::state.filename; + } +} + YY_BREAK +case 68: +YY_RULE_SETUP +#line 329 "src/lexer.l" +{ return token::UNEXPECTED_CHARACTER; } + YY_BREAK +case 69: +YY_RULE_SETUP +#line 331 "src/lexer.l" +ECHO; + YY_BREAK +#line 1489 "src/lexer.cc" + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( yywrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of user's declarations */ +} /* end of yylex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (void) +{ + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = (yytext_ptr); + int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yyrealloc( (void *) b->yy_ch_buf, + (yy_size_t) (b->yy_buf_size + 2) ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = NULL; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart( yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( + (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + /* "- 2" to take care of EOB's */ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); + } + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (void) +{ + yy_state_type yy_current_state; + char *yy_cp; + + yy_current_state = (yy_start); + yy_current_state += YY_AT_BOL(); + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 285 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +{ + int yy_is_jam; + char *yy_cp = (yy_c_buf_p); + + YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 285 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_is_jam = (yy_current_state == 284); + + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_UNPUT + +#endif + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (void) +#else + static int input (void) +#endif + +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart( yyin ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap( ) ) + return 0; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } + + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ + (yy_hold_char) = *++(yy_c_buf_p); + + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void yyrestart (FILE * input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer( yyin, YY_BUF_SIZE ); + } + + yy_init_buffer( YY_CURRENT_BUFFER, input_file ); + yy_load_buffer_state( ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; +} + +static void yy_load_buffer_state (void) +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer( b, file ); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * + */ + void yy_delete_buffer (YY_BUFFER_STATE b ) +{ + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yyfree( (void *) b->yy_ch_buf ); + + yyfree( (void *) b ); +} + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a yyrestart() or at EOF. + */ + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) + +{ + int oerrno = errno; + + yy_flush_buffer( b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void yy_flush_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + yy_load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(); + + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void yypop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void yyensure_buffer_stack (void) +{ + yy_size_t num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + yy_size_t grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return NULL; + + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = NULL; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer( b ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to yylex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * yy_scan_bytes() instead. + */ +YY_BUFFER_STATE yy_scan_string (const char * yystr ) +{ + + return yy_scan_bytes( yystr, (int) strlen(yystr) ); +} + +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will + * scan from a @e copy of @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len ) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = (yy_size_t) (_yybytes_len + 2); + buf = (char *) yyalloc( n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer( buf, n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yynoreturn yy_fatal_error (const char* msg ) +{ + fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the current line number. + * + */ +int yyget_lineno (void) +{ + + return yylineno; +} + +/** Get the input stream. + * + */ +FILE *yyget_in (void) +{ + return yyin; +} + +/** Get the output stream. + * + */ +FILE *yyget_out (void) +{ + return yyout; +} + +/** Get the length of the current token. + * + */ +int yyget_leng (void) +{ + return yyleng; +} + +/** Get the current token. + * + */ + +char *yyget_text (void) +{ + return yytext; +} + +/** Set the current line number. + * @param _line_number line number + * + */ +void yyset_lineno (int _line_number ) +{ + + yylineno = _line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param _in_str A readable stream. + * + * @see yy_switch_to_buffer + */ +void yyset_in (FILE * _in_str ) +{ + yyin = _in_str ; +} + +void yyset_out (FILE * _out_str ) +{ + yyout = _out_str ; +} + +int yyget_debug (void) +{ + return yy_flex_debug; +} + +void yyset_debug (int _bdebug ) +{ + yy_flex_debug = _bdebug ; +} + +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from yylex_destroy(), so don't allocate here. + */ + + (yy_buffer_stack) = NULL; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = NULL; + (yy_init) = 0; + (yy_start) = 0; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = NULL; + yyout = NULL; +#endif + + /* For future reference: Set errno on error, since we are called by + * yylex_init() + */ + return 0; +} + +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + yy_delete_buffer( YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(); + } + + /* Destroy the stack itself. */ + yyfree((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * yylex() is called, initialization will occur. */ + yy_init_globals( ); + + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, const char * s2, int n ) +{ + + int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (const char * s ) +{ + int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *yyalloc (yy_size_t size ) +{ + return malloc(size); +} + +void *yyrealloc (void * ptr, yy_size_t size ) +{ + + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return realloc(ptr, size); +} + +void yyfree (void * ptr ) +{ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 331 "src/lexer.l" + + + + diff --git a/src/location.hh b/src/location.hh new file mode 100644 index 000000000..3f87b6b7d --- /dev/null +++ b/src/location.hh @@ -0,0 +1,332 @@ +// A Bison parser, made by GNU Bison 3.5.1. + +// Locations for Bison parsers in C++ + +// Copyright (C) 2002-2015, 2018-2020 Free Software Foundation, Inc. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +// As a special exception, you may create a larger work that contains +// part or all of the Bison parser skeleton and distribute that work +// under terms of your choice, so long as that work isn't itself a +// parser generator using the skeleton or a modified version thereof +// as a parser skeleton. Alternatively, if you modify or redistribute +// the parser skeleton itself, you may (at your option) remove this +// special exception, which will cause the skeleton and the resulting +// Bison output files to be licensed under the GNU General Public +// License without this special exception. + +// This special exception was added by the Free Software Foundation in +// version 2.2 of Bison. + +/** + ** \file location.hh + ** Define the yy::location class. + */ + +#ifndef YY_YY_LOCATION_HH_INCLUDED +# define YY_YY_LOCATION_HH_INCLUDED + +# include +# include + +# ifndef YY_NULLPTR +# if defined __cplusplus +# if 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif +# else +# define YY_NULLPTR ((void*)0) +# endif +# endif + +namespace yy { +#line 58 "location.hh" + + /// A point in a source file. + class position + { + public: + /// Type for line and column numbers. + typedef int counter_type; + + /// Construct a position. + explicit position (std::string* f = YY_NULLPTR, + counter_type l = 1, + counter_type c = 1) + : filename (f) + , line (l) + , column (c) + {} + + + /// Initialization. + void initialize (std::string* fn = YY_NULLPTR, + counter_type l = 1, + counter_type c = 1) + { + filename = fn; + line = l; + column = c; + } + + /** \name Line and Column related manipulators + ** \{ */ + /// (line related) Advance to the COUNT next lines. + void lines (counter_type count = 1) + { + if (count) + { + column = 1; + line = add_ (line, count, 1); + } + } + + /// (column related) Advance to the COUNT next columns. + void columns (counter_type count = 1) + { + column = add_ (column, count, 1); + } + /** \} */ + + /// File name to which this position refers. + std::string* filename; + /// Current line number. + counter_type line; + /// Current column number. + counter_type column; + + private: + /// Compute max (min, lhs+rhs). + static counter_type add_ (counter_type lhs, counter_type rhs, counter_type min) + { + return lhs + rhs < min ? min : lhs + rhs; + } + }; + + /// Add \a width columns, in place. + inline position& + operator+= (position& res, position::counter_type width) + { + res.columns (width); + return res; + } + + /// Add \a width columns. + inline position + operator+ (position res, position::counter_type width) + { + return res += width; + } + + /// Subtract \a width columns, in place. + inline position& + operator-= (position& res, position::counter_type width) + { + return res += -width; + } + + /// Subtract \a width columns. + inline position + operator- (position res, position::counter_type width) + { + return res -= width; + } + + /// Compare two position objects. + inline bool + operator== (const position& pos1, const position& pos2) + { + return (pos1.line == pos2.line + && pos1.column == pos2.column + && (pos1.filename == pos2.filename + || (pos1.filename && pos2.filename + && *pos1.filename == *pos2.filename))); + } + + /// Compare two position objects. + inline bool + operator!= (const position& pos1, const position& pos2) + { + return !(pos1 == pos2); + } + + /** \brief Intercept output stream redirection. + ** \param ostr the destination output stream + ** \param pos a reference to the position to redirect + */ + template + std::basic_ostream& + operator<< (std::basic_ostream& ostr, const position& pos) + { + if (pos.filename) + ostr << *pos.filename << ':'; + return ostr << pos.line << '.' << pos.column; + } + + /// Two points in a source file. + class location + { + public: + /// Type for line and column numbers. + typedef position::counter_type counter_type; + + /// Construct a location from \a b to \a e. + location (const position& b, const position& e) + : begin (b) + , end (e) + {} + + /// Construct a 0-width location in \a p. + explicit location (const position& p = position ()) + : begin (p) + , end (p) + {} + + /// Construct a 0-width location in \a f, \a l, \a c. + explicit location (std::string* f, + counter_type l = 1, + counter_type c = 1) + : begin (f, l, c) + , end (f, l, c) + {} + + + /// Initialization. + void initialize (std::string* f = YY_NULLPTR, + counter_type l = 1, + counter_type c = 1) + { + begin.initialize (f, l, c); + end = begin; + } + + /** \name Line and Column related manipulators + ** \{ */ + public: + /// Reset initial location to final location. + void step () + { + begin = end; + } + + /// Extend the current location to the COUNT next columns. + void columns (counter_type count = 1) + { + end += count; + } + + /// Extend the current location to the COUNT next lines. + void lines (counter_type count = 1) + { + end.lines (count); + } + /** \} */ + + + public: + /// Beginning of the located region. + position begin; + /// End of the located region. + position end; + }; + + /// Join two locations, in place. + inline location& + operator+= (location& res, const location& end) + { + res.end = end.end; + return res; + } + + /// Join two locations. + inline location + operator+ (location res, const location& end) + { + return res += end; + } + + /// Add \a width columns to the end position, in place. + inline location& + operator+= (location& res, location::counter_type width) + { + res.columns (width); + return res; + } + + /// Add \a width columns to the end position. + inline location + operator+ (location res, location::counter_type width) + { + return res += width; + } + + /// Subtract \a width columns to the end position, in place. + inline location& + operator-= (location& res, location::counter_type width) + { + return res += -width; + } + + /// Subtract \a width columns to the end position. + inline location + operator- (location res, location::counter_type width) + { + return res -= width; + } + + /// Compare two location objects. + inline bool + operator== (const location& loc1, const location& loc2) + { + return loc1.begin == loc2.begin && loc1.end == loc2.end; + } + + /// Compare two location objects. + inline bool + operator!= (const location& loc1, const location& loc2) + { + return !(loc1 == loc2); + } + + /** \brief Intercept output stream redirection. + ** \param ostr the destination output stream + ** \param loc a reference to the location to redirect + ** + ** Avoid duplicate information. + */ + template + std::basic_ostream& + operator<< (std::basic_ostream& ostr, const location& loc) + { + location::counter_type end_col + = 0 < loc.end.column ? loc.end.column - 1 : 0; + ostr << loc.begin; + if (loc.end.filename + && (!loc.begin.filename + || *loc.begin.filename != *loc.end.filename)) + ostr << '-' << loc.end.filename << ':' << loc.end.line << '.' << end_col; + else if (loc.begin.line < loc.end.line) + ostr << '-' << loc.end.line << '.' << end_col; + else if (loc.begin.column < end_col) + ostr << '-' << end_col; + return ostr; + } + +} // yy +#line 331 "location.hh" + +#endif // !YY_YY_LOCATION_HH_INCLUDED diff --git a/src/options.hh b/src/options.hh index 2ddfdb12d..478cb5f70 100644 --- a/src/options.hh +++ b/src/options.hh @@ -212,6 +212,7 @@ struct Options { return *plotgrammar_stream_; } + // provide option to enable checkpointing routine integration bool checkpointing; diff --git a/src/parser.cc b/src/parser.cc new file mode 100644 index 000000000..704aa5d77 --- /dev/null +++ b/src/parser.cc @@ -0,0 +1,3116 @@ +// A Bison parser, made by GNU Bison 3.5.1. + +// Skeleton implementation for Bison LALR(1) parsers in C++ + +// Copyright (C) 2002-2015, 2018-2020 Free Software Foundation, Inc. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +// As a special exception, you may create a larger work that contains +// part or all of the Bison parser skeleton and distribute that work +// under terms of your choice, so long as that work isn't itself a +// parser generator using the skeleton or a modified version thereof +// as a parser skeleton. Alternatively, if you modify or redistribute +// the parser skeleton itself, you may (at your option) remove this +// special exception, which will cause the skeleton and the resulting +// Bison output files to be licensed under the GNU General Public +// License without this special exception. + +// This special exception was added by the Free Software Foundation in +// version 2.2 of Bison. + +// Undocumented macros, especially those whose name start with YY_, +// are private implementation details. Do not rely on them. + + + +// First part of user prologue. +#line 24 "parser.y" + + +// is pasted into parser.hh && parser.cc +// is pasted into parser.cc since bison 2.4 + +class Driver; + +#ifdef BISONNEW +# define YYLLOC_DEFAULT(Current, Rhs, N) \ +do { \ + if (N) \ + { \ + (Current).begin = YYRHSLOC(Rhs, 1).begin; \ + (Current).end = YYRHSLOC(Rhs, N).end; \ + (Current).setOffset(YYRHSLOC(Rhs, 1).offset()); \ + (Current).set_file(YYRHSLOC(Rhs, 1).file_ptr()); \ + } \ + else \ + { \ + (Current).begin = (Current).end = YYRHSLOC(Rhs, 0).end; \ + (Current).setOffset(YYRHSLOC(Rhs, 0).offset()); \ + (Current).set_file(YYRHSLOC(Rhs, 0).file_ptr()); \ + } \ +} while (false) +#else +# define YYLLOC_DEFAULT(Current, Rhs, N) \ +do { \ + if (N) \ + { \ + (Current).begin = (Rhs)[1].begin; \ + (Current).end = (Rhs)[N].end; \ + (Current).setOffset((Rhs)[1].offset()); \ + (Current).set_file((Rhs)[1].file_ptr()); \ + } \ + else \ + { \ + (Current).begin = (Current).end = (Rhs)[0].end; \ + (Current).setOffset((Rhs)[0].offset()); \ + (Current).set_file((Rhs)[0].file_ptr()); \ + } \ +} while (false) +#endif + + +#line 85 "parser.cc" + + +#include "parser.hh" + +// Second part of user prologue. +#line 163 "parser.y" + +// is pasted only into parser.cc + +#include +// FIXME +#include + + +#include "loc.hh" + + + +#include "ast.hh" +#include "fn_arg.hh" +#include "type.hh" +#include "type/multi.hh" +#include "para_decl.hh" +#include "signature.hh" +#include "fn_def.hh" +#include "product.hh" +#include "instance.hh" +#include "var_acc.hh" +#include "expr.hh" +#include "const.hh" +#include "statement.hh" +#include "statement/fn_call.hh" +#include "statement/while.hh" +#include "filter.hh" +#include "arg.hh" + + +#include "driver.hh" +#include "lexer.h" +YY_DECL; + +#line 127 "parser.cc" + + + +#ifndef YY_ +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include // FIXME: INFRINGES ON USER NAME SPACE. +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +// Whether we are compiled with exception support. +#ifndef YY_EXCEPTIONS +# if defined __GNUC__ && !defined __EXCEPTIONS +# define YY_EXCEPTIONS 0 +# else +# define YY_EXCEPTIONS 1 +# endif +#endif + +#define YYRHSLOC(Rhs, K) ((Rhs)[K].location) +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +# ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (N) \ + { \ + (Current).begin = YYRHSLOC (Rhs, 1).begin; \ + (Current).end = YYRHSLOC (Rhs, N).end; \ + } \ + else \ + { \ + (Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \ + } \ + while (false) +# endif + + +// Enable debugging if requested. +#if YYDEBUG + +// A pseudo ostream that takes yydebug_ into account. +# define YYCDEBUG if (yydebug_) (*yycdebug_) + +# define YY_SYMBOL_PRINT(Title, Symbol) \ + do { \ + if (yydebug_) \ + { \ + *yycdebug_ << Title << ' '; \ + yy_print_ (*yycdebug_, Symbol); \ + *yycdebug_ << '\n'; \ + } \ + } while (false) + +# define YY_REDUCE_PRINT(Rule) \ + do { \ + if (yydebug_) \ + yy_reduce_print_ (Rule); \ + } while (false) + +# define YY_STACK_PRINT() \ + do { \ + if (yydebug_) \ + yystack_print_ (); \ + } while (false) + +#else // !YYDEBUG + +# define YYCDEBUG if (false) std::cerr +# define YY_SYMBOL_PRINT(Title, Symbol) YYUSE (Symbol) +# define YY_REDUCE_PRINT(Rule) static_cast (0) +# define YY_STACK_PRINT() static_cast (0) + +#endif // !YYDEBUG + +#define yyerrok (yyerrstatus_ = 0) +#define yyclearin (yyla.clear ()) + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab +#define YYRECOVERING() (!!yyerrstatus_) + +namespace yy { +#line 219 "parser.cc" + + + /* Return YYSTR after stripping away unnecessary quotes and + backslashes, so that it's suitable for yyerror. The heuristic is + that double-quoting is unnecessary unless the string contains an + apostrophe, a comma, or backslash (other than backslash-backslash). + YYSTR is taken from yytname. */ + std::string + Parser::yytnamerr_ (const char *yystr) + { + if (*yystr == '"') + { + std::string yyr; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + else + goto append; + + append: + default: + yyr += *yyp; + break; + + case '"': + return yyr; + } + do_not_strip_quotes: ; + } + + return yystr; + } + + + /// Build a parser object. + Parser::Parser (Driver& driver_yyarg, yy::Parser::token_type start_symbol_yyarg) +#if YYDEBUG + : yydebug_ (false), + yycdebug_ (&std::cerr), +#else + : +#endif + driver (driver_yyarg), + start_symbol (start_symbol_yyarg) + {} + + Parser::~Parser () + {} + + Parser::syntax_error::~syntax_error () YY_NOEXCEPT YY_NOTHROW + {} + + /*---------------. + | Symbol types. | + `---------------*/ + + // basic_symbol. +#if 201103L <= YY_CPLUSPLUS + template + Parser::basic_symbol::basic_symbol (basic_symbol&& that) + : Base (std::move (that)) + , value (std::move (that.value)) + , location (std::move (that.location)) + {} +#endif + + template + Parser::basic_symbol::basic_symbol (const basic_symbol& that) + : Base (that) + , value (that.value) + , location (that.location) + {} + + + /// Constructor for valueless symbols. + template + Parser::basic_symbol::basic_symbol (typename Base::kind_type t, YY_MOVE_REF (location_type) l) + : Base (t) + , value () + , location (l) + {} + + template + Parser::basic_symbol::basic_symbol (typename Base::kind_type t, YY_RVREF (semantic_type) v, YY_RVREF (location_type) l) + : Base (t) + , value (YY_MOVE (v)) + , location (YY_MOVE (l)) + {} + + template + bool + Parser::basic_symbol::empty () const YY_NOEXCEPT + { + return Base::type_get () == empty_symbol; + } + + template + void + Parser::basic_symbol::move (basic_symbol& s) + { + super_type::move (s); + value = YY_MOVE (s.value); + location = YY_MOVE (s.location); + } + + // by_type. + Parser::by_type::by_type () + : type (empty_symbol) + {} + +#if 201103L <= YY_CPLUSPLUS + Parser::by_type::by_type (by_type&& that) + : type (that.type) + { + that.clear (); + } +#endif + + Parser::by_type::by_type (const by_type& that) + : type (that.type) + {} + + Parser::by_type::by_type (token_type t) + : type (yytranslate_ (t)) + {} + + void + Parser::by_type::clear () + { + type = empty_symbol; + } + + void + Parser::by_type::move (by_type& that) + { + type = that.type; + that.clear (); + } + + int + Parser::by_type::type_get () const YY_NOEXCEPT + { + return type; + } + + + // by_state. + Parser::by_state::by_state () YY_NOEXCEPT + : state (empty_state) + {} + + Parser::by_state::by_state (const by_state& that) YY_NOEXCEPT + : state (that.state) + {} + + void + Parser::by_state::clear () YY_NOEXCEPT + { + state = empty_state; + } + + void + Parser::by_state::move (by_state& that) + { + state = that.state; + that.clear (); + } + + Parser::by_state::by_state (state_type s) YY_NOEXCEPT + : state (s) + {} + + Parser::symbol_number_type + Parser::by_state::type_get () const YY_NOEXCEPT + { + if (state == empty_state) + return empty_symbol; + else + return yystos_[+state]; + } + + Parser::stack_symbol_type::stack_symbol_type () + {} + + Parser::stack_symbol_type::stack_symbol_type (YY_RVREF (stack_symbol_type) that) + : super_type (YY_MOVE (that.state), YY_MOVE (that.value), YY_MOVE (that.location)) + { +#if 201103L <= YY_CPLUSPLUS + // that is emptied. + that.state = empty_state; +#endif + } + + Parser::stack_symbol_type::stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) that) + : super_type (s, YY_MOVE (that.value), YY_MOVE (that.location)) + { + // that is emptied. + that.type = empty_symbol; + } + +#if YY_CPLUSPLUS < 201103L + Parser::stack_symbol_type& + Parser::stack_symbol_type::operator= (const stack_symbol_type& that) + { + state = that.state; + value = that.value; + location = that.location; + return *this; + } + + Parser::stack_symbol_type& + Parser::stack_symbol_type::operator= (stack_symbol_type& that) + { + state = that.state; + value = that.value; + location = that.location; + // that is emptied. + that.state = empty_state; + return *this; + } +#endif + + template + void + Parser::yy_destroy_ (const char* yymsg, basic_symbol& yysym) const + { + if (yymsg) + YY_SYMBOL_PRINT (yymsg, yysym); + + // User destructor. + YYUSE (yysym.type_get ()); + } + +#if YYDEBUG + template + void + Parser::yy_print_ (std::ostream& yyo, + const basic_symbol& yysym) const + { + std::ostream& yyoutput = yyo; + YYUSE (yyoutput); + symbol_number_type yytype = yysym.type_get (); +#if defined __GNUC__ && ! defined __clang__ && ! defined __ICC && __GNUC__ * 100 + __GNUC_MINOR__ <= 408 + // Avoid a (spurious) G++ 4.8 warning about "array subscript is + // below array bounds". + if (yysym.empty ()) + std::abort (); +#endif + yyo << (yytype < yyntokens_ ? "token" : "nterm") + << ' ' << yytname_[yytype] << " (" + << yysym.location << ": "; + YYUSE (yytype); + yyo << ')'; + } +#endif + + void + Parser::yypush_ (const char* m, YY_MOVE_REF (stack_symbol_type) sym) + { + if (m) + YY_SYMBOL_PRINT (m, sym); + yystack_.push (YY_MOVE (sym)); + } + + void + Parser::yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym) + { +#if 201103L <= YY_CPLUSPLUS + yypush_ (m, stack_symbol_type (s, std::move (sym))); +#else + stack_symbol_type ss (s, sym); + yypush_ (m, ss); +#endif + } + + void + Parser::yypop_ (int n) + { + yystack_.pop (n); + } + +#if YYDEBUG + std::ostream& + Parser::debug_stream () const + { + return *yycdebug_; + } + + void + Parser::set_debug_stream (std::ostream& o) + { + yycdebug_ = &o; + } + + + Parser::debug_level_type + Parser::debug_level () const + { + return yydebug_; + } + + void + Parser::set_debug_level (debug_level_type l) + { + yydebug_ = l; + } +#endif // YYDEBUG + + Parser::state_type + Parser::yy_lr_goto_state_ (state_type yystate, int yysym) + { + int yyr = yypgoto_[yysym - yyntokens_] + yystate; + if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate) + return yytable_[yyr]; + else + return yydefgoto_[yysym - yyntokens_]; + } + + bool + Parser::yy_pact_value_is_default_ (int yyvalue) + { + return yyvalue == yypact_ninf_; + } + + bool + Parser::yy_table_value_is_error_ (int yyvalue) + { + return yyvalue == yytable_ninf_; + } + + int + Parser::operator() () + { + return parse (); + } + + int + Parser::parse () + { + int yyn; + /// Length of the RHS of the rule being reduced. + int yylen = 0; + + // Error handling. + int yynerrs_ = 0; + int yyerrstatus_ = 0; + + /// The lookahead symbol. + symbol_type yyla; + + /// The locations where the error started and ended. + stack_symbol_type yyerror_range[3]; + + /// The return value of parse (). + int yyresult; + +#if YY_EXCEPTIONS + try +#endif // YY_EXCEPTIONS + { + YYCDEBUG << "Starting parse\n"; + + + // User initialization code. +#line 82 "parser.y" +{ +yyla.location.begin.filename = yyla.location.end.filename = driver.filename(); +} + +#line 598 "parser.cc" + + + /* Initialize the stack. The initial state will be set in + yynewstate, since the latter expects the semantical and the + location values to have been already stored, initialize these + stacks with a primary value. */ + yystack_.clear (); + yypush_ (YY_NULLPTR, 0, YY_MOVE (yyla)); + + /*-----------------------------------------------. + | yynewstate -- push a new symbol on the stack. | + `-----------------------------------------------*/ + yynewstate: + YYCDEBUG << "Entering state " << int (yystack_[0].state) << '\n'; + + // Accept? + if (yystack_[0].state == yyfinal_) + YYACCEPT; + + goto yybackup; + + + /*-----------. + | yybackup. | + `-----------*/ + yybackup: + // Try to take a decision without lookahead. + yyn = yypact_[+yystack_[0].state]; + if (yy_pact_value_is_default_ (yyn)) + goto yydefault; + + // Read a lookahead token. + if (yyla.empty ()) + { + YYCDEBUG << "Reading a token: "; +#if YY_EXCEPTIONS + try +#endif // YY_EXCEPTIONS + { + yyla.type = yytranslate_ (yylex (&yyla.value, &yyla.location, start_symbol)); + } +#if YY_EXCEPTIONS + catch (const syntax_error& yyexc) + { + YYCDEBUG << "Caught exception: " << yyexc.what() << '\n'; + error (yyexc); + goto yyerrlab1; + } +#endif // YY_EXCEPTIONS + } + YY_SYMBOL_PRINT ("Next token is", yyla); + + /* If the proper action on seeing token YYLA.TYPE is to reduce or + to detect an error, take that action. */ + yyn += yyla.type_get (); + if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yyla.type_get ()) + { + goto yydefault; + } + + // Reduce or error. + yyn = yytable_[yyn]; + if (yyn <= 0) + { + if (yy_table_value_is_error_ (yyn)) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + // Count tokens shifted since error; after three, turn off error status. + if (yyerrstatus_) + --yyerrstatus_; + + // Shift the lookahead token. + yypush_ ("Shifting", state_type (yyn), YY_MOVE (yyla)); + goto yynewstate; + + + /*-----------------------------------------------------------. + | yydefault -- do the default action for the current state. | + `-----------------------------------------------------------*/ + yydefault: + yyn = yydefact_[+yystack_[0].state]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + + /*-----------------------------. + | yyreduce -- do a reduction. | + `-----------------------------*/ + yyreduce: + yylen = yyr2_[yyn]; + { + stack_symbol_type yylhs; + yylhs.state = yy_lr_goto_state_ (yystack_[yylen].state, yyr1_[yyn]); + /* If YYLEN is nonzero, implement the default value of the + action: '$$ = $1'. Otherwise, use the top of the stack. + + Otherwise, the following line sets YYLHS.VALUE to garbage. + This behavior is undocumented and Bison users should not rely + upon it. */ + if (yylen) + yylhs.value = yystack_[yylen - 1].value; + else + yylhs.value = yystack_[0].value; + + // Default location. + { + stack_type::slice range (yystack_, yylen); + YYLLOC_DEFAULT (yylhs.location, range, yylen); + yyerror_range[1].location = yylhs.location; + } + + // Perform the reduction. + YY_REDUCE_PRINT (yyn); +#if YY_EXCEPTIONS + try +#endif // YY_EXCEPTIONS + { + switch (yyn) + { + case 3: +#line 371 "parser.y" + { driver.ast.algebra_seen.clear(); } +#line 725 "parser.cc" + break; + + case 4: +#line 371 "parser.y" + { driver.ast.set_product((yystack_[0].value.product)); } +#line 731 "parser.cc" + break; + + case 5: +#line 385 "parser.y" + { + driver.ast.set_grammars((yystack_[0].value.grammars)); + } +#line 739 "parser.cc" + break; + + case 11: +#line 401 "parser.y" + { driver.ast.imports.push_back(new Import((yystack_[0].value.sval), yylhs.location)); } +#line 745 "parser.cc" + break; + + case 12: +#line 402 "parser.y" + { driver.ast.imports.push_back(new Import((yystack_[1].value.sval), true, yylhs.location)); } +#line 751 "parser.cc" + break; + + case 13: +#line 414 "parser.y" + { (yylhs.value.sval) = (yystack_[0].value.sval); } +#line 757 "parser.cc" + break; + + case 14: +#line 421 "parser.y" + { + driver.ast.input.set(*(yystack_[0].value.sval), yystack_[0].location); + delete((yystack_[0].value.sval)); + } +#line 766 "parser.cc" + break; + + case 15: +#line 427 "parser.y" + { + driver.ast.input.set(*(yystack_[1].value.inputs), yystack_[1].location); + delete((yystack_[1].value.inputs)); + } +#line 775 "parser.cc" + break; + + case 17: +#line 434 "parser.y" + { + std::list *l = new std::list(); + l->push_back((yystack_[0].value.sval)); + (yylhs.value.inputs) = l; + } +#line 785 "parser.cc" + break; + + case 18: +#line 441 "parser.y" + { + (yystack_[2].value.inputs)->push_back((yystack_[0].value.sval)); + (yylhs.value.inputs) = (yystack_[2].value.inputs); + } +#line 794 "parser.cc" + break; + + case 19: +#line 446 "parser.y" + { (yylhs.value.sval) = (yystack_[0].value.sval); } +#line 800 "parser.cc" + break; + + case 20: +#line 483 "parser.y" + { (yylhs.value.sval) = (yystack_[0].value.sval); } +#line 806 "parser.cc" + break; + + case 25: +#line 493 "parser.y" + { driver.ast.add_type((yystack_[2].value.sval), yystack_[2].location, new Type::Def((yystack_[2].value.sval), yystack_[2].location, (yystack_[0].value.datatype))); } +#line 812 "parser.cc" + break; + + case 26: +#line 496 "parser.y" + { driver.ast.add_type((yystack_[2].value.sval), yystack_[2].location, new Type::External((yystack_[2].value.sval), yystack_[2].location)); } +#line 818 "parser.cc" + break; + + case 27: +#line 506 "parser.y" + { (yylhs.value.datatype) = new Type::Usage(driver.ast.get_type(*(yystack_[0].value.sval), yystack_[0].location), yystack_[0].location); } +#line 824 "parser.cc" + break; + + case 28: +#line 508 "parser.y" + { (yylhs.value.datatype) = new Type::Usage( + driver.ast.get_type(std::string("alphabet"), yystack_[0].location), yystack_[0].location); } +#line 831 "parser.cc" + break; + + case 29: +#line 511 "parser.y" + { (yylhs.value.datatype) = new Type::Usage( + driver.ast.get_type(std::string("void"), yystack_[0].location), yystack_[0].location); } +#line 838 "parser.cc" + break; + + case 30: +#line 514 "parser.y" + { (yylhs.value.datatype) = new Type::List(driver.ast.get_type(*(yystack_[1].value.sval), yystack_[1].location), yylhs.location); } +#line 844 "parser.cc" + break; + + case 31: +#line 517 "parser.y" + { Type::Tuple *t = new Type::TupleDef(yylhs.location); + t->init((yystack_[1].value.named_datatypes)); + delete (yystack_[1].value.named_datatypes); + (yylhs.value.datatype) = t; } +#line 853 "parser.cc" + break; + + case 32: +#line 546 "parser.y" + { (yylhs.value.sval) = (yystack_[0].value.sval); } +#line 859 "parser.cc" + break; + + case 33: +#line 551 "parser.y" + { Tuple_List *l = new Tuple_List(); + l->push_back((yystack_[0].value.named_datatype)); + (yylhs.value.named_datatypes) = l; } +#line 867 "parser.cc" + break; + + case 34: +#line 556 "parser.y" + { (yystack_[2].value.named_datatypes)->push_back((yystack_[0].value.named_datatype)); } +#line 873 "parser.cc" + break; + + case 35: +#line 559 "parser.y" + { (yylhs.value.named_datatype) = new Tuple_Pair(new Type::Name((yystack_[1].value.datatype), yystack_[0].location), (yystack_[0].value.sval)); } +#line 879 "parser.cc" + break; + + case 36: +#line 569 "parser.y" + { (yylhs.value.sval) = (yystack_[0].value.sval); } +#line 885 "parser.cc" + break; + + case 37: +#line 575 "parser.y" + { Signature *s = new Signature((yystack_[3].value.sval), yystack_[4].location + yystack_[3].location); + driver.ast.add_sig_types(*(yystack_[1].value.args), s); + (yylhs.value.signature) = s; } +#line 893 "parser.cc" + break; + + case 38: +#line 578 "parser.y" + { Signature *s = (yystack_[3].value.signature); + s->set_args(*(yystack_[5].value.args)); + delete (yystack_[5].value.args); + s->setDecls(*(yystack_[1].value.sig_decls)); + delete (yystack_[1].value.sig_decls); + driver.ast.signature = s; + hashtable::iterator i = + driver.ast.types.find("alphabet"); + assert(i != driver.ast.types.end()); + dynamic_cast(i->second)->signature = s; + (yylhs.value.signature) = s; } +#line 909 "parser.cc" + break; + + case 39: +#line 592 "parser.y" + { std::string *s = new std::string("alphabet"); + Arg::add_arg(*(yystack_[1].value.args), new Arg(s, yystack_[3].location)); + (yylhs.value.args) = (yystack_[1].value.args); + } +#line 918 "parser.cc" + break; + + case 40: +#line 607 "parser.y" + { hashtable *h = + new hashtable(); + Arg::add_arg(*h, (yystack_[0].value.arg)); + (yylhs.value.args) = h; } +#line 927 "parser.cc" + break; + + case 41: +#line 613 "parser.y" + { Arg::add_arg(*(yystack_[2].value.args), (yystack_[0].value.arg)); + (yylhs.value.args) = (yystack_[2].value.args); } +#line 934 "parser.cc" + break; + + case 42: +#line 616 "parser.y" + { (yylhs.value.arg) = new Arg((yystack_[0].value.sval), yystack_[0].location); } +#line 940 "parser.cc" + break; + + case 43: +#line 621 "parser.y" + { (yylhs.value.datatypes) = (yystack_[0].value.datatypes); } +#line 946 "parser.cc" + break; + + case 44: +#line 623 "parser.y" + { (yylhs.value.datatypes) = 0; } +#line 952 "parser.cc" + break; + + case 45: +#line 628 "parser.y" + { hashtable *h = + new hashtable(); + Fn_Decl::add_fn_decl(h, (yystack_[1].value.fn_decl)); + (yylhs.value.sig_decls) = h; } +#line 961 "parser.cc" + break; + + case 46: +#line 634 "parser.y" + { Fn_Decl::add_fn_decl((yystack_[2].value.sig_decls), (yystack_[1].value.fn_decl)); + (yylhs.value.sig_decls) = (yystack_[2].value.sig_decls); } +#line 968 "parser.cc" + break; + + case 47: +#line 639 "parser.y" + { Fn_Decl *f = new Fn_Decl((yystack_[5].value.datatype), (yystack_[4].value.sval), yystack_[4].location); + f->set_types((yystack_[2].value.datatypes)); + delete (yystack_[2].value.datatypes); + f->set_nttypes((yystack_[1].value.datatypes)); + delete (yystack_[1].value.datatypes); + (yylhs.value.fn_decl) = f; } +#line 979 "parser.cc" + break; + + case 48: +#line 653 "parser.y" + { (yylhs.value.datatype) = (yystack_[0].value.datatype); } +#line 985 "parser.cc" + break; + + case 49: +#line 654 "parser.y" + { (yylhs.value.datatype) = new Type::Choice((yystack_[0].value.datatype), yystack_[1].location+yystack_[0].location); } +#line 991 "parser.cc" + break; + + case 50: +#line 665 "parser.y" + { + std::list *l = new std::list(); + l->push_back((yystack_[0].value.datatype)); + (yylhs.value.datatypes) = l; + } +#line 1001 "parser.cc" + break; + + case 51: +#line 672 "parser.y" + { + (yystack_[2].value.datatypes)->push_back((yystack_[0].value.datatype)); + (yylhs.value.datatypes) = (yystack_[2].value.datatypes); + } +#line 1010 "parser.cc" + break; + + case 52: +#line 678 "parser.y" + { + Type::Multi *m = new Type::Multi(*(yystack_[1].value.datatypes), yylhs.location); + delete (yystack_[1].value.datatypes); + (yylhs.value.datatype) = m; + } +#line 1020 "parser.cc" + break; + + case 53: +#line 685 "parser.y" + { + (yylhs.value.datatype) = (yystack_[0].value.datatype); + } +#line 1028 "parser.cc" + break; + + case 54: +#line 699 "parser.y" + { + std::list *l = new std::list(); + l->push_back((yystack_[0].value.datatype)); + (yylhs.value.datatypes) = l; + } +#line 1038 "parser.cc" + break; + + case 55: +#line 706 "parser.y" + { + (yystack_[2].value.datatypes)->push_back((yystack_[0].value.datatype)); + (yylhs.value.datatypes) = (yystack_[2].value.datatypes); + } +#line 1047 "parser.cc" + break; + + case 60: +#line 733 "parser.y" + { if (driver.ast.algebras.find(*(yystack_[3].value.algebra)->name) != driver.ast.algebras.end()){ + error((yystack_[3].value.algebra)->location, "Algebra " + *(yystack_[3].value.algebra)->name + + " already defined "); + error(driver.ast.algebras[*(yystack_[3].value.algebra)->name]->location, "here."); + } else { + (yystack_[3].value.algebra)->set_fns(*(yystack_[1].value.fn_defs)); + delete (yystack_[1].value.fn_defs); + (yystack_[3].value.algebra)->check_params(*driver.ast.signature); + driver.ast.algebras[*(yystack_[3].value.algebra)->name] = (yystack_[3].value.algebra); + } + } +#line 1063 "parser.cc" + break; + + case 61: +#line 746 "parser.y" + { + if (driver.ast.algebras.find(*(yystack_[3].value.sval)) + != driver.ast.algebras.end()) { + error(yystack_[3].location, "Algebra " + *(yystack_[3].value.sval) + + " already defined "); + error(driver.ast.algebras[*(yystack_[3].value.sval)]->location, "here."); + } else { + Algebra *algebra = driver.ast.signature->generate((yystack_[3].value.sval), (yystack_[1].value.sval)); + if (algebra) + driver.ast.algebras[*(yystack_[3].value.sval)] = algebra; + else + error(yystack_[1].location, "Unknown automatic modifier " + *(yystack_[1].value.sval) + + ". Use something like count ..."); + } + } +#line 1083 "parser.cc" + break; + + case 62: +#line 785 "parser.y" + { (yylhs.value.sval) = (yystack_[0].value.sval); } +#line 1089 "parser.cc" + break; + + case 63: +#line 789 "parser.y" + { (yylhs.value.sval) = (yystack_[0].value.sval); } +#line 1095 "parser.cc" + break; + + case 64: +#line 799 "parser.y" + { + if (*(yystack_[3].value.sval) != *driver.ast.signature->name) + error(yystack_[3].location, "Unknown signature " + *(yystack_[3].value.sval) + "."); + Algebra *a = new Algebra((yystack_[6].value.sval), (yystack_[3].value.sval), yystack_[7].location+yystack_[6].location); + a->set_default_choice_fn_mode((yystack_[8].value.sval)); + a->set_params((yystack_[1].value.eqs)); + delete (yystack_[1].value.eqs); + (yylhs.value.algebra) = a; } +#line 1108 "parser.cc" + break; + + case 65: +#line 809 "parser.y" + { + if (*(yystack_[3].value.sval) != *driver.ast.signature->name) + error(yystack_[3].location, "Unknown signature " + *(yystack_[3].value.sval) + "."); + Algebra *a = new Algebra((yystack_[6].value.sval), (yystack_[3].value.sval), yystack_[7].location+yystack_[6].location); + a->set_params((yystack_[1].value.eqs)); + delete (yystack_[1].value.eqs); + (yylhs.value.algebra) = a; } +#line 1120 "parser.cc" + break; + + case 66: +#line 818 "parser.y" + { + Algebra *a = new Algebra((yystack_[3].value.sval), yystack_[4].location+yystack_[3].location); + if (driver.ast.algebras.find(*(yystack_[0].value.sval)) == driver.ast.algebras.end()) + error(yystack_[1].location+yystack_[0].location, *(yystack_[0].value.sval) + " unknown!"); + else + *a = *(driver.ast.algebras[*(yystack_[0].value.sval)]->copy()); + (yylhs.value.algebra) = a; } +#line 1132 "parser.cc" + break; + + case 73: +#line 863 "parser.y" + { (yylhs.value.statement) = new Statement::Var_Decl((yystack_[4].value.datatype), (yystack_[3].value.sval), (yystack_[1].value.expr), yystack_[4].location); } +#line 1138 "parser.cc" + break; + + case 74: +#line 867 "parser.y" + { (yylhs.value.statement) = new Statement::Var_Decl((yystack_[4].value.datatype), (yystack_[3].value.sval), (yystack_[1].value.expr), yystack_[4].location); } +#line 1144 "parser.cc" + break; + + case 75: +#line 879 "parser.y" + { (yylhs.value.statement) = new Statement::Var_Decl((yystack_[4].value.datatype), (yystack_[3].value.sval), (yystack_[1].value.expr), yystack_[4].location); } +#line 1150 "parser.cc" + break; + + case 76: +#line 883 "parser.y" + { (yylhs.value.statement) = new Statement::Var_Decl((yystack_[2].value.datatype), (yystack_[1].value.sval), yystack_[2].location); } +#line 1156 "parser.cc" + break; + + case 77: +#line 886 "parser.y" + { (yylhs.value.statement) = (yystack_[0].value.statement); } +#line 1162 "parser.cc" + break; + + case 78: +#line 890 "parser.y" + { (yylhs.value.sval) = (yystack_[0].value.sval); } +#line 1168 "parser.cc" + break; + + case 79: +#line 890 "parser.y" + { (yylhs.value.sval) = (yystack_[0].value.sval); } +#line 1174 "parser.cc" + break; + + case 80: +#line 892 "parser.y" + { (yylhs.value.sval) = (yystack_[0].value.sval); } +#line 1180 "parser.cc" + break; + + case 81: +#line 892 "parser.y" + { (yylhs.value.sval) = (yystack_[0].value.sval); } +#line 1186 "parser.cc" + break; + + case 82: +#line 897 "parser.y" + { hashtable *h = + new hashtable(); + Algebra::add_sig_var(*h, *(yystack_[0].value.eq), yystack_[0].location); + delete (yystack_[0].value.eq)->first; + delete (yystack_[0].value.eq); + (yylhs.value.eqs) = h; } +#line 1197 "parser.cc" + break; + + case 83: +#line 904 "parser.y" + { Algebra::add_sig_var(*(yystack_[2].value.eqs), *(yystack_[0].value.eq), yystack_[0].location); + delete (yystack_[0].value.eq)->first; + delete (yystack_[0].value.eq); + (yylhs.value.eqs) = (yystack_[2].value.eqs); } +#line 1206 "parser.cc" + break; + + case 84: +#line 910 "parser.y" + { yylhs.location= yystack_[2].location; + (yylhs.value.eq) = new std::pair((yystack_[2].value.sval), (yystack_[0].value.datatype)); } +#line 1213 "parser.cc" + break; + + case 85: +#line 913 "parser.y" + { driver.ast.get_type(*(yystack_[0].value.sval), yystack_[0].location); (yylhs.value.sval) = (yystack_[0].value.sval); } +#line 1219 "parser.cc" + break; + + case 86: +#line 914 "parser.y" + { (yylhs.value.sval) = new std::string("alphabet"); } +#line 1225 "parser.cc" + break; + + case 87: +#line 918 "parser.y" + { (yylhs.value.sval) = (yystack_[0].value.sval); } +#line 1231 "parser.cc" + break; + + case 88: +#line 925 "parser.y" + { + hashtable *h = + new hashtable(); + (yylhs.value.fn_defs) = h; + } +#line 1241 "parser.cc" + break; + + case 89: +#line 932 "parser.y" + { hashtable::iterator i = (yystack_[1].value.fn_defs)->find(*(yystack_[0].value.fn_def)->name); + if (i != (yystack_[1].value.fn_defs)->end()) { + error((yystack_[0].value.fn_def)->location, "Algebra function " + *(yystack_[0].value.fn_def)->name+ " redefined"); + error(i->second->location, "here."); + } else { + (*(yystack_[1].value.fn_defs))[*(yystack_[0].value.fn_def)->name] = (yystack_[0].value.fn_def); + } + (yylhs.value.fn_defs) = (yystack_[1].value.fn_defs); + } +#line 1255 "parser.cc" + break; + + case 90: +#line 944 "parser.y" + { Fn_Def *f = new Fn_Def((yystack_[8].value.datatype), (yystack_[7].value.sval), yystack_[7].location); + f->set_paras(*(yystack_[5].value.para_decls)); + delete (yystack_[5].value.para_decls); + f->set_ntparas((yystack_[4].value.para_decls)); + delete (yystack_[4].value.para_decls); + f->set_statements(*(yystack_[1].value.statements)); + delete((yystack_[1].value.statements)); + f->set_mode((yystack_[9].value.sval)); + delete (yystack_[9].value.sval); + (yylhs.value.fn_def) = f; + } +#line 1271 "parser.cc" + break; + + case 91: +#line 957 "parser.y" + { (yylhs.value.para_decls) = (yystack_[0].value.para_decls); } +#line 1277 "parser.cc" + break; + + case 92: +#line 959 "parser.y" + { (yylhs.value.para_decls) = 0; } +#line 1283 "parser.cc" + break; + + case 93: +#line 962 "parser.y" + { (yylhs.value.sval) = (yystack_[0].value.sval); } +#line 1289 "parser.cc" + break; + + case 94: +#line 962 "parser.y" + { (yylhs.value.sval) = 0; } +#line 1295 "parser.cc" + break; + + case 95: +#line 964 "parser.y" + { + (yylhs.value.para_decls) = new std::list(); + } +#line 1303 "parser.cc" + break; + + case 96: +#line 968 "parser.y" + { + std::list *l = + new std::list(); + l->push_back((yystack_[0].value.para_decl)); + (yylhs.value.para_decls) = l; + } +#line 1314 "parser.cc" + break; + + case 97: +#line 974 "parser.y" + { + (yystack_[2].value.para_decls)->push_back((yystack_[0].value.para_decl)); + (yylhs.value.para_decls) = (yystack_[2].value.para_decls); + } +#line 1323 "parser.cc" + break; + + case 98: +#line 980 "parser.y" + { (yylhs.value.para_decl) = new Para_Decl::Simple((yystack_[1].value.datatype), (yystack_[0].value.sval), yylhs.location); } +#line 1329 "parser.cc" + break; + + case 99: +#line 983 "parser.y" + { + Para_Decl::Multi *m = new Para_Decl::Multi(*(yystack_[1].value.para_decls), yylhs.location); + delete (yystack_[1].value.para_decls); + (yylhs.value.para_decl) = m; + } +#line 1339 "parser.cc" + break; + + case 100: +#line 989 "parser.y" + { + static unsigned x = 0; + std::ostringstream o; + o << "VOID_INTERNAL" << x++; + (yylhs.value.para_decl) = new Para_Decl::Simple + (new Type::Void(yystack_[0].location), new std::string(o.str())); + } +#line 1351 "parser.cc" + break; + + case 101: +#line 1048 "parser.y" + { std::list *l = + new std::list(); + l->push_back((yystack_[0].value.statement)); + (yylhs.value.statements) = l; } +#line 1360 "parser.cc" + break; + + case 102: +#line 1054 "parser.y" + { (yystack_[1].value.statements)->push_back((yystack_[0].value.statement)); + (yylhs.value.statements) = (yystack_[1].value.statements); } +#line 1367 "parser.cc" + break; + + case 103: +#line 1059 "parser.y" + { (yylhs.value.statement) = (yystack_[0].value.statement); } +#line 1373 "parser.cc" + break; + + case 104: +#line 1060 "parser.y" + { (yylhs.value.statement) = (yystack_[0].value.statement); } +#line 1379 "parser.cc" + break; + + case 105: +#line 1061 "parser.y" + { (yylhs.value.statement) = (yystack_[0].value.statement); } +#line 1385 "parser.cc" + break; + + case 106: +#line 1062 "parser.y" + { (yylhs.value.statement) = (yystack_[0].value.statement); } +#line 1391 "parser.cc" + break; + + case 107: +#line 1063 "parser.y" + { (yylhs.value.statement) = (yystack_[0].value.statement); } +#line 1397 "parser.cc" + break; + + case 108: +#line 1064 "parser.y" + { (yylhs.value.statement) = (yystack_[0].value.statement); } +#line 1403 "parser.cc" + break; + + case 109: +#line 1065 "parser.y" + { (yylhs.value.statement) = (yystack_[0].value.statement); } +#line 1409 "parser.cc" + break; + + case 110: +#line 1066 "parser.y" + { (yylhs.value.statement) = (yystack_[0].value.statement); } +#line 1415 "parser.cc" + break; + + case 111: +#line 1067 "parser.y" + { (yylhs.value.statement) = (yystack_[0].value.statement); } +#line 1421 "parser.cc" + break; + + case 112: +#line 1068 "parser.y" + { (yylhs.value.statement) = new Statement::Block(*(yystack_[1].value.statements), yystack_[2].location); } +#line 1427 "parser.cc" + break; + + case 113: +#line 1071 "parser.y" + { (yylhs.value.statement) = new Statement::Continue(yystack_[1].location); } +#line 1433 "parser.cc" + break; + + case 114: +#line 1073 "parser.y" + { (yylhs.value.statement) = new Statement::Break(yystack_[1].location); } +#line 1439 "parser.cc" + break; + + case 115: +#line 1076 "parser.y" + { (yylhs.value.statement) = new Statement::Fn_Call((yystack_[4].value.sval), (yystack_[2].value.exprs), yystack_[4].location); + delete (yystack_[2].value.exprs); + } +#line 1447 "parser.cc" + break; + + case 116: +#line 1082 "parser.y" + { (yylhs.value.statement) = new Statement::Return((yystack_[1].value.expr), yystack_[2].location); } +#line 1453 "parser.cc" + break; + + case 117: +#line 1088 "parser.y" + { (yylhs.value.statement) = new Statement::If((yystack_[2].value.expr), (yystack_[0].value.statement), yystack_[4].location); } +#line 1459 "parser.cc" + break; + + case 118: +#line 1091 "parser.y" + { (yylhs.value.statement) = new Statement::If((yystack_[4].value.expr), (yystack_[2].value.statement), (yystack_[0].value.statement), yystack_[6].location); } +#line 1465 "parser.cc" + break; + + case 119: +#line 1104 "parser.y" + { + Statement::For *f = new Statement::For(dynamic_cast((yystack_[5].value.statement)), (yystack_[4].value.expr), (yystack_[2].value.statement), yystack_[7].location); + if ((yystack_[0].value.statement)->is(Statement::BLOCK)) { + Statement::Block *b = dynamic_cast((yystack_[0].value.statement)); + f->statements = b->statements; + delete b; + } else + f->push_back((yystack_[0].value.statement)); + (yylhs.value.statement) = f; + } +#line 1480 "parser.cc" + break; + + case 120: +#line 1117 "parser.y" + { + Statement::While *w = new Statement::While((yystack_[2].value.expr), yystack_[4].location); + if ((yystack_[0].value.statement)->is(Statement::BLOCK)) { + Statement::Block *b = dynamic_cast((yystack_[0].value.statement)); + w->statements = b->statements; + delete b; + } else + w->push_back((yystack_[0].value.statement)); + (yylhs.value.statement) = w; + } +#line 1495 "parser.cc" + break; + + case 121: +#line 1129 "parser.y" + { (yylhs.value.statement) = new Statement::Var_Assign((yystack_[3].value.var_acc), (yystack_[1].value.expr), yystack_[2].location); } +#line 1501 "parser.cc" + break; + + case 122: +#line 1136 "parser.y" + { (yylhs.value.statement) = new Statement::Var_Assign((yystack_[2].value.var_acc), (yystack_[0].value.expr), yystack_[1].location); } +#line 1507 "parser.cc" + break; + + case 123: +#line 1154 "parser.y" + { (yylhs.value.var_acc) = new Var_Acc::Plain((yystack_[0].value.sval), yystack_[0].location); } +#line 1513 "parser.cc" + break; + + case 124: +#line 1155 "parser.y" + { (yylhs.value.var_acc) = new Var_Acc::Comp((yystack_[2].value.var_acc), (yystack_[0].value.sval), yylhs.location); } +#line 1519 "parser.cc" + break; + + case 125: +#line 1156 "parser.y" + { (yylhs.value.var_acc) = new Var_Acc::Array((yystack_[3].value.var_acc), (yystack_[1].value.expr), yylhs.location); } +#line 1525 "parser.cc" + break; + + case 126: +#line 1167 "parser.y" + { (yylhs.value.expr) = new Expr::Less((yystack_[2].value.expr), (yystack_[0].value.expr), yystack_[1].location); } +#line 1531 "parser.cc" + break; + + case 127: +#line 1168 "parser.y" + { (yylhs.value.expr) = new Expr::Greater((yystack_[2].value.expr), (yystack_[0].value.expr), yystack_[1].location); } +#line 1537 "parser.cc" + break; + + case 128: +#line 1169 "parser.y" + { (yylhs.value.expr) = new Expr::Less_Eq((yystack_[2].value.expr), (yystack_[0].value.expr), yystack_[1].location); } +#line 1543 "parser.cc" + break; + + case 129: +#line 1170 "parser.y" + { (yylhs.value.expr) = new Expr::Greater_Eq((yystack_[2].value.expr), (yystack_[0].value.expr), yystack_[1].location); } +#line 1549 "parser.cc" + break; + + case 130: +#line 1171 "parser.y" + { (yylhs.value.expr) = new Expr::Eq((yystack_[2].value.expr), (yystack_[0].value.expr), yystack_[1].location); } +#line 1555 "parser.cc" + break; + + case 131: +#line 1172 "parser.y" + { (yylhs.value.expr) = new Expr::Not_Eq((yystack_[2].value.expr), (yystack_[0].value.expr), yystack_[1].location); } +#line 1561 "parser.cc" + break; + + case 132: +#line 1173 "parser.y" + { (yylhs.value.expr) = new Expr::And((yystack_[2].value.expr), (yystack_[0].value.expr), yystack_[1].location); } +#line 1567 "parser.cc" + break; + + case 133: +#line 1174 "parser.y" + { (yylhs.value.expr) = new Expr::Or((yystack_[2].value.expr), (yystack_[0].value.expr), yystack_[1].location); } +#line 1573 "parser.cc" + break; + + case 134: +#line 1175 "parser.y" + { (yylhs.value.expr) = new Expr::Comp((yystack_[1].value.expr), yylhs.location); } +#line 1579 "parser.cc" + break; + + case 135: +#line 1176 "parser.y" + { (yylhs.value.expr) = new Expr::Not((yystack_[0].value.expr), yystack_[1].location); } +#line 1585 "parser.cc" + break; + + case 136: +#line 1178 "parser.y" + { (yylhs.value.expr) = new Expr::Plus((yystack_[2].value.expr), (yystack_[0].value.expr), yylhs.location); } +#line 1591 "parser.cc" + break; + + case 137: +#line 1179 "parser.y" + { (yylhs.value.expr) = new Expr::Minus((yystack_[2].value.expr), (yystack_[0].value.expr), yylhs.location); } +#line 1597 "parser.cc" + break; + + case 138: +#line 1180 "parser.y" + { (yylhs.value.expr) = new Expr::Times((yystack_[2].value.expr), (yystack_[0].value.expr), yylhs.location); } +#line 1603 "parser.cc" + break; + + case 139: +#line 1181 "parser.y" + { (yylhs.value.expr) = new Expr::Div((yystack_[2].value.expr), (yystack_[0].value.expr), yylhs.location); } +#line 1609 "parser.cc" + break; + + case 140: +#line 1182 "parser.y" + { Expr::Fn_Call *f = new Expr::Fn_Call((yystack_[3].value.sval), yylhs.location); + if (!f->name) + delete (yystack_[3].value.sval); + f->exprs = *(yystack_[1].value.exprs); + delete (yystack_[1].value.exprs); + (yylhs.value.expr) = f; } +#line 1620 "parser.cc" + break; + + case 141: +#line 1188 "parser.y" + { (yylhs.value.expr) = new Expr::Vacc((yystack_[0].value.var_acc), yystack_[0].location); } +#line 1626 "parser.cc" + break; + + case 142: +#line 1189 "parser.y" + { (yylhs.value.expr) = new Expr::Const((yystack_[0].value.cons), yystack_[0].location); } +#line 1632 "parser.cc" + break; + + case 143: +#line 1191 "parser.y" + { (yylhs.value.cons) = new Const::Int(*(yystack_[0].value.sval), yystack_[0].location); delete (yystack_[0].value.sval); } +#line 1638 "parser.cc" + break; + + case 144: +#line 1193 "parser.y" + { (yylhs.value.cons) = new Const::Float(*(yystack_[2].value.sval) + "." + *(yystack_[0].value.sval), yylhs.location); + delete (yystack_[2].value.sval); delete (yystack_[0].value.sval); } +#line 1645 "parser.cc" + break; + + case 145: +#line 1195 "parser.y" + { (yylhs.value.cons) = new Const::Float(*(yystack_[0].value.sval), yystack_[0].location); + delete (yystack_[0].value.sval); + } +#line 1653 "parser.cc" + break; + + case 146: +#line 1199 "parser.y" + { + (yylhs.value.cons) = new Const::Rational((yystack_[2].value.sval), (yystack_[0].value.sval), yylhs.location); + } +#line 1661 "parser.cc" + break; + + case 147: +#line 1202 "parser.y" + { Const::Number *n = dynamic_cast((yystack_[0].value.cons)); + assert(n); + n->setNegative(); + (yylhs.value.cons) = n; } +#line 1670 "parser.cc" + break; + + case 148: +#line 1207 "parser.y" + { std::list *l = + new std::list(); + l->push_back((yystack_[0].value.expr)); + (yylhs.value.exprs) = l; } +#line 1679 "parser.cc" + break; + + case 149: +#line 1211 "parser.y" + { (yystack_[2].value.exprs)->push_back((yystack_[0].value.expr)); + (yylhs.value.exprs) = (yystack_[2].value.exprs); } +#line 1686 "parser.cc" + break; + + case 150: +#line 1215 "parser.y" + { (yylhs.value.exprs) = (yystack_[0].value.exprs); } +#line 1692 "parser.cc" + break; + + case 151: +#line 1217 "parser.y" + { (yylhs.value.exprs) = new std::list(); } +#line 1698 "parser.cc" + break; + + case 152: +#line 1228 "parser.y" + { + std::list *l = new std::list(); + l->push_back((yystack_[0].value.grammar)); + (yylhs.value.grammars) = l; + } +#line 1708 "parser.cc" + break; + + case 153: +#line 1235 "parser.y" + { + (yystack_[1].value.grammars)->push_back((yystack_[0].value.grammar)); + (yylhs.value.grammars) = (yystack_[1].value.grammars); + } +#line 1717 "parser.cc" + break; + + case 154: +#line 1242 "parser.y" + { + if (*(yystack_[8].value.sval) != *driver.ast.signature->name) + error(yystack_[8].location, "Unknown signature " + *(yystack_[8].value.sval) + "."); + Grammar *g = new Grammar(driver.ast, (yystack_[10].value.sval), (yystack_[8].value.sval), (yystack_[4].value.sval), yystack_[11].location + yystack_[10].location); + g->axiom_loc = yystack_[4].location; + if ((yystack_[1].value.grammar_body)->first) { + g->tab_names = *(yystack_[1].value.grammar_body)->first; + delete (yystack_[1].value.grammar_body)->first; + } + assert((yystack_[1].value.grammar_body)); + assert((yystack_[1].value.grammar_body)->second); + for (std::list::iterator i = (yystack_[1].value.grammar_body)->second->begin(); + i != (yystack_[1].value.grammar_body)->second->end(); ++i) + g->add_nt(*i); + (yylhs.value.grammar) = g; + } +#line 1738 "parser.cc" + break; + + case 155: +#line 1261 "parser.y" + { + assert((yystack_[1].value.args)); + assert((yystack_[0].value.productions)); + (yylhs.value.grammar_body) = new std::pair< hashtable*, + std::list*>((yystack_[1].value.args), (yystack_[0].value.productions)); + } +#line 1749 "parser.cc" + break; + + case 156: +#line 1269 "parser.y" + { + assert((yystack_[0].value.productions)); + (yylhs.value.grammar_body) = new std::pair< hashtable*, + std::list*>(0, (yystack_[0].value.productions)); + } +#line 1759 "parser.cc" + break; + + case 157: +#line 1287 "parser.y" + { + (yylhs.value.args) = (yystack_[1].value.args); + } +#line 1767 "parser.cc" + break; + + case 158: +#line 1298 "parser.y" + { (yylhs.value.sval) = (yystack_[0].value.sval); } +#line 1773 "parser.cc" + break; + + case 159: +#line 1300 "parser.y" + { (yylhs.value.sval) = (yystack_[0].value.sval); } +#line 1779 "parser.cc" + break; + + case 160: +#line 1305 "parser.y" + { + std::list *l = new std::list(); + l->push_back((yystack_[0].value.production)); + (yylhs.value.productions) = l; + } +#line 1789 "parser.cc" + break; + + case 161: +#line 1312 "parser.y" + { + (yystack_[1].value.productions)->push_back((yystack_[0].value.production)); + (yylhs.value.productions) = (yystack_[1].value.productions); + } +#line 1798 "parser.cc" + break; + + case 162: +#line 1319 "parser.y" + { + Symbol::NT *nt = new Symbol::NT((yystack_[4].value.sval), yystack_[4].location); + nt->set_alts(*(yystack_[1].value.rhs)->first); + nt->set_eval_fn((yystack_[1].value.rhs)->second); + nt->set_ntargs((yystack_[3].value.para_decls)); + delete (yystack_[1].value.rhs)->first; + delete (yystack_[1].value.rhs); + delete (yystack_[3].value.para_decls); + (yylhs.value.production) = nt; + } +#line 1813 "parser.cc" + break; + + case 163: +#line 1332 "parser.y" + { (yylhs.value.para_decls) = (yystack_[1].value.para_decls); } +#line 1819 "parser.cc" + break; + + case 164: +#line 1334 "parser.y" + { (yylhs.value.para_decls) = 0; } +#line 1825 "parser.cc" + break; + + case 165: +#line 1363 "parser.y" + { std::pair*, std::string*> *p = + new std::pair*, std::string*>((yystack_[0].value.alts), NULL); + (yylhs.value.rhs) = p; } +#line 1833 "parser.cc" + break; + + case 166: +#line 1367 "parser.y" + { std::pair*, std::string*> *p = + new std::pair*, std::string*>((yystack_[2].value.alts), (yystack_[0].value.sval)); + (yylhs.value.rhs) = p; } +#line 1841 "parser.cc" + break; + + case 167: +#line 1376 "parser.y" + { (yylhs.value.sval) = (yystack_[0].value.sval); } +#line 1847 "parser.cc" + break; + + case 168: +#line 1383 "parser.y" + { (yylhs.value.exprs) = (yystack_[0].value.exprs); } +#line 1853 "parser.cc" + break; + + case 169: +#line 1385 "parser.y" + { (yylhs.value.exprs) = 0; } +#line 1859 "parser.cc" + break; + + case 170: +#line 1389 "parser.y" + { + (yystack_[2].value.filters)->push_back((yystack_[0].value.filter)); + (yylhs.value.filters) = (yystack_[2].value.filters); + } +#line 1868 "parser.cc" + break; + + case 171: +#line 1395 "parser.y" + { + std::list *l = new std::list(); + l->push_back((yystack_[0].value.filter)); + (yylhs.value.filters) = l; + } +#line 1878 "parser.cc" + break; + + case 172: +#line 1403 "parser.y" + { + std::list *l = new std::list(); + l->push_back((yystack_[0].value.alt)); + (yylhs.value.alts) = l; + } +#line 1888 "parser.cc" + break; + + case 173: +#line 1409 "parser.y" + { + (yystack_[2].value.alts)->push_back((yystack_[0].value.alt)); + (yylhs.value.alts) = (yystack_[2].value.alts); + } +#line 1897 "parser.cc" + break; + + case 174: +#line 1415 "parser.y" + { (yylhs.value.alt) = (yystack_[0].value.alt); } +#line 1903 "parser.cc" + break; + + case 175: +#line 1417 "parser.y" + { std::list *l = new std::list(); + l->push_back((yystack_[0].value.alt)); + (yylhs.value.alts) = l; } +#line 1911 "parser.cc" + break; + + case 176: +#line 1421 "parser.y" + { (yystack_[2].value.alts)->push_back((yystack_[0].value.alt)); + (yylhs.value.alts) = (yystack_[2].value.alts); } +#line 1918 "parser.cc" + break; + + case 177: +#line 1426 "parser.y" + { (yylhs.value.alt) = new Alt::Block(*(yystack_[1].value.alts), yylhs.location); delete (yystack_[1].value.alts); } +#line 1924 "parser.cc" + break; + + case 178: +#line 1429 "parser.y" + { Alt::Simple *a = new Alt::Simple((yystack_[4].value.sval), yystack_[4].location); + a->args = *(yystack_[2].value.rhs_args); + delete (yystack_[2].value.rhs_args); + a->set_ntparas((yystack_[1].value.exprs)); + delete (yystack_[1].value.exprs); + (yylhs.value.alt) = a; } +#line 1935 "parser.cc" + break; + + case 179: +#line 1437 "parser.y" + { (yylhs.value.alt) = new Alt::Link((yystack_[0].value.sval), yystack_[0].location); } +#line 1941 "parser.cc" + break; + + case 180: +#line 1440 "parser.y" + { + if (((yystack_[1].value.filter_kw) == Filter::WITH_OVERLAY || (yystack_[1].value.filter_kw) == Filter::SUCHTHAT_OVERLAY) + && !(yystack_[2].value.alt)->is(Alt::SIMPLE)) + error(yystack_[1].location, "Overlay filtering makes only sense with a function symbol" + " on the lhs."); + + (yystack_[0].value.filter)->type = (yystack_[1].value.filter_kw); + (yystack_[2].value.alt)->filters.push_back((yystack_[0].value.filter)); + (yylhs.value.alt) = (yystack_[2].value.alt); + } +#line 1956 "parser.cc" + break; + + case 181: +#line 1465 "parser.y" + { + Alt::Multi *r = new Alt::Multi(*(yystack_[1].value.alts), yylhs.location); + delete (yystack_[1].value.alts); + (yylhs.value.alt) = r; + } +#line 1966 "parser.cc" + break; + + case 182: +#line 1472 "parser.y" + { + (yystack_[4].value.alt)->add_multitrack_filter(*(yystack_[1].value.filters), (yystack_[3].value.filter_kw), yystack_[1].location); + delete (yystack_[1].value.filters); + (yylhs.value.alt) = (yystack_[4].value.alt); + } +#line 1976 "parser.cc" + break; + + case 183: +#line 1518 "parser.y" + { + (yystack_[5].value.alt)->set_ntparas(yystack_[5].location+yystack_[3].location, (yystack_[2].value.exprs)); + delete (yystack_[2].value.exprs); + (yylhs.value.alt) = (yystack_[5].value.alt); + } +#line 1986 "parser.cc" + break; + + case 184: +#line 1536 "parser.y" + { + Alt::Link *l = new Alt::Link((yystack_[3].value.sval), yystack_[3].location); + l->set_indices(*(yystack_[1].value.exprs)); + delete (yystack_[1].value.exprs); + (yylhs.value.alt) = l; + } +#line 1997 "parser.cc" + break; + + case 185: +#line 1544 "parser.y" + { + (yystack_[2].value.alt)->set_index_overlay((yystack_[5].value.alt)); + (yylhs.value.alt) = (yystack_[2].value.alt); + } +#line 2006 "parser.cc" + break; + + case 186: +#line 1550 "parser.y" + { + (yystack_[1].value.alt)->set_index_stmts(*(yystack_[5].value.statements)); + delete (yystack_[5].value.statements); + (yylhs.value.alt) = (yystack_[1].value.alt); + } +#line 2016 "parser.cc" + break; + + case 187: +#line 1589 "parser.y" + { (yylhs.value.sval) = (yystack_[0].value.sval); } +#line 2022 "parser.cc" + break; + + case 188: +#line 1591 "parser.y" + { (yylhs.value.sval) = (yystack_[0].value.sval); } +#line 2028 "parser.cc" + break; + + case 189: +#line 1595 "parser.y" + { (yylhs.value.filter_kw) = Filter::WITH; } +#line 2034 "parser.cc" + break; + + case 190: +#line 1596 "parser.y" + { (yylhs.value.filter_kw) = Filter::SUCHTHAT; } +#line 2040 "parser.cc" + break; + + case 191: +#line 1597 "parser.y" + { (yylhs.value.filter_kw) = Filter::WITH_OVERLAY; } +#line 2046 "parser.cc" + break; + + case 192: +#line 1598 "parser.y" + { (yylhs.value.filter_kw) = Filter::SUCHTHAT_OVERLAY; } +#line 2052 "parser.cc" + break; + + case 193: +#line 1628 "parser.y" + { Filter *f = new Filter((yystack_[0].value.sval), yystack_[0].location); + (yylhs.value.filter) = f; + } +#line 2060 "parser.cc" + break; + + case 194: +#line 1632 "parser.y" + { Filter *f = new Filter((yystack_[3].value.sval), yystack_[3].location); + f->args = *(yystack_[1].value.exprs); + f->init_builtin(); + delete (yystack_[1].value.exprs); + (yylhs.value.filter) = f; } +#line 2070 "parser.cc" + break; + + case 195: +#line 1658 "parser.y" + { std::list *l = new std::list(); + l->push_back((yystack_[0].value.rhs_arg)); + (yylhs.value.rhs_args) = l; } +#line 2078 "parser.cc" + break; + + case 196: +#line 1663 "parser.y" + { (yystack_[2].value.rhs_args)->push_back((yystack_[0].value.rhs_arg)); + (yylhs.value.rhs_args) = (yystack_[2].value.rhs_args); } +#line 2085 "parser.cc" + break; + + case 197: +#line 1668 "parser.y" + { (yylhs.value.rhs_arg) = new Fn_Arg::Alt((yystack_[0].value.alt), yystack_[0].location); } +#line 2091 "parser.cc" + break; + + case 198: +#line 1675 "parser.y" + { (yylhs.value.rhs_arg) = new Fn_Arg::Const((yystack_[0].value.cons), yystack_[0].location, (yystack_[1].value.sval)->rfind("CONST_") == 0); } +#line 2097 "parser.cc" + break; + + case 199: +#line 1678 "parser.y" + { (yylhs.value.cons) = (yystack_[0].value.cons);} +#line 2103 "parser.cc" + break; + + case 200: +#line 1680 "parser.y" + { + (yylhs.value.cons) = new Const::Char(*(yystack_[1].value.sval), yylhs.location); + delete (yystack_[1].value.sval); + } +#line 2112 "parser.cc" + break; + + case 201: +#line 1684 "parser.y" + { (yylhs.value.cons) = new Const::String((yystack_[1].value.sval), yylhs.location); } +#line 2118 "parser.cc" + break; + + case 202: +#line 1745 "parser.y" + { (yylhs.value.sval) = (yystack_[0].value.sval); } +#line 2124 "parser.cc" + break; + + case 203: +#line 1745 "parser.y" + { (yylhs.value.sval) = new std::string(); } +#line 2130 "parser.cc" + break; + + case 204: +#line 1747 "parser.y" + { (yylhs.value.sval) = (yystack_[0].value.sval); } +#line 2136 "parser.cc" + break; + + case 207: +#line 1761 "parser.y" + { driver.ast.instances = *(yystack_[0].value.instances); delete (yystack_[0].value.instances); } +#line 2142 "parser.cc" + break; + + case 208: +#line 1763 "parser.y" + { driver.ast.first_instance = (yystack_[0].value.instance); + hashtable *h = + new hashtable(); + (*h)[*(yystack_[0].value.instance)->name()] = (yystack_[0].value.instance); + (yylhs.value.instances) = h; } +#line 2152 "parser.cc" + break; + + case 209: +#line 1768 "parser.y" + { + hashtable::iterator i = + (yystack_[1].value.instances)->find(*(yystack_[0].value.instance)->name()); + if (i != (yystack_[1].value.instances)->end()) { + error((yystack_[0].value.instance)->location, "Instance " + *(yystack_[0].value.instance)->name() + + " already defined"); + error(i->second->location, "here."); + } else { + (*(yystack_[1].value.instances))[*(yystack_[0].value.instance)->name()] = (yystack_[0].value.instance); + } + (yylhs.value.instances) = (yystack_[1].value.instances); + } +#line 2169 "parser.cc" + break; + + case 210: +#line 1781 "parser.y" + { driver.ast.algebra_seen.clear(); } +#line 2175 "parser.cc" + break; + + case 211: +#line 1782 "parser.y" + { + Instance *i = new Instance((yystack_[7].value.i_lhs)->first, (yystack_[2].value.product), yystack_[7].location); + if (!driver.ast.grammar_defined(*(yystack_[5].value.sval))) + error(yystack_[5].location, "Grammar " + *(yystack_[5].value.sval) + " is not defined."); + else + i->set_grammar(driver.ast.grammar(*(yystack_[5].value.sval))); + delete (yystack_[7].value.i_lhs); + (yylhs.value.instance) = i; + } +#line 2189 "parser.cc" + break; + + case 212: +#line 1798 "parser.y" + { (yylhs.value.i_lhs) = new std::pair*> + ((yystack_[0].value.sval), NULL); + } +#line 2197 "parser.cc" + break; + + case 213: +#line 1802 "parser.y" + { yylhs.location = yystack_[3].location ; + (yylhs.value.i_lhs) = new std::pair*> + ((yystack_[3].value.sval), (yystack_[1].value.args)); + } +#line 2206 "parser.cc" + break; + + case 214: +#line 1808 "parser.y" + { (yylhs.value.product) = new Product::Times((yystack_[2].value.product), (yystack_[0].value.product), yystack_[1].location); } +#line 2212 "parser.cc" + break; + + case 215: +#line 1814 "parser.y" + { (yylhs.value.product) = new Product::Klass((yystack_[2].value.product), (yystack_[0].value.product), yystack_[1].location); } +#line 2218 "parser.cc" + break; + + case 216: +#line 1820 "parser.y" + { (yylhs.value.product) = new Product::Cartesian((yystack_[2].value.product), (yystack_[0].value.product), yystack_[1].location); } +#line 2224 "parser.cc" + break; + + case 217: +#line 1826 "parser.y" + { (yylhs.value.product) = new Product::Pareto((yystack_[2].value.product), (yystack_[0].value.product), yystack_[1].location); } +#line 2230 "parser.cc" + break; + + case 218: +#line 1832 "parser.y" + { (yylhs.value.product) = new Product::Takeone((yystack_[2].value.product), (yystack_[0].value.product), yystack_[0].location); } +#line 2236 "parser.cc" + break; + + case 219: +#line 1839 "parser.y" + { (yylhs.value.product) = new Product::Overlay((yystack_[2].value.product), (yystack_[0].value.product), yystack_[1].location); } +#line 2242 "parser.cc" + break; + + case 220: +#line 1867 "parser.y" + { + /* $1->set_defaults(); */ + (yylhs.value.product) = (yystack_[3].value.product); + } +#line 2251 "parser.cc" + break; + + case 221: +#line 1874 "parser.y" + { (yylhs.value.product) = (yystack_[1].value.product); } +#line 2257 "parser.cc" + break; + + case 222: +#line 1876 "parser.y" + { Product::Single *p = new Product::Single((yystack_[0].value.sval), yystack_[0].location); + hashtable::iterator i = + driver.ast.algebras.find(*(yystack_[0].value.sval)); + if (i == driver.ast.algebras.end()) + error(yystack_[0].location, "Algebra " + *(yystack_[0].value.sval) + " not defined."); + else { + std::set::iterator j = driver.ast.algebra_seen.find(i->first); + if (j == driver.ast.algebra_seen.end()) { + p->set_algebra(i->second); + driver.ast.algebra_seen.insert(i->first); + } else { + static unsigned counter; + // copy for bpmax*bpmax products ... + Algebra *a = i->second->copy(); + p->set_algebra(a); + std::ostringstream o; + o << i->first << counter++; + driver.ast.algebras[o.str()] = a; + } + } + (yylhs.value.product) = p; + } +#line 2284 "parser.cc" + break; + + case 223: +#line 1906 "parser.y" + { + (yystack_[2].value.product)->set_filter((yystack_[0].value.filter)); + (yylhs.value.product) = (yystack_[2].value.product); + } +#line 2293 "parser.cc" + break; + + +#line 2297 "parser.cc" + + default: + break; + } + } +#if YY_EXCEPTIONS + catch (const syntax_error& yyexc) + { + YYCDEBUG << "Caught exception: " << yyexc.what() << '\n'; + error (yyexc); + YYERROR; + } +#endif // YY_EXCEPTIONS + YY_SYMBOL_PRINT ("-> $$ =", yylhs); + yypop_ (yylen); + yylen = 0; + YY_STACK_PRINT (); + + // Shift the result of the reduction. + yypush_ (YY_NULLPTR, YY_MOVE (yylhs)); + } + goto yynewstate; + + + /*--------------------------------------. + | yyerrlab -- here on detecting error. | + `--------------------------------------*/ + yyerrlab: + // If not already recovering from an error, report this error. + if (!yyerrstatus_) + { + ++yynerrs_; + error (yyla.location, yysyntax_error_ (yystack_[0].state, yyla)); + } + + + yyerror_range[1].location = yyla.location; + if (yyerrstatus_ == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + // Return failure if at end of input. + if (yyla.type_get () == yyeof_) + YYABORT; + else if (!yyla.empty ()) + { + yy_destroy_ ("Error: discarding", yyla); + yyla.clear (); + } + } + + // Else will try to reuse lookahead token after shifting the error token. + goto yyerrlab1; + + + /*---------------------------------------------------. + | yyerrorlab -- error raised explicitly by YYERROR. | + `---------------------------------------------------*/ + yyerrorlab: + /* Pacify compilers when the user code never invokes YYERROR and + the label yyerrorlab therefore never appears in user code. */ + if (false) + YYERROR; + + /* Do not reclaim the symbols of the rule whose action triggered + this YYERROR. */ + yypop_ (yylen); + yylen = 0; + goto yyerrlab1; + + + /*-------------------------------------------------------------. + | yyerrlab1 -- common code for both syntax error and YYERROR. | + `-------------------------------------------------------------*/ + yyerrlab1: + yyerrstatus_ = 3; // Each real token shifted decrements this. + { + stack_symbol_type error_token; + for (;;) + { + yyn = yypact_[+yystack_[0].state]; + if (!yy_pact_value_is_default_ (yyn)) + { + yyn += yy_error_token_; + if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yy_error_token_) + { + yyn = yytable_[yyn]; + if (0 < yyn) + break; + } + } + + // Pop the current state because it cannot handle the error token. + if (yystack_.size () == 1) + YYABORT; + + yyerror_range[1].location = yystack_[0].location; + yy_destroy_ ("Error: popping", yystack_[0]); + yypop_ (); + YY_STACK_PRINT (); + } + + yyerror_range[2].location = yyla.location; + YYLLOC_DEFAULT (error_token.location, yyerror_range, 2); + + // Shift the error token. + error_token.state = state_type (yyn); + yypush_ ("Shifting", YY_MOVE (error_token)); + } + goto yynewstate; + + + /*-------------------------------------. + | yyacceptlab -- YYACCEPT comes here. | + `-------------------------------------*/ + yyacceptlab: + yyresult = 0; + goto yyreturn; + + + /*-----------------------------------. + | yyabortlab -- YYABORT comes here. | + `-----------------------------------*/ + yyabortlab: + yyresult = 1; + goto yyreturn; + + + /*-----------------------------------------------------. + | yyreturn -- parsing is finished, return the result. | + `-----------------------------------------------------*/ + yyreturn: + if (!yyla.empty ()) + yy_destroy_ ("Cleanup: discarding lookahead", yyla); + + /* Do not reclaim the symbols of the rule whose action triggered + this YYABORT or YYACCEPT. */ + yypop_ (yylen); + while (1 < yystack_.size ()) + { + yy_destroy_ ("Cleanup: popping", yystack_[0]); + yypop_ (); + } + + return yyresult; + } +#if YY_EXCEPTIONS + catch (...) + { + YYCDEBUG << "Exception caught: cleaning lookahead and stack\n"; + // Do not try to display the values of the reclaimed symbols, + // as their printers might throw an exception. + if (!yyla.empty ()) + yy_destroy_ (YY_NULLPTR, yyla); + + while (1 < yystack_.size ()) + { + yy_destroy_ (YY_NULLPTR, yystack_[0]); + yypop_ (); + } + throw; + } +#endif // YY_EXCEPTIONS + } + + void + Parser::error (const syntax_error& yyexc) + { + error (yyexc.location, yyexc.what ()); + } + + // Generate an error message. + std::string + Parser::yysyntax_error_ (state_type yystate, const symbol_type& yyla) const + { + // Number of reported tokens (one for the "unexpected", one per + // "expected"). + std::ptrdiff_t yycount = 0; + // Its maximum. + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + // Arguments of yyformat. + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + + /* There are many possibilities here to consider: + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yyla) is + if this state is a consistent state with a default action. + Thus, detecting the absence of a lookahead is sufficient to + determine that there is no unexpected or expected token to + report. In that case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is + a consistent state with a default action. There might have + been a previous inconsistent state, consistent state with a + non-default action, or user semantic action that manipulated + yyla. (However, yyla is currently not documented for users.) + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (!yyla.empty ()) + { + symbol_number_type yytoken = yyla.type_get (); + yyarg[yycount++] = yytname_[yytoken]; + + int yyn = yypact_[+yystate]; + if (!yy_pact_value_is_default_ (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + // Stay within bounds of both yycheck and yytname. + int yychecklim = yylast_ - yyn + 1; + int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_; + for (int yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck_[yyx + yyn] == yyx && yyx != yy_error_token_ + && !yy_table_value_is_error_ (yytable_[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + break; + } + else + yyarg[yycount++] = yytname_[yyx]; + } + } + } + + char const* yyformat = YY_NULLPTR; + switch (yycount) + { +#define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + default: // Avoid compiler warnings. + YYCASE_ (0, YY_("syntax error")); + YYCASE_ (1, YY_("syntax error, unexpected %s")); + YYCASE_ (2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_ (3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_ (4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_ (5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +#undef YYCASE_ + } + + std::string yyres; + // Argument number. + std::ptrdiff_t yyi = 0; + for (char const* yyp = yyformat; *yyp; ++yyp) + if (yyp[0] == '%' && yyp[1] == 's' && yyi < yycount) + { + yyres += yytnamerr_ (yyarg[yyi++]); + ++yyp; + } + else + yyres += *yyp; + return yyres; + } + + + const short Parser::yypact_ninf_ = -381; + + const short Parser::yytable_ninf_ = -188; + + const short + Parser::yypact_[] = + { + 141, -5, -381, 108, -9, -381, 93, -5, -381, -3, + -381, -381, 127, -381, -7, 144, -381, -381, -381, -3, + -381, 575, 117, -381, 176, -381, 36, 170, 144, -381, + 525, 36, -3, -3, -3, -3, -3, -3, 36, -381, + 83, -381, -381, -381, -381, 180, 36, 331, -381, -381, + 152, -381, -2, -2, -2, -2, -2, -2, -381, 138, + 96, -381, -381, 176, 148, 175, 36, -381, 238, 331, + -381, 255, 204, 66, 274, 66, 66, 36, -381, -381, + -381, -381, -381, -381, 276, 242, -381, -381, 271, 19, + 36, 238, -381, -381, 36, -381, 233, 66, 51, -381, + 102, 293, 66, 304, 55, 596, -381, 130, -381, -381, + -381, 596, 306, -381, 236, 274, 178, -381, 251, 256, + 327, 242, 27, -381, 313, 340, -381, 300, 23, 66, + -381, 342, 344, -381, -381, 307, 536, -381, 309, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, -381, -381, -381, -381, 242, -381, 36, -381, + -381, 314, 36, 242, -381, -381, 107, 372, 372, 36, + -381, -381, 340, -381, 375, -381, -381, -381, 183, 335, + 334, -381, -381, -381, -381, -381, 422, 353, 353, 353, + 353, 611, 353, 353, 322, 322, -381, -381, 596, -381, + 110, -381, -381, 343, -381, 347, -381, -381, -381, -381, + 345, 364, 366, 373, -381, 372, 242, -381, 36, -381, + 36, 242, -381, 183, 66, 32, 429, 36, 36, 376, + -381, 379, -381, -381, 377, 85, 380, 36, 483, -381, + -381, 250, -381, 378, -381, 383, 252, -381, 32, 202, + 242, -381, 381, -381, 385, -381, -381, 32, -381, 242, + 435, -381, 391, 258, 109, 202, 36, 151, -381, -381, + -381, 234, -381, -381, -381, 392, -3, -381, 88, -381, + 202, 202, 393, 242, -381, -381, 155, 401, 614, -381, + -381, 400, 403, 97, 234, 397, 31, 398, 487, -381, + -381, -381, 408, 404, 419, 36, 36, -381, -381, 423, + 427, 111, 430, 66, 425, 433, 487, 36, -381, -381, + 432, 103, -381, -381, -381, -381, -381, -381, -381, -381, + -381, 172, 36, 202, 440, -381, 36, -381, 242, 66, + 66, 362, -381, -381, 143, 158, 66, -381, -381, 66, + 227, 268, 38, 36, 66, 544, 588, -381, -381, 66, + -381, 283, 368, -381, -381, 439, 38, 443, 38, 441, + -21, 296, 445, 450, 459, 374, 487, 487, 428, 446, + -381, 122, -381, 296, 487, 114, -381, 38, 506, -381, + -381, -381, -381, 194, 10, 244, 66, 36, -381, 514, + -381, -381, -381, 38, 452, -381, 296, -381, -381, 38, + 66, 36, -381, 296, 160, -381, -381, 25, 458, 192, + 487, -381, 468, 190, 284, 123, -381, 244, 66, 461, + -381, 487, 66, -381, 469, 472, 473, -381, 36, -381, + 335, -381, -381, 596, 38, -381, -381, -381, 285, -381 + }; + + const unsigned char + Parser::yydefact_[] = + { + 0, 8, 3, 0, 0, 2, 16, 7, 9, 0, + 1, 13, 0, 11, 0, 22, 10, 79, 78, 0, + 222, 4, 0, 20, 0, 14, 0, 0, 21, 23, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, + 0, 17, 19, 81, 80, 0, 0, 57, 24, 221, + 193, 223, 214, 215, 219, 216, 218, 217, 123, 0, + 0, 224, 15, 0, 0, 0, 0, 63, 0, 56, + 58, 0, 0, 0, 0, 0, 0, 0, 220, 18, + 28, 32, 26, 29, 0, 0, 25, 27, 0, 68, + 0, 5, 152, 59, 0, 88, 80, 0, 143, 145, + 0, 203, 0, 0, 141, 148, 199, 0, 142, 36, + 124, 226, 0, 225, 0, 0, 0, 33, 0, 0, + 0, 0, 0, 67, 0, 206, 153, 68, 94, 151, + 135, 0, 0, 147, 202, 0, 0, 204, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 194, 125, 30, 35, 0, 31, 0, 37, + 62, 0, 0, 0, 69, 71, 0, 0, 0, 0, + 6, 205, 207, 208, 0, 60, 93, 89, 0, 150, + 0, 144, 146, 201, 134, 200, 132, 130, 129, 128, + 131, 133, 126, 127, 137, 136, 138, 139, 149, 34, + 44, 40, 42, 0, 61, 0, 70, 72, 66, 158, + 0, 0, 212, 0, 209, 0, 0, 48, 0, 140, + 0, 0, 39, 0, 0, 0, 0, 0, 0, 0, + 49, 0, 41, 50, 43, 0, 0, 0, 0, 86, + 87, 0, 82, 0, 85, 0, 0, 210, 0, 95, + 0, 38, 0, 45, 0, 74, 73, 0, 65, 0, + 0, 213, 0, 0, 100, 95, 0, 92, 96, 51, + 46, 0, 83, 84, 159, 0, 0, 64, 0, 98, + 0, 95, 0, 0, 53, 54, 44, 0, 0, 99, + 97, 91, 0, 0, 0, 0, 0, 0, 0, 52, + 55, 47, 0, 164, 0, 0, 156, 160, 211, 0, + 0, 80, 0, 0, 0, 0, 0, 0, 77, 110, + 123, 0, 101, 103, 104, 111, 105, 106, 107, 108, + 109, 0, 0, 95, 0, 154, 155, 161, 0, 0, + 0, 0, 113, 114, 0, 0, 0, 90, 102, 0, + 0, 0, 0, 0, 0, 0, 0, 116, 112, 0, + 76, 0, 0, 157, 163, 188, 0, 0, 0, 0, + 165, 175, 0, 179, 0, 0, 0, 0, 0, 0, + 121, 0, 172, 174, 0, 0, 162, 0, 0, 189, + 190, 191, 192, 0, 0, 0, 0, 0, 120, 117, + 75, 115, 181, 0, 0, 177, 176, 167, 166, 0, + 0, 0, 180, 197, 169, 195, 198, 0, 0, 0, + 0, 173, 0, 0, 0, 0, 171, 0, 0, 0, + 184, 0, 0, 118, 0, 0, 0, 182, 0, 196, + 168, 178, 119, 122, 0, 185, 183, 170, 0, 186 + }; + + const short + Parser::yypgoto_[] = + { + -381, -381, -381, -381, -381, -381, -381, 528, -381, -381, + -381, 479, 529, -381, -381, 517, -52, 462, -381, 402, + 434, -381, -381, -381, -225, 337, 261, -381, 325, 384, + 278, 272, -381, -381, -381, 498, -381, 447, -381, 444, + -381, -381, 405, 411, 240, -381, 410, -26, 332, 324, + -381, -381, -381, -381, -381, -381, -233, 299, -282, -317, + -381, -381, -381, -381, -381, -381, -381, -381, -381, -32, + -66, 505, -128, -381, -381, 518, -381, -381, -161, -381, + 303, -292, -381, -381, -381, -381, -381, -381, 207, 245, + -338, -381, -381, -381, -376, -381, 185, -380, -381, -381, + -381, -381, -381, 451, -381, -381, -11, -381, 541 + }; + + const short + Parser::yydefgoto_[] = + { + -1, 3, 9, 5, 125, 6, 7, 8, 13, 15, + 40, 41, 42, 27, 28, 29, 317, 87, 116, 117, + 110, 47, 203, 119, 200, 201, 222, 235, 236, 237, + 234, 285, 286, 68, 69, 70, 161, 71, 72, 122, + 123, 163, 164, 165, 318, 319, 20, 58, 241, 242, + 243, 244, 128, 177, 282, 178, 267, 268, 321, 322, + 323, 324, 325, 326, 327, 328, 329, 330, 418, 104, + 105, 106, 107, 180, 91, 92, 304, 305, 210, 275, + 306, 307, 334, 369, 408, 429, 425, 381, 382, 370, + 371, 372, 373, 394, 51, 414, 415, 108, 135, 138, + 170, 171, 172, 173, 262, 213, 21, 60, 61 + }; + + const short + Parser::yytable_[] = + { + 45, 179, 246, 17, 348, 50, 59, 211, 30, 111, + 112, 11, 86, 23, 337, 416, 43, 18, 412, 4, + 65, 52, 53, 54, 55, 56, 57, 348, 383, 67, + 44, 130, 278, 115, 344, 426, 136, 43, 387, 239, + 89, 166, 43, 31, 337, 59, 24, 416, 291, 406, + 167, 44, 240, 388, 229, 12, 44, 413, 365, 398, + 399, 38, 447, 411, 124, 383, 19, 120, 127, 162, + 302, 423, 43, 186, 187, 188, 189, 190, 191, 192, + 193, 194, 195, 196, 197, 198, 96, 348, 121, 413, + 151, 366, 80, 430, 175, 216, 97, 98, 99, 367, + 351, 368, 404, 433, 115, 81, 448, 350, 10, 43, + 80, 162, 131, 17, 442, -29, 74, -32, 14, 309, + 310, 100, 76, 311, 132, 312, 217, 18, 83, -29, + 101, -32, 202, 98, 99, 102, 205, 62, 313, 314, + 315, 103, 289, 212, 1, 2, 83, 22, 63, 43, + 80, 299, 84, 280, 85, 80, 251, 100, 238, 309, + 310, 77, 250, 311, 230, 312, 316, 78, 81, 233, + 84, 217, 85, 387, 347, 220, 402, 437, 313, 314, + 315, 39, 221, 217, 26, 405, 83, 403, 438, 82, + 80, 83, 231, 216, 202, 151, 23, 266, 269, 74, + 152, 202, 247, 81, 75, 76, 316, 273, 46, 80, + 84, 254, 85, 266, 358, 84, 280, 85, 361, 284, + 294, 73, 81, 281, 359, 427, 83, 221, 266, 266, + 360, 233, 428, 74, 389, 390, 391, 392, 349, 76, + 279, 80, 284, 156, 88, 264, 64, 341, 157, 80, + 84, 393, 85, 74, 81, 265, 90, 409, 432, 76, + 94, 435, 81, 410, 365, 288, 331, 95, 417, 84, + 303, 85, 320, 355, 356, 98, 99, 83, 118, 303, + 303, 266, 424, 362, 331, 83, 353, 283, 375, 331, + 320, 345, 220, 378, 109, 320, 81, 366, 363, 100, + 440, 84, 129, 85, 154, 367, 202, 368, 101, 84, + 303, 85, 331, 134, 139, 257, 158, 220, 320, 103, + 258, 140, 261, 257, 137, 141, 159, 374, 277, 389, + 390, 391, 392, 280, 142, 143, 66, 67, 364, 144, + 389, 390, 391, 392, 331, 331, 393, 160, 151, 151, + 320, 320, 331, 379, 436, 168, 449, 393, 320, 145, + 146, 147, 148, 149, 150, 419, 443, 169, 50, 121, + 139, 183, 331, 181, 153, 182, 139, 140, 320, 149, + 150, 141, 139, 140, 185, 50, 204, 141, 331, 140, + 142, 143, 209, 141, 320, 144, 142, 143, 215, 331, + 151, 144, 142, 143, 219, 320, 223, 144, 147, 148, + 149, 150, 50, 224, 225, 145, 146, 147, 148, 149, + 150, 145, 146, 147, 148, 149, 150, 145, 146, 147, + 148, 149, 150, 226, 357, 227, 139, 140, 245, 228, + 380, 141, 250, 140, 259, 248, 397, 141, 249, 260, + 142, 143, 253, 270, 271, 274, 142, 143, 43, 80, + 276, 144, 287, 292, 296, 280, 298, 301, 309, 310, + 308, 332, 311, 333, 312, 145, 146, 147, 148, 149, + 150, 145, 146, 147, 148, 149, 150, 313, 314, 315, + 335, 139, 338, 43, 80, 83, 339, 342, 140, 340, + 400, 346, 141, 309, 310, 343, 352, 311, -187, 312, + 384, 142, 143, 386, 395, 316, 144, 396, 401, 84, + 422, 85, 313, 314, 315, 359, 407, 420, 431, 434, + 83, 441, 444, 445, 446, 16, 145, 146, 147, 148, + 149, 150, 79, 25, 139, 48, 114, 295, 255, 155, + 316, 140, 139, 256, 84, 141, 85, 232, 199, 140, + 252, 293, 218, 141, 142, 143, 300, 93, 206, 144, + 31, 174, 142, 143, 207, 176, 208, 144, 354, 290, + 263, 272, 32, 33, 34, 35, 36, 37, 38, 145, + 146, 147, 148, 149, 150, 49, 139, 145, 146, 147, + 148, 149, 150, 140, 139, 133, 184, 141, 336, 126, + 421, 140, 439, 385, 376, 141, 142, 143, 113, 139, + 31, 144, 0, 214, 142, 143, 140, 0, 0, 144, + 141, 0, 32, 33, 34, 35, 36, 37, 38, 142, + 143, 145, 146, 147, 148, 149, 150, 0, 0, 145, + 146, 147, 148, 149, 150, 0, 0, 0, 377, 31, + 0, 0, 0, 0, 145, 146, 147, 148, 149, 150, + 0, 32, 33, 34, 35, 36, 37, 38, 0, 0, + 0, 0, 0, 0, 297 + }; + + const short + Parser::yycheck_[] = + { + 26, 129, 227, 6, 321, 31, 38, 168, 19, 75, + 76, 20, 64, 20, 306, 395, 6, 20, 394, 24, + 46, 32, 33, 34, 35, 36, 37, 344, 366, 6, + 20, 97, 265, 85, 316, 411, 102, 6, 59, 7, + 66, 14, 6, 45, 336, 77, 53, 427, 281, 387, + 23, 20, 20, 74, 215, 64, 20, 395, 20, 376, + 377, 63, 438, 53, 90, 403, 69, 48, 94, 121, + 39, 409, 6, 139, 140, 141, 142, 143, 144, 145, + 146, 147, 148, 149, 150, 151, 20, 404, 69, 427, + 65, 53, 7, 68, 71, 10, 30, 31, 32, 61, + 333, 63, 384, 420, 156, 20, 444, 332, 0, 6, + 7, 163, 61, 6, 431, 6, 61, 6, 25, 16, + 17, 55, 67, 20, 73, 22, 178, 20, 43, 20, + 64, 20, 158, 31, 32, 69, 162, 54, 35, 36, + 37, 75, 54, 169, 3, 4, 43, 20, 65, 6, + 7, 54, 67, 65, 69, 7, 71, 55, 224, 16, + 17, 65, 65, 20, 216, 22, 63, 71, 20, 221, + 67, 223, 69, 59, 71, 65, 54, 54, 35, 36, + 37, 64, 72, 235, 40, 71, 43, 65, 65, 41, + 7, 43, 218, 10, 220, 65, 20, 249, 250, 61, + 70, 227, 228, 20, 66, 67, 63, 259, 38, 7, + 67, 237, 69, 265, 71, 67, 65, 69, 346, 271, + 65, 69, 20, 72, 66, 65, 43, 72, 280, 281, + 72, 283, 72, 61, 44, 45, 46, 47, 66, 67, + 266, 7, 294, 65, 69, 43, 66, 313, 70, 7, + 67, 61, 69, 61, 20, 53, 18, 63, 66, 67, + 5, 71, 20, 69, 20, 276, 298, 63, 396, 67, + 296, 69, 298, 339, 340, 31, 32, 43, 7, 305, + 306, 333, 410, 349, 316, 43, 338, 53, 354, 321, + 316, 317, 65, 359, 20, 321, 20, 53, 71, 55, + 428, 67, 69, 69, 68, 61, 332, 63, 64, 67, + 336, 69, 344, 20, 8, 65, 65, 65, 344, 75, + 70, 15, 70, 65, 20, 19, 70, 353, 70, 44, + 45, 46, 47, 65, 28, 29, 5, 6, 70, 33, + 44, 45, 46, 47, 376, 377, 61, 20, 65, 65, + 376, 377, 384, 70, 70, 42, 71, 61, 384, 53, + 54, 55, 56, 57, 58, 397, 432, 27, 394, 69, + 8, 64, 404, 31, 68, 31, 8, 15, 404, 57, + 58, 19, 8, 15, 75, 411, 72, 19, 420, 15, + 28, 29, 20, 19, 420, 33, 28, 29, 23, 431, + 65, 33, 28, 29, 70, 431, 63, 33, 55, 56, + 57, 58, 438, 66, 69, 53, 54, 55, 56, 57, + 58, 53, 54, 55, 56, 57, 58, 53, 54, 55, + 56, 57, 58, 69, 72, 69, 8, 15, 9, 66, + 72, 19, 65, 15, 66, 69, 72, 19, 69, 66, + 28, 29, 72, 72, 69, 20, 28, 29, 6, 7, + 69, 33, 70, 70, 63, 65, 63, 70, 16, 17, + 72, 63, 20, 69, 22, 53, 54, 55, 56, 57, + 58, 53, 54, 55, 56, 57, 58, 35, 36, 37, + 71, 8, 69, 6, 7, 43, 69, 72, 15, 69, + 72, 69, 19, 16, 17, 72, 66, 20, 69, 22, + 67, 28, 29, 72, 69, 63, 33, 67, 72, 67, + 68, 69, 35, 36, 37, 66, 20, 13, 70, 61, + 43, 70, 63, 61, 61, 7, 53, 54, 55, 56, + 57, 58, 63, 14, 8, 28, 84, 286, 65, 115, + 63, 15, 8, 70, 67, 19, 69, 220, 156, 15, + 235, 283, 178, 19, 28, 29, 294, 69, 163, 33, + 45, 127, 28, 29, 163, 128, 166, 33, 338, 280, + 248, 257, 57, 58, 59, 60, 61, 62, 63, 53, + 54, 55, 56, 57, 58, 70, 8, 53, 54, 55, + 56, 57, 58, 15, 8, 100, 70, 19, 305, 91, + 403, 15, 427, 368, 70, 19, 28, 29, 77, 8, + 45, 33, -1, 172, 28, 29, 15, -1, -1, 33, + 19, -1, 57, 58, 59, 60, 61, 62, 63, 28, + 29, 53, 54, 55, 56, 57, 58, -1, -1, 53, + 54, 55, 56, 57, 58, -1, -1, -1, 70, 45, + -1, -1, -1, -1, 53, 54, 55, 56, 57, 58, + -1, 57, 58, 59, 60, 61, 62, 63, -1, -1, + -1, -1, -1, -1, 70 + }; + + const unsigned char + Parser::yystos_[] = + { + 0, 3, 4, 77, 24, 79, 81, 82, 83, 78, + 0, 20, 64, 84, 25, 85, 83, 6, 20, 69, + 122, 182, 20, 20, 53, 88, 40, 89, 90, 91, + 182, 45, 57, 58, 59, 60, 61, 62, 63, 64, + 86, 87, 88, 6, 20, 123, 38, 97, 91, 70, + 123, 170, 182, 182, 182, 182, 182, 182, 123, 145, + 183, 184, 54, 65, 66, 123, 5, 6, 109, 110, + 111, 113, 114, 69, 61, 66, 67, 65, 71, 87, + 7, 20, 41, 43, 67, 69, 92, 93, 69, 123, + 18, 150, 151, 111, 5, 63, 20, 30, 31, 32, + 55, 64, 69, 75, 145, 146, 147, 148, 173, 20, + 96, 146, 146, 184, 93, 92, 94, 95, 7, 99, + 48, 69, 115, 116, 123, 80, 151, 123, 128, 69, + 146, 61, 73, 147, 20, 174, 146, 20, 175, 8, + 15, 19, 28, 29, 33, 53, 54, 55, 56, 57, + 58, 65, 70, 68, 68, 96, 65, 70, 65, 70, + 20, 112, 92, 117, 118, 119, 14, 23, 42, 27, + 176, 177, 178, 179, 115, 71, 113, 129, 131, 148, + 149, 31, 31, 64, 70, 75, 146, 146, 146, 146, + 146, 146, 146, 146, 146, 146, 146, 146, 146, 95, + 100, 101, 123, 98, 72, 123, 118, 119, 122, 20, + 154, 154, 123, 181, 179, 23, 10, 92, 105, 70, + 65, 72, 102, 63, 66, 69, 69, 69, 66, 154, + 92, 123, 101, 92, 106, 103, 104, 105, 146, 7, + 20, 124, 125, 126, 127, 9, 100, 123, 69, 69, + 65, 71, 104, 72, 123, 65, 70, 65, 70, 66, + 66, 70, 180, 124, 43, 53, 92, 132, 133, 92, + 72, 69, 125, 92, 20, 155, 69, 70, 132, 123, + 65, 72, 130, 53, 92, 107, 108, 70, 182, 54, + 133, 132, 70, 106, 65, 102, 63, 70, 63, 54, + 107, 70, 39, 123, 152, 153, 156, 157, 72, 16, + 17, 20, 22, 35, 36, 37, 63, 92, 120, 121, + 123, 134, 135, 136, 137, 138, 139, 140, 141, 142, + 143, 145, 63, 69, 158, 71, 156, 157, 69, 69, + 69, 146, 72, 72, 134, 123, 69, 71, 135, 66, + 100, 132, 66, 92, 120, 146, 146, 72, 71, 66, + 72, 148, 146, 71, 70, 20, 53, 61, 63, 159, + 165, 166, 167, 168, 123, 146, 70, 70, 146, 70, + 72, 163, 164, 166, 67, 165, 72, 59, 74, 44, + 45, 46, 47, 61, 169, 69, 67, 72, 135, 135, + 72, 72, 54, 65, 134, 71, 166, 20, 160, 63, + 69, 53, 170, 166, 171, 172, 173, 148, 144, 145, + 13, 164, 68, 166, 148, 162, 170, 65, 72, 161, + 68, 70, 66, 135, 61, 71, 70, 54, 65, 172, + 148, 70, 135, 146, 63, 61, 61, 170, 166, 71 + }; + + const unsigned char + Parser::yyr1_[] = + { + 0, 76, 77, 78, 77, 80, 79, 81, 81, 82, + 82, 83, 83, 84, 85, 85, 85, 86, 86, 87, + 88, 89, 89, 90, 90, 91, 91, 92, 92, 92, + 92, 92, 93, 94, 94, 95, 96, 98, 97, 99, + 100, 100, 101, 102, 102, 103, 103, 104, 105, 105, + 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, + 111, 111, 112, 113, 114, 114, 114, 115, 115, 116, + 116, 117, 117, 118, 119, 120, 121, 121, 122, 122, + 123, 123, 124, 124, 125, 126, 126, 127, 128, 128, + 129, 130, 130, 131, 131, 132, 132, 132, 133, 133, + 133, 134, 134, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 136, 137, 138, 139, 140, 140, 141, + 142, 143, 144, 145, 145, 145, 146, 146, 146, 146, + 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, + 146, 146, 146, 147, 147, 147, 147, 147, 148, 148, + 149, 149, 150, 150, 151, 152, 152, 153, 154, 155, + 156, 156, 157, 158, 158, 159, 159, 160, 161, 161, + 162, 162, 163, 163, 164, 165, 165, 166, 166, 166, + 166, 166, 166, 166, 166, 166, 166, 167, 168, 169, + 169, 169, 169, 170, 170, 171, 171, 172, 172, 173, + 173, 173, 174, 174, 175, 176, 176, 177, 178, 178, + 180, 179, 181, 181, 182, 182, 182, 182, 182, 182, + 182, 182, 182, 182, 183, 183, 184 + }; + + const signed char + Parser::yyr2_[] = + { + 0, 2, 2, 0, 3, 0, 8, 1, 0, 1, + 2, 2, 4, 1, 2, 4, 0, 1, 3, 1, + 1, 1, 0, 1, 2, 4, 4, 1, 1, 1, + 3, 3, 1, 1, 3, 2, 1, 0, 9, 4, + 1, 3, 1, 2, 0, 2, 3, 6, 1, 2, + 1, 3, 3, 1, 1, 3, 1, 0, 1, 2, + 4, 5, 1, 1, 9, 8, 5, 1, 0, 2, + 3, 1, 2, 5, 5, 5, 3, 1, 1, 1, + 1, 1, 1, 3, 3, 1, 1, 1, 0, 2, + 10, 2, 0, 1, 0, 0, 1, 3, 2, 3, + 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 3, 2, 2, 5, 3, 5, 7, 8, + 5, 4, 3, 1, 3, 4, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, + 4, 1, 1, 1, 3, 1, 3, 2, 1, 3, + 1, 0, 1, 2, 12, 2, 1, 4, 1, 1, + 1, 2, 5, 3, 0, 1, 3, 1, 2, 0, + 3, 1, 1, 3, 1, 1, 3, 3, 5, 1, + 3, 3, 5, 6, 4, 6, 8, 1, 1, 1, + 1, 1, 1, 1, 4, 1, 3, 1, 1, 1, + 3, 3, 1, 0, 1, 1, 0, 1, 1, 2, + 0, 9, 1, 4, 3, 3, 3, 3, 3, 3, + 4, 3, 1, 3, 1, 3, 3 + }; + + + + // YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + // First, the terminals, then, starting at \a yyntokens_, nonterminals. + const char* + const Parser::yytname_[] = + { + "\"end of file\"", "error", "$undefined", "START_PROGRAM", + "START_PRODUCT", "ALGEBRA", "MODE", "\"alphabet keyword\"", "AND", + "AXIOM", "CHOICE", "DEC", "DEQ", "ELSE", "EXTENDS", "EQ", "FOR", "WHILE", + "GRAMMAR", "GT", "STRING", "IEQ", "IF", "IMPLEMENTS", "IMPORT", "INPUT", + "INC", "INSTANCE", "LT", "NEQ", "NOT", "NUMBER", "FLOAT", "OR", + "PARAMETERS", "RETURN", "CONTINUE", "BREAK", "SIGNATURE", "TABULATED", + "TYPE", "EXTERN", "USES", "VOID", "WITH", "SUCHTHAT", "WITH_OVERLAY", + "SUCHTHAT_OVERLAY", "AUTOMATIC", "LEB", "REB", "UNEXPECTED_CHARACTER", + "LOWER_THAN_ELSE", "'<'", "'>'", "'-'", "'+'", "'*'", "'/'", "'|'", + "'%'", "'.'", "'^'", "'{'", "'\"'", "','", "'='", "'['", "']'", "'('", + "')'", "'}'", "';'", "'$'", "'#'", "'\\''", "$accept", "start", "$@1", + "program", "$@2", "imports_opt", "imports", "import", "module_ident", + "input_opt", "inputs", "input", "input_specifier", "types_opt", "types", + "type", "datatype", "type_specifier", "named_datatypes", + "named_datatype", "name_ident", "signature", "@3", "sig_args", "args", + "arg", "signtparas", "sig_decls", "decl", "qual_datatype", "datatypes", + "multi_datatype", "multi_datatypes", "algebras_opt", "algebras", + "algebra", "automatic_specifier", "mode", "algebra_head", "parameters", + "parameter_block", "var_decl_inits", "var_decl_init_p", + "var_decl_init_k", "var_decl_init", "var_decl", "algebra_ident", "ident", + "eqs", "eq", "sig_var", "sort_ident", "fn_defs", "fn_def", "fnntparas", + "mode_opt", "para_decls", "para_decl", "statements", "statement", + "continue", "break", "fn_call", "return", "if", "for", "while", "assign", + "inc_stmt", "var_access", "expr", "number", "exprs", "exprs_empty", + "grammars", "grammar", "grammar_body", "tabulated", "signature_ident", + "nt_ident", "productions", "production", "ntargs", "rhs", + "choice_fn_ident", "ntparas", "filters", "tracks", "track", "alts", + "alt", "sig_fn_or_term_ident", "symbol_ident", "filter_kw", "filter_fn", + "rhs_args", "rhs_arg", "const", "string_constant", "character_constant", + "instances_opt", "instances", "instances_", "instance", "$@4", "i_lhs", + "product", "defaults", "default", YY_NULLPTR + }; + +#if YYDEBUG + const short + Parser::yyrline_[] = + { + 0, 370, 370, 371, 371, 385, 383, 396, 396, 398, + 399, 401, 402, 414, 420, 426, 431, 433, 440, 446, + 483, 488, 488, 490, 490, 492, 495, 505, 507, 510, + 513, 516, 546, 550, 555, 558, 569, 575, 574, 591, + 606, 612, 616, 620, 623, 627, 633, 638, 653, 654, + 664, 671, 677, 684, 698, 705, 728, 728, 730, 730, + 732, 745, 785, 789, 798, 808, 817, 855, 855, 857, + 858, 860, 860, 862, 866, 878, 882, 885, 890, 890, + 892, 892, 896, 903, 909, 913, 914, 918, 925, 931, + 943, 956, 959, 962, 962, 964, 968, 974, 979, 982, + 989, 1047, 1053, 1059, 1060, 1061, 1062, 1063, 1064, 1065, + 1066, 1067, 1068, 1071, 1073, 1075, 1081, 1087, 1090, 1103, + 1116, 1128, 1135, 1154, 1155, 1156, 1167, 1168, 1169, 1170, + 1171, 1172, 1173, 1174, 1175, 1176, 1178, 1179, 1180, 1181, + 1182, 1188, 1189, 1191, 1192, 1195, 1198, 1202, 1207, 1211, + 1214, 1217, 1227, 1234, 1240, 1260, 1268, 1286, 1298, 1300, + 1304, 1311, 1318, 1331, 1334, 1363, 1366, 1376, 1382, 1385, + 1388, 1394, 1402, 1408, 1415, 1417, 1420, 1425, 1428, 1436, + 1439, 1464, 1471, 1517, 1535, 1543, 1549, 1589, 1591, 1595, + 1596, 1597, 1598, 1627, 1631, 1657, 1662, 1667, 1669, 1678, + 1679, 1684, 1745, 1745, 1747, 1759, 1759, 1761, 1763, 1768, + 1781, 1781, 1797, 1801, 1808, 1814, 1820, 1826, 1832, 1839, + 1866, 1874, 1875, 1905, 1926, 1926, 1928 + }; + + // Print the state stack on the debug stream. + void + Parser::yystack_print_ () + { + *yycdebug_ << "Stack now"; + for (stack_type::const_iterator + i = yystack_.begin (), + i_end = yystack_.end (); + i != i_end; ++i) + *yycdebug_ << ' ' << int (i->state); + *yycdebug_ << '\n'; + } + + // Report on the debug stream that the rule \a yyrule is going to be reduced. + void + Parser::yy_reduce_print_ (int yyrule) + { + int yylno = yyrline_[yyrule]; + int yynrhs = yyr2_[yyrule]; + // Print the symbols being reduced, and their result. + *yycdebug_ << "Reducing stack by rule " << yyrule - 1 + << " (line " << yylno << "):\n"; + // The symbols being reduced. + for (int yyi = 0; yyi < yynrhs; yyi++) + YY_SYMBOL_PRINT (" $" << yyi + 1 << " =", + yystack_[(yynrhs) - (yyi + 1)]); + } +#endif // YYDEBUG + + Parser::token_number_type + Parser::yytranslate_ (int t) + { + // YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to + // TOKEN-NUM as returned by yylex. + static + const token_number_type + translate_table[] = + { + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 64, 74, 73, 60, 2, 75, + 69, 70, 57, 56, 65, 55, 61, 58, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 72, + 53, 66, 54, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 67, 2, 68, 62, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 63, 59, 71, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52 + }; + const int user_token_number_max_ = 307; + + if (t <= 0) + return yyeof_; + else if (t <= user_token_number_max_) + return translate_table[t]; + else + return yy_undef_token_; + } + +} // yy +#line 3108 "parser.cc" + +#line 1930 "parser.y" + + +void yy::Parser::error(const yy::Parser::location_type &l, const std::string& m) +{ + driver.error(l, m); +} + diff --git a/src/parser.hh b/src/parser.hh new file mode 100644 index 000000000..4d092d441 --- /dev/null +++ b/src/parser.hh @@ -0,0 +1,829 @@ +// A Bison parser, made by GNU Bison 3.5.1. + +// Skeleton interface for Bison LALR(1) parsers in C++ + +// Copyright (C) 2002-2015, 2018-2020 Free Software Foundation, Inc. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +// As a special exception, you may create a larger work that contains +// part or all of the Bison parser skeleton and distribute that work +// under terms of your choice, so long as that work isn't itself a +// parser generator using the skeleton or a modified version thereof +// as a parser skeleton. Alternatively, if you modify or redistribute +// the parser skeleton itself, you may (at your option) remove this +// special exception, which will cause the skeleton and the resulting +// Bison output files to be licensed under the GNU General Public +// License without this special exception. + +// This special exception was added by the Free Software Foundation in +// version 2.2 of Bison. + + +/** + ** \file parser.hh + ** Define the yy::parser class. + */ + +// C++ LALR(1) parser skeleton written by Akim Demaille. + +// Undocumented macros, especially those whose name start with YY_, +// are private implementation details. Do not rely on them. + +#ifndef YY_YY_PARSER_HH_INCLUDED +# define YY_YY_PARSER_HH_INCLUDED +// "%code requires" blocks. +#line 86 "parser.y" + +// is pasted into parser.hh only +// (&& parser.cc says the documentation) + +#include "type_fwd.hh" +#include +#include +#include +#include "hashtable.hh" +#include "statement_fwd.hh" +#include "product_fwd.hh" +#include "alt_fwd.hh" +#include "fn_arg_fwd.hh" +#include "const_fwd.hh" +#include "var_acc_fwd.hh" +#include "symbol_fwd.hh" + +class Grammar; +class Algebra; +class Fn_Decl; +class Signature; +class Fn_Def; +class Instance; +class Arg; +class Driver; + +namespace Para_Decl { class Base; } + +#include "filter.hh" + +#line 79 "parser.hh" + + +# include // std::abort +# include +# include +# include +# include + +#if defined __cplusplus +# define YY_CPLUSPLUS __cplusplus +#else +# define YY_CPLUSPLUS 199711L +#endif + +// Support move semantics when possible. +#if 201103L <= YY_CPLUSPLUS +# define YY_MOVE std::move +# define YY_MOVE_OR_COPY move +# define YY_MOVE_REF(Type) Type&& +# define YY_RVREF(Type) Type&& +# define YY_COPY(Type) Type +#else +# define YY_MOVE +# define YY_MOVE_OR_COPY copy +# define YY_MOVE_REF(Type) Type& +# define YY_RVREF(Type) const Type& +# define YY_COPY(Type) const Type& +#endif + +// Support noexcept when possible. +#if 201103L <= YY_CPLUSPLUS +# define YY_NOEXCEPT noexcept +# define YY_NOTHROW +#else +# define YY_NOEXCEPT +# define YY_NOTHROW throw () +#endif + +// Support constexpr when possible. +#if 201703 <= YY_CPLUSPLUS +# define YY_CONSTEXPR constexpr +#else +# define YY_CONSTEXPR +#endif + + + +#ifndef YY_ATTRIBUTE_PURE +# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) +# else +# define YY_ATTRIBUTE_PURE +# endif +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) +# else +# define YY_ATTRIBUTE_UNUSED +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(E) ((void) (E)) +#else +# define YYUSE(E) /* empty */ +#endif + +#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") +#else +# define YY_INITIAL_VALUE(Value) Value +#endif +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + +#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ +# define YY_IGNORE_USELESS_CAST_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") +# define YY_IGNORE_USELESS_CAST_END \ + _Pragma ("GCC diagnostic pop") +#endif +#ifndef YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_END +#endif + +# ifndef YY_CAST +# ifdef __cplusplus +# define YY_CAST(Type, Val) static_cast (Val) +# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast (Val) +# else +# define YY_CAST(Type, Val) ((Type) (Val)) +# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) +# endif +# endif +# ifndef YY_NULLPTR +# if defined __cplusplus +# if 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif +# else +# define YY_NULLPTR ((void*)0) +# endif +# endif + +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 1 +#endif + +namespace yy { +#line 208 "parser.hh" + + + + + /// A Bison parser. + class Parser + { + public: +#ifndef YYSTYPE + /// Symbol semantic values. + union semantic_type + { +#line 117 "parser.y" + + std::string *sval; + int ival; + Algebra *algebra; + Type::Base *datatype; + Fn_Decl *fn_decl; + Signature *signature; + Filter::Type filter_kw; + std::list *exprs; + Filter *filter; + std::list *alts; + Alt::Base *alt; + std::list *rhs_args; + Fn_Arg::Base *rhs_arg; + Expr::Base *expr; + Const::Base *cons; + Var_Acc::Base *var_acc; + Tuple_Pair *named_datatype; + Tuple_List *named_datatypes; + Grammar *grammar; + std::list *grammars; + std::pair< hashtable*, + std::list *> *grammar_body; + Symbol::NT *production; + std::list *productions; + std::list *datatypes; + hashtable *eqs; + std::pair *eq; + hashtable *args; + Arg *arg; + hashtable *sig_decls; + std::pair*, std::string*>* rhs; + Fn_Def *fn_def; + hashtable *fn_defs; + Para_Decl::Base *para_decl; + std::list *para_decls; + hashtable *instances; + Instance* instance; + std::pair*> *i_lhs; + Product::Base *product; + Statement::Base *statement; + std::list* statements; + std::list *inputs; + std::list *filters; + +#line 267 "parser.hh" + + }; +#else + typedef YYSTYPE semantic_type; +#endif + /// Symbol locations. + typedef Loc location_type; + + /// Syntax errors thrown from user actions. + struct syntax_error : std::runtime_error + { + syntax_error (const location_type& l, const std::string& m) + : std::runtime_error (m) + , location (l) + {} + + syntax_error (const syntax_error& s) + : std::runtime_error (s.what ()) + , location (s.location) + {} + + ~syntax_error () YY_NOEXCEPT YY_NOTHROW; + + location_type location; + }; + + /// Tokens. + struct token + { + enum yytokentype + { + END = 0, + START_PROGRAM = 258, + START_PRODUCT = 259, + ALGEBRA = 260, + MODE = 261, + ALPHABET = 262, + AND = 263, + AXIOM = 264, + CHOICE = 265, + DEC = 266, + DEQ = 267, + ELSE = 268, + EXTENDS = 269, + EQ = 270, + FOR = 271, + WHILE = 272, + GRAMMAR = 273, + GT = 274, + STRING = 275, + IEQ = 276, + IF = 277, + IMPLEMENTS = 278, + IMPORT = 279, + INPUT = 280, + INC = 281, + INSTANCE = 282, + LT = 283, + NEQ = 284, + NOT = 285, + NUMBER = 286, + FLOAT = 287, + OR = 288, + PARAMETERS = 289, + RETURN = 290, + CONTINUE = 291, + BREAK = 292, + SIGNATURE = 293, + TABULATED = 294, + TYPE = 295, + EXTERN = 296, + USES = 297, + VOID = 298, + WITH = 299, + SUCHTHAT = 300, + WITH_OVERLAY = 301, + SUCHTHAT_OVERLAY = 302, + AUTOMATIC = 303, + LEB = 304, + REB = 305, + UNEXPECTED_CHARACTER = 306, + LOWER_THAN_ELSE = 307 + }; + }; + + /// (External) token type, as returned by yylex. + typedef token::yytokentype token_type; + + /// Symbol type: an internal symbol number. + typedef int symbol_number_type; + + /// The symbol type number to denote an empty symbol. + enum { empty_symbol = -2 }; + + /// Internal symbol number for tokens (subsumed by symbol_number_type). + typedef signed char token_number_type; + + /// A complete symbol. + /// + /// Expects its Base type to provide access to the symbol type + /// via type_get (). + /// + /// Provide access to semantic value and location. + template + struct basic_symbol : Base + { + /// Alias to Base. + typedef Base super_type; + + /// Default constructor. + basic_symbol () + : value () + , location () + {} + +#if 201103L <= YY_CPLUSPLUS + /// Move constructor. + basic_symbol (basic_symbol&& that); +#endif + + /// Copy constructor. + basic_symbol (const basic_symbol& that); + /// Constructor for valueless symbols. + basic_symbol (typename Base::kind_type t, + YY_MOVE_REF (location_type) l); + + /// Constructor for symbols with semantic value. + basic_symbol (typename Base::kind_type t, + YY_RVREF (semantic_type) v, + YY_RVREF (location_type) l); + + /// Destroy the symbol. + ~basic_symbol () + { + clear (); + } + + /// Destroy contents, and record that is empty. + void clear () + { + Base::clear (); + } + + /// Whether empty. + bool empty () const YY_NOEXCEPT; + + /// Destructive move, \a s is emptied into this. + void move (basic_symbol& s); + + /// The semantic value. + semantic_type value; + + /// The location. + location_type location; + + private: +#if YY_CPLUSPLUS < 201103L + /// Assignment operator. + basic_symbol& operator= (const basic_symbol& that); +#endif + }; + + /// Type access provider for token (enum) based symbols. + struct by_type + { + /// Default constructor. + by_type (); + +#if 201103L <= YY_CPLUSPLUS + /// Move constructor. + by_type (by_type&& that); +#endif + + /// Copy constructor. + by_type (const by_type& that); + + /// The symbol type as needed by the constructor. + typedef token_type kind_type; + + /// Constructor from (external) token numbers. + by_type (kind_type t); + + /// Record that this symbol is empty. + void clear (); + + /// Steal the symbol type from \a that. + void move (by_type& that); + + /// The (internal) type number (corresponding to \a type). + /// \a empty when empty. + symbol_number_type type_get () const YY_NOEXCEPT; + + /// The symbol type. + /// \a empty_symbol when empty. + /// An int, not token_number_type, to be able to store empty_symbol. + int type; + }; + + /// "External" symbols: returned by the scanner. + struct symbol_type : basic_symbol + {}; + + /// Build a parser object. + Parser (Driver& driver_yyarg, yy::Parser::token_type start_symbol_yyarg); + virtual ~Parser (); + + /// Parse. An alias for parse (). + /// \returns 0 iff parsing succeeded. + int operator() (); + + /// Parse. + /// \returns 0 iff parsing succeeded. + virtual int parse (); + +#if YYDEBUG + /// The current debugging stream. + std::ostream& debug_stream () const YY_ATTRIBUTE_PURE; + /// Set the current debugging stream. + void set_debug_stream (std::ostream &); + + /// Type for debugging levels. + typedef int debug_level_type; + /// The current debugging level. + debug_level_type debug_level () const YY_ATTRIBUTE_PURE; + /// Set the current debugging level. + void set_debug_level (debug_level_type l); +#endif + + /// Report a syntax error. + /// \param loc where the syntax error is found. + /// \param msg a description of the syntax error. + virtual void error (const location_type& loc, const std::string& msg); + + /// Report a syntax error. + void error (const syntax_error& err); + + + + private: + /// This class is not copyable. + Parser (const Parser&); + Parser& operator= (const Parser&); + + /// Stored state numbers (used for stacks). + typedef short state_type; + + /// Generate an error message. + /// \param yystate the state where the error occurred. + /// \param yyla the lookahead token. + virtual std::string yysyntax_error_ (state_type yystate, + const symbol_type& yyla) const; + + /// Compute post-reduction state. + /// \param yystate the current state + /// \param yysym the nonterminal to push on the stack + static state_type yy_lr_goto_state_ (state_type yystate, int yysym); + + /// Whether the given \c yypact_ value indicates a defaulted state. + /// \param yyvalue the value to check + static bool yy_pact_value_is_default_ (int yyvalue); + + /// Whether the given \c yytable_ value indicates a syntax error. + /// \param yyvalue the value to check + static bool yy_table_value_is_error_ (int yyvalue); + + static const short yypact_ninf_; + static const short yytable_ninf_; + + /// Convert a scanner token number \a t to a symbol number. + /// In theory \a t should be a token_type, but character literals + /// are valid, yet not members of the token_type enum. + static token_number_type yytranslate_ (int t); + + // Tables. + // YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + // STATE-NUM. + static const short yypact_[]; + + // YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + // Performed when YYTABLE does not specify something else to do. Zero + // means the default is an error. + static const unsigned char yydefact_[]; + + // YYPGOTO[NTERM-NUM]. + static const short yypgoto_[]; + + // YYDEFGOTO[NTERM-NUM]. + static const short yydefgoto_[]; + + // YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + // positive, shift that token. If negative, reduce the rule whose + // number is the opposite. If YYTABLE_NINF, syntax error. + static const short yytable_[]; + + static const short yycheck_[]; + + // YYSTOS[STATE-NUM] -- The (internal number of the) accessing + // symbol of state STATE-NUM. + static const unsigned char yystos_[]; + + // YYR1[YYN] -- Symbol number of symbol that rule YYN derives. + static const unsigned char yyr1_[]; + + // YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. + static const signed char yyr2_[]; + + + /// Convert the symbol name \a n to a form suitable for a diagnostic. + static std::string yytnamerr_ (const char *n); + + + /// For a symbol, its name in clear. + static const char* const yytname_[]; +#if YYDEBUG + // YYRLINE[YYN] -- Source line where rule number YYN was defined. + static const short yyrline_[]; + /// Report on the debug stream that the rule \a r is going to be reduced. + virtual void yy_reduce_print_ (int r); + /// Print the state stack on the debug stream. + virtual void yystack_print_ (); + + /// Debugging level. + int yydebug_; + /// Debug stream. + std::ostream* yycdebug_; + + /// \brief Display a symbol type, value and location. + /// \param yyo The output stream. + /// \param yysym The symbol. + template + void yy_print_ (std::ostream& yyo, const basic_symbol& yysym) const; +#endif + + /// \brief Reclaim the memory associated to a symbol. + /// \param yymsg Why this token is reclaimed. + /// If null, print nothing. + /// \param yysym The symbol. + template + void yy_destroy_ (const char* yymsg, basic_symbol& yysym) const; + + private: + /// Type access provider for state based symbols. + struct by_state + { + /// Default constructor. + by_state () YY_NOEXCEPT; + + /// The symbol type as needed by the constructor. + typedef state_type kind_type; + + /// Constructor. + by_state (kind_type s) YY_NOEXCEPT; + + /// Copy constructor. + by_state (const by_state& that) YY_NOEXCEPT; + + /// Record that this symbol is empty. + void clear () YY_NOEXCEPT; + + /// Steal the symbol type from \a that. + void move (by_state& that); + + /// The (internal) type number (corresponding to \a state). + /// \a empty_symbol when empty. + symbol_number_type type_get () const YY_NOEXCEPT; + + /// The state number used to denote an empty symbol. + /// We use the initial state, as it does not have a value. + enum { empty_state = 0 }; + + /// The state. + /// \a empty when empty. + state_type state; + }; + + /// "Internal" symbol: element of the stack. + struct stack_symbol_type : basic_symbol + { + /// Superclass. + typedef basic_symbol super_type; + /// Construct an empty symbol. + stack_symbol_type (); + /// Move or copy construction. + stack_symbol_type (YY_RVREF (stack_symbol_type) that); + /// Steal the contents from \a sym to build this. + stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) sym); +#if YY_CPLUSPLUS < 201103L + /// Assignment, needed by push_back by some old implementations. + /// Moves the contents of that. + stack_symbol_type& operator= (stack_symbol_type& that); + + /// Assignment, needed by push_back by other implementations. + /// Needed by some other old implementations. + stack_symbol_type& operator= (const stack_symbol_type& that); +#endif + }; + + /// A stack with random access from its top. + template > + class stack + { + public: + // Hide our reversed order. + typedef typename S::reverse_iterator iterator; + typedef typename S::const_reverse_iterator const_iterator; + typedef typename S::size_type size_type; + typedef typename std::ptrdiff_t index_type; + + stack (size_type n = 200) + : seq_ (n) + {} + + /// Random access. + /// + /// Index 0 returns the topmost element. + const T& + operator[] (index_type i) const + { + return seq_[size_type (size () - 1 - i)]; + } + + /// Random access. + /// + /// Index 0 returns the topmost element. + T& + operator[] (index_type i) + { + return seq_[size_type (size () - 1 - i)]; + } + + /// Steal the contents of \a t. + /// + /// Close to move-semantics. + void + push (YY_MOVE_REF (T) t) + { + seq_.push_back (T ()); + operator[] (0).move (t); + } + + /// Pop elements from the stack. + void + pop (std::ptrdiff_t n = 1) YY_NOEXCEPT + { + for (; 0 < n; --n) + seq_.pop_back (); + } + + /// Pop all elements from the stack. + void + clear () YY_NOEXCEPT + { + seq_.clear (); + } + + /// Number of elements on the stack. + index_type + size () const YY_NOEXCEPT + { + return index_type (seq_.size ()); + } + + std::ptrdiff_t + ssize () const YY_NOEXCEPT + { + return std::ptrdiff_t (size ()); + } + + /// Iterator on top of the stack (going downwards). + const_iterator + begin () const YY_NOEXCEPT + { + return seq_.rbegin (); + } + + /// Bottom of the stack. + const_iterator + end () const YY_NOEXCEPT + { + return seq_.rend (); + } + + /// Present a slice of the top of a stack. + class slice + { + public: + slice (const stack& stack, index_type range) + : stack_ (stack) + , range_ (range) + {} + + const T& + operator[] (index_type i) const + { + return stack_[range_ - i]; + } + + private: + const stack& stack_; + index_type range_; + }; + + private: + stack (const stack&); + stack& operator= (const stack&); + /// The wrapped container. + S seq_; + }; + + + /// Stack type. + typedef stack stack_type; + + /// The stack. + stack_type yystack_; + + /// Push a new state on the stack. + /// \param m a debug message to display + /// if null, no trace is output. + /// \param sym the symbol + /// \warning the contents of \a s.value is stolen. + void yypush_ (const char* m, YY_MOVE_REF (stack_symbol_type) sym); + + /// Push a new look ahead token on the state on the stack. + /// \param m a debug message to display + /// if null, no trace is output. + /// \param s the state + /// \param sym the symbol (for its value and location). + /// \warning the contents of \a sym.value is stolen. + void yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym); + + /// Pop \a n symbols from the stack. + void yypop_ (int n = 1); + + /// Some specific tokens. + static const token_number_type yy_error_token_ = 1; + static const token_number_type yy_undef_token_ = 2; + + /// Constants. + enum + { + yyeof_ = 0, + yylast_ = 684, ///< Last index in yytable_. + yynnts_ = 109, ///< Number of nonterminal symbols. + yyfinal_ = 10, ///< Termination state number. + yyntokens_ = 76 ///< Number of tokens. + }; + + + // User arguments. + Driver& driver; + yy::Parser::token_type start_symbol; + }; + + +} // yy +#line 824 "parser.hh" + + + + + +#endif // !YY_YY_PARSER_HH_INCLUDED diff --git a/src/parser.output b/src/parser.output new file mode 100644 index 000000000..b4ab8ad19 --- /dev/null +++ b/src/parser.output @@ -0,0 +1,6119 @@ +Terminals unused in grammar + + DEC + DEQ + IEQ + INC + PARAMETERS + LEB + REB + UNEXPECTED_CHARACTER + + +Grammar + + 0 $accept: start "end of file" + + 1 start: START_PROGRAM program + + 2 $@1: %empty + + 3 start: START_PRODUCT $@1 product + + 4 $@2: %empty + + 5 program: imports_opt input_opt types_opt signature algebras_opt grammars $@2 instances_opt + + 6 imports_opt: imports + 7 | %empty + + 8 imports: import + 9 | imports import + + 10 import: IMPORT module_ident + 11 | IMPORT '"' STRING '"' + + 12 module_ident: STRING + + 13 input_opt: INPUT input_specifier + 14 | INPUT '<' inputs '>' + 15 | %empty + + 16 inputs: input + 17 | inputs ',' input + + 18 input: input_specifier + + 19 input_specifier: STRING + + 20 types_opt: types + 21 | %empty + + 22 types: type + 23 | types type + + 24 type: TYPE ident '=' datatype + 25 | TYPE ident '=' EXTERN + + 26 datatype: type_specifier + 27 | "alphabet keyword" + 28 | VOID + 29 | '[' type_specifier ']' + 30 | '(' named_datatypes ')' + + 31 type_specifier: STRING + + 32 named_datatypes: named_datatype + 33 | named_datatypes ',' named_datatype + + 34 named_datatype: datatype name_ident + + 35 name_ident: STRING + + 36 @3: %empty + + 37 signature: SIGNATURE ident '(' sig_args ')' @3 '{' sig_decls '}' + + 38 sig_args: "alphabet keyword" ',' args signtparas + + 39 args: arg + 40 | args ',' arg + + 41 arg: ident + + 42 signtparas: ';' datatypes + 43 | %empty + + 44 sig_decls: decl ';' + 45 | sig_decls decl ';' + + 46 decl: qual_datatype ident '(' multi_datatypes signtparas ')' + + 47 qual_datatype: datatype + 48 | CHOICE datatype + + 49 datatypes: datatype + 50 | datatypes ',' datatype + + 51 multi_datatype: '<' datatypes '>' + 52 | datatype + + 53 multi_datatypes: multi_datatype + 54 | multi_datatypes ',' multi_datatype + + 55 algebras_opt: algebras + 56 | %empty + + 57 algebras: algebra + 58 | algebras algebra + + 59 algebra: algebra_head '{' fn_defs '}' + 60 | ALGEBRA ident AUTOMATIC automatic_specifier ';' + + 61 automatic_specifier: STRING + + 62 mode: MODE + + 63 algebra_head: mode ALGEBRA ident parameters IMPLEMENTS signature_ident '(' eqs ')' + 64 | ALGEBRA ident parameters IMPLEMENTS signature_ident '(' eqs ')' + 65 | ALGEBRA ident parameters EXTENDS algebra_ident + + 66 parameters: parameter_block + 67 | %empty + + 68 parameter_block: '(' var_decl_init_p + 69 | '(' var_decl_inits var_decl_init_p + + 70 var_decl_inits: var_decl_init_k + 71 | var_decl_inits var_decl_init_k + + 72 var_decl_init_p: datatype ident '=' expr ')' + + 73 var_decl_init_k: datatype ident '=' expr ',' + + 74 var_decl_init: datatype ident '=' expr ';' + + 75 var_decl: datatype ident ';' + 76 | var_decl_init + + 77 algebra_ident: STRING + 78 | MODE + + 79 ident: STRING + 80 | MODE + + 81 eqs: eq + 82 | eqs ',' eq + + 83 eq: sig_var '=' datatype + + 84 sig_var: sort_ident + 85 | "alphabet keyword" + + 86 sort_ident: STRING + + 87 fn_defs: %empty + 88 | fn_defs fn_def + + 89 fn_def: mode_opt qual_datatype ident '(' para_decls fnntparas ')' '{' statements '}' + + 90 fnntparas: ';' para_decls + 91 | %empty + + 92 mode_opt: mode + 93 | %empty + + 94 para_decls: %empty + 95 | para_decl + 96 | para_decls ',' para_decl + + 97 para_decl: datatype ident + 98 | '<' para_decls '>' + 99 | VOID + + 100 statements: statement + 101 | statements statement + + 102 statement: continue + 103 | break + 104 | return + 105 | if + 106 | for + 107 | while + 108 | assign + 109 | var_decl + 110 | fn_call + 111 | '{' statements '}' + + 112 continue: CONTINUE ';' + + 113 break: BREAK ';' + + 114 fn_call: ident '(' exprs ')' ';' + + 115 return: RETURN expr ';' + + 116 if: IF '(' expr ')' statement + 117 | IF '(' expr ')' statement ELSE statement + + 118 for: FOR '(' var_decl_init expr ';' inc_stmt ')' statement + + 119 while: WHILE '(' expr ')' statement + + 120 assign: var_access '=' expr ';' + + 121 inc_stmt: var_access '=' expr + + 122 var_access: ident + 123 | var_access '.' name_ident + 124 | var_access '[' expr ']' + + 125 expr: expr '<' expr + 126 | expr '>' expr + 127 | expr LT expr + 128 | expr GT expr + 129 | expr EQ expr + 130 | expr NEQ expr + 131 | expr AND expr + 132 | expr OR expr + 133 | '(' expr ')' + 134 | NOT expr + 135 | expr '+' expr + 136 | expr '-' expr + 137 | expr '*' expr + 138 | expr '/' expr + 139 | STRING '(' exprs_empty ')' + 140 | var_access + 141 | const + + 142 number: NUMBER + 143 | NUMBER '.' NUMBER + 144 | FLOAT + 145 | NUMBER '$' NUMBER + 146 | '-' number + + 147 exprs: expr + 148 | exprs ',' expr + + 149 exprs_empty: exprs + 150 | %empty + + 151 grammars: grammar + 152 | grammars grammar + + 153 grammar: GRAMMAR ident USES signature_ident '(' AXIOM '=' nt_ident ')' '{' grammar_body '}' + + 154 grammar_body: tabulated productions + 155 | productions + + 156 tabulated: TABULATED '{' args '}' + + 157 signature_ident: STRING + + 158 nt_ident: STRING + + 159 productions: production + 160 | productions production + + 161 production: ident ntargs '=' rhs ';' + + 162 ntargs: '(' para_decls ')' + 163 | %empty + + 164 rhs: alts + 165 | alts '#' choice_fn_ident + + 166 choice_fn_ident: STRING + + 167 ntparas: ';' exprs + 168 | %empty + + 169 filters: filters ',' filter_fn + 170 | filter_fn + + 171 tracks: track + 172 | tracks ',' track + + 173 track: alt + + 174 alts: alt + 175 | alts '|' alt + + 176 alt: '{' alts '}' + 177 | sig_fn_or_term_ident '(' rhs_args ntparas ')' + 178 | symbol_ident + 179 | alt filter_kw filter_fn + 180 | '<' tracks '>' + 181 | alt filter_kw '<' filters '>' + 182 | alt '.' '(' exprs ')' '.' + 183 | symbol_ident '[' exprs ']' + 184 | alt '.' '{' alt '}' '.' + 185 | '.' '[' statements ']' '.' '{' alt '}' + + 186 sig_fn_or_term_ident: STRING + + 187 symbol_ident: STRING + + 188 filter_kw: WITH + 189 | SUCHTHAT + 190 | WITH_OVERLAY + 191 | SUCHTHAT_OVERLAY + + 192 filter_fn: ident + 193 | ident '(' exprs ')' + + 194 rhs_args: rhs_arg + 195 | rhs_args ',' rhs_arg + + 196 rhs_arg: alt + 197 | const + + 198 const: number + 199 | '\'' character_constant '\'' + 200 | '"' string_constant '"' + + 201 string_constant: STRING + 202 | %empty + + 203 character_constant: STRING + + 204 instances_opt: instances + 205 | %empty + + 206 instances: instances_ + + 207 instances_: instance + 208 | instances_ instance + + 209 $@4: %empty + + 210 instance: INSTANCE i_lhs '=' ident $@4 '(' product ')' ';' + + 211 i_lhs: ident + 212 | ident '(' args ')' + + 213 product: product '*' product + 214 | product '/' product + 215 | product '%' product + 216 | product '^' product + 217 | product '.' product + 218 | product '|' product + 219 | product '{' defaults '}' + 220 | '(' product ')' + 221 | algebra_ident + 222 | product SUCHTHAT filter_fn + + 223 defaults: default + 224 | defaults ',' default + + 225 default: var_access '=' expr + + +Terminals, with rules where they appear + + "end of file" (0) 0 + '"' (34) 11 200 + '#' (35) 165 + '$' (36) 145 + '%' (37) 215 + '\'' (39) 199 + '(' (40) 30 37 46 63 64 68 69 89 114 116 117 118 119 133 139 153 162 177 182 193 210 212 220 + ')' (41) 30 37 46 63 64 72 89 114 116 117 118 119 133 139 153 162 177 182 193 210 212 220 + '*' (42) 137 213 + '+' (43) 135 + ',' (44) 17 33 38 40 50 54 73 82 96 148 169 172 195 224 + '-' (45) 136 146 + '.' (46) 123 143 182 184 185 217 + '/' (47) 138 214 + ';' (59) 42 44 45 60 74 75 90 112 113 114 115 118 120 161 167 210 + '<' (60) 14 51 98 125 180 181 + '=' (61) 24 25 72 73 74 83 120 121 153 161 210 225 + '>' (62) 14 51 98 126 180 181 + '[' (91) 29 124 183 185 + ']' (93) 29 124 183 185 + '^' (94) 216 + '{' (123) 37 59 89 111 153 156 176 184 185 219 + '|' (124) 175 218 + '}' (125) 37 59 89 111 153 156 176 184 185 219 + error (256) + START_PROGRAM (258) 1 + START_PRODUCT (259) 3 + ALGEBRA (260) 60 63 64 65 + MODE (261) 62 78 80 + "alphabet keyword" (262) 27 38 85 + AND (263) 131 + AXIOM (264) 153 + CHOICE (265) 48 + DEC (266) + DEQ (267) + ELSE (268) 117 + EXTENDS (269) 65 + EQ (270) 129 + FOR (271) 118 + WHILE (272) 119 + GRAMMAR (273) 153 + GT (274) 128 + STRING (275) 11 12 19 31 35 61 77 79 86 139 157 158 166 186 187 201 203 + IEQ (276) + IF (277) 116 117 + IMPLEMENTS (278) 63 64 + IMPORT (279) 10 11 + INPUT (280) 13 14 + INC (281) + INSTANCE (282) 210 + LT (283) 127 + NEQ (284) 130 + NOT (285) 134 + NUMBER (286) 142 143 145 + FLOAT (287) 144 + OR (288) 132 + PARAMETERS (289) + RETURN (290) 115 + CONTINUE (291) 112 + BREAK (292) 113 + SIGNATURE (293) 37 + TABULATED (294) 156 + TYPE (295) 24 25 + EXTERN (296) 25 + USES (297) 153 + VOID (298) 28 99 + WITH (299) 188 + SUCHTHAT (300) 189 222 + WITH_OVERLAY (301) 190 + SUCHTHAT_OVERLAY (302) 191 + AUTOMATIC (303) 60 + LEB (304) + REB (305) + UNEXPECTED_CHARACTER (306) + LOWER_THAN_ELSE (307) + + +Nonterminals, with rules where they appear + + $accept (76) + on left: 0 + start (77) + on left: 1 3 + on right: 0 + $@1 (78) + on left: 2 + on right: 3 + program (79) + on left: 5 + on right: 1 + $@2 (80) + on left: 4 + on right: 5 + imports_opt (81) + on left: 6 7 + on right: 5 + imports (82) + on left: 8 9 + on right: 6 9 + import (83) + on left: 10 11 + on right: 8 9 + module_ident (84) + on left: 12 + on right: 10 + input_opt (85) + on left: 13 14 15 + on right: 5 + inputs (86) + on left: 16 17 + on right: 14 17 + input (87) + on left: 18 + on right: 16 17 + input_specifier (88) + on left: 19 + on right: 13 18 + types_opt (89) + on left: 20 21 + on right: 5 + types (90) + on left: 22 23 + on right: 20 23 + type (91) + on left: 24 25 + on right: 22 23 + datatype (92) + on left: 26 27 28 29 30 + on right: 24 34 47 48 49 50 52 72 73 74 75 83 97 + type_specifier (93) + on left: 31 + on right: 26 29 + named_datatypes (94) + on left: 32 33 + on right: 30 33 + named_datatype (95) + on left: 34 + on right: 32 33 + name_ident (96) + on left: 35 + on right: 34 123 + signature (97) + on left: 37 + on right: 5 + @3 (98) + on left: 36 + on right: 37 + sig_args (99) + on left: 38 + on right: 37 + args (100) + on left: 39 40 + on right: 38 40 156 212 + arg (101) + on left: 41 + on right: 39 40 + signtparas (102) + on left: 42 43 + on right: 38 46 + sig_decls (103) + on left: 44 45 + on right: 37 45 + decl (104) + on left: 46 + on right: 44 45 + qual_datatype (105) + on left: 47 48 + on right: 46 89 + datatypes (106) + on left: 49 50 + on right: 42 50 51 + multi_datatype (107) + on left: 51 52 + on right: 53 54 + multi_datatypes (108) + on left: 53 54 + on right: 46 54 + algebras_opt (109) + on left: 55 56 + on right: 5 + algebras (110) + on left: 57 58 + on right: 55 58 + algebra (111) + on left: 59 60 + on right: 57 58 + automatic_specifier (112) + on left: 61 + on right: 60 + mode (113) + on left: 62 + on right: 63 92 + algebra_head (114) + on left: 63 64 65 + on right: 59 + parameters (115) + on left: 66 67 + on right: 63 64 65 + parameter_block (116) + on left: 68 69 + on right: 66 + var_decl_inits (117) + on left: 70 71 + on right: 69 71 + var_decl_init_p (118) + on left: 72 + on right: 68 69 + var_decl_init_k (119) + on left: 73 + on right: 70 71 + var_decl_init (120) + on left: 74 + on right: 76 118 + var_decl (121) + on left: 75 76 + on right: 109 + algebra_ident (122) + on left: 77 78 + on right: 65 221 + ident (123) + on left: 79 80 + on right: 24 25 37 41 46 60 63 64 65 72 73 74 75 89 97 114 122 153 161 192 193 210 211 212 + eqs (124) + on left: 81 82 + on right: 63 64 82 + eq (125) + on left: 83 + on right: 81 82 + sig_var (126) + on left: 84 85 + on right: 83 + sort_ident (127) + on left: 86 + on right: 84 + fn_defs (128) + on left: 87 88 + on right: 59 88 + fn_def (129) + on left: 89 + on right: 88 + fnntparas (130) + on left: 90 91 + on right: 89 + mode_opt (131) + on left: 92 93 + on right: 89 + para_decls (132) + on left: 94 95 96 + on right: 89 90 96 98 162 + para_decl (133) + on left: 97 98 99 + on right: 95 96 + statements (134) + on left: 100 101 + on right: 89 101 111 185 + statement (135) + on left: 102 103 104 105 106 107 108 109 110 111 + on right: 100 101 116 117 118 119 + continue (136) + on left: 112 + on right: 102 + break (137) + on left: 113 + on right: 103 + fn_call (138) + on left: 114 + on right: 110 + return (139) + on left: 115 + on right: 104 + if (140) + on left: 116 117 + on right: 105 + for (141) + on left: 118 + on right: 106 + while (142) + on left: 119 + on right: 107 + assign (143) + on left: 120 + on right: 108 + inc_stmt (144) + on left: 121 + on right: 118 + var_access (145) + on left: 122 123 124 + on right: 120 121 123 124 140 225 + expr (146) + on left: 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 + on right: 72 73 74 115 116 117 118 119 120 121 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 147 148 225 + number (147) + on left: 142 143 144 145 146 + on right: 146 198 + exprs (148) + on left: 147 148 + on right: 114 148 149 167 182 183 193 + exprs_empty (149) + on left: 149 150 + on right: 139 + grammars (150) + on left: 151 152 + on right: 5 152 + grammar (151) + on left: 153 + on right: 151 152 + grammar_body (152) + on left: 154 155 + on right: 153 + tabulated (153) + on left: 156 + on right: 154 + signature_ident (154) + on left: 157 + on right: 63 64 153 + nt_ident (155) + on left: 158 + on right: 153 + productions (156) + on left: 159 160 + on right: 154 155 160 + production (157) + on left: 161 + on right: 159 160 + ntargs (158) + on left: 162 163 + on right: 161 + rhs (159) + on left: 164 165 + on right: 161 + choice_fn_ident (160) + on left: 166 + on right: 165 + ntparas (161) + on left: 167 168 + on right: 177 + filters (162) + on left: 169 170 + on right: 169 181 + tracks (163) + on left: 171 172 + on right: 172 180 + track (164) + on left: 173 + on right: 171 172 + alts (165) + on left: 174 175 + on right: 164 165 175 176 + alt (166) + on left: 176 177 178 179 180 181 182 183 184 185 + on right: 173 174 175 179 181 182 184 185 196 + sig_fn_or_term_ident (167) + on left: 186 + on right: 177 + symbol_ident (168) + on left: 187 + on right: 178 183 + filter_kw (169) + on left: 188 189 190 191 + on right: 179 181 + filter_fn (170) + on left: 192 193 + on right: 169 170 179 222 + rhs_args (171) + on left: 194 195 + on right: 177 195 + rhs_arg (172) + on left: 196 197 + on right: 194 195 + const (173) + on left: 198 199 200 + on right: 141 197 + string_constant (174) + on left: 201 202 + on right: 200 + character_constant (175) + on left: 203 + on right: 199 + instances_opt (176) + on left: 204 205 + on right: 5 + instances (177) + on left: 206 + on right: 204 + instances_ (178) + on left: 207 208 + on right: 206 208 + instance (179) + on left: 210 + on right: 207 208 + $@4 (180) + on left: 209 + on right: 210 + i_lhs (181) + on left: 211 212 + on right: 210 + product (182) + on left: 213 214 215 216 217 218 219 220 221 222 + on right: 3 210 213 214 215 216 217 218 219 220 222 + defaults (183) + on left: 223 224 + on right: 219 224 + default (184) + on left: 225 + on right: 223 224 + + +State 0 + + 0 $accept: . start "end of file" + + START_PROGRAM shift, and go to state 1 + START_PRODUCT shift, and go to state 2 + + start go to state 3 + + +State 1 + + 1 start: START_PROGRAM . program + + IMPORT shift, and go to state 4 + + $default reduce using rule 7 (imports_opt) + + program go to state 5 + imports_opt go to state 6 + imports go to state 7 + import go to state 8 + + +State 2 + + 3 start: START_PRODUCT . $@1 product + + $default reduce using rule 2 ($@1) + + $@1 go to state 9 + + +State 3 + + 0 $accept: start . "end of file" + + "end of file" shift, and go to state 10 + + +State 4 + + 10 import: IMPORT . module_ident + 11 | IMPORT . '"' STRING '"' + + STRING shift, and go to state 11 + '"' shift, and go to state 12 + + module_ident go to state 13 + + +State 5 + + 1 start: START_PROGRAM program . + + $default reduce using rule 1 (start) + + +State 6 + + 5 program: imports_opt . input_opt types_opt signature algebras_opt grammars $@2 instances_opt + + INPUT shift, and go to state 14 + + $default reduce using rule 15 (input_opt) + + input_opt go to state 15 + + +State 7 + + 6 imports_opt: imports . + 9 imports: imports . import + + IMPORT shift, and go to state 4 + + $default reduce using rule 6 (imports_opt) + + import go to state 16 + + +State 8 + + 8 imports: import . + + $default reduce using rule 8 (imports) + + +State 9 + + 3 start: START_PRODUCT $@1 . product + + MODE shift, and go to state 17 + STRING shift, and go to state 18 + '(' shift, and go to state 19 + + algebra_ident go to state 20 + product go to state 21 + + +State 10 + + 0 $accept: start "end of file" . + + $default accept + + +State 11 + + 12 module_ident: STRING . + + $default reduce using rule 12 (module_ident) + + +State 12 + + 11 import: IMPORT '"' . STRING '"' + + STRING shift, and go to state 22 + + +State 13 + + 10 import: IMPORT module_ident . + + $default reduce using rule 10 (import) + + +State 14 + + 13 input_opt: INPUT . input_specifier + 14 | INPUT . '<' inputs '>' + + STRING shift, and go to state 23 + '<' shift, and go to state 24 + + input_specifier go to state 25 + + +State 15 + + 5 program: imports_opt input_opt . types_opt signature algebras_opt grammars $@2 instances_opt + + TYPE shift, and go to state 26 + + $default reduce using rule 21 (types_opt) + + types_opt go to state 27 + types go to state 28 + type go to state 29 + + +State 16 + + 9 imports: imports import . + + $default reduce using rule 9 (imports) + + +State 17 + + 78 algebra_ident: MODE . + + $default reduce using rule 78 (algebra_ident) + + +State 18 + + 77 algebra_ident: STRING . + + $default reduce using rule 77 (algebra_ident) + + +State 19 + + 220 product: '(' . product ')' + + MODE shift, and go to state 17 + STRING shift, and go to state 18 + '(' shift, and go to state 19 + + algebra_ident go to state 20 + product go to state 30 + + +State 20 + + 221 product: algebra_ident . + + $default reduce using rule 221 (product) + + +State 21 + + 3 start: START_PRODUCT $@1 product . + 213 product: product . '*' product + 214 | product . '/' product + 215 | product . '%' product + 216 | product . '^' product + 217 | product . '.' product + 218 | product . '|' product + 219 | product . '{' defaults '}' + 222 | product . SUCHTHAT filter_fn + + SUCHTHAT shift, and go to state 31 + '*' shift, and go to state 32 + '/' shift, and go to state 33 + '|' shift, and go to state 34 + '%' shift, and go to state 35 + '.' shift, and go to state 36 + '^' shift, and go to state 37 + '{' shift, and go to state 38 + + $default reduce using rule 3 (start) + + +State 22 + + 11 import: IMPORT '"' STRING . '"' + + '"' shift, and go to state 39 + + +State 23 + + 19 input_specifier: STRING . + + $default reduce using rule 19 (input_specifier) + + +State 24 + + 14 input_opt: INPUT '<' . inputs '>' + + STRING shift, and go to state 23 + + inputs go to state 40 + input go to state 41 + input_specifier go to state 42 + + +State 25 + + 13 input_opt: INPUT input_specifier . + + $default reduce using rule 13 (input_opt) + + +State 26 + + 24 type: TYPE . ident '=' datatype + 25 | TYPE . ident '=' EXTERN + + MODE shift, and go to state 43 + STRING shift, and go to state 44 + + ident go to state 45 + + +State 27 + + 5 program: imports_opt input_opt types_opt . signature algebras_opt grammars $@2 instances_opt + + SIGNATURE shift, and go to state 46 + + signature go to state 47 + + +State 28 + + 20 types_opt: types . + 23 types: types . type + + TYPE shift, and go to state 26 + + $default reduce using rule 20 (types_opt) + + type go to state 48 + + +State 29 + + 22 types: type . + + $default reduce using rule 22 (types) + + +State 30 + + 213 product: product . '*' product + 214 | product . '/' product + 215 | product . '%' product + 216 | product . '^' product + 217 | product . '.' product + 218 | product . '|' product + 219 | product . '{' defaults '}' + 220 | '(' product . ')' + 222 | product . SUCHTHAT filter_fn + + SUCHTHAT shift, and go to state 31 + '*' shift, and go to state 32 + '/' shift, and go to state 33 + '|' shift, and go to state 34 + '%' shift, and go to state 35 + '.' shift, and go to state 36 + '^' shift, and go to state 37 + '{' shift, and go to state 38 + ')' shift, and go to state 49 + + +State 31 + + 222 product: product SUCHTHAT . filter_fn + + MODE shift, and go to state 43 + STRING shift, and go to state 44 + + ident go to state 50 + filter_fn go to state 51 + + +State 32 + + 213 product: product '*' . product + + MODE shift, and go to state 17 + STRING shift, and go to state 18 + '(' shift, and go to state 19 + + algebra_ident go to state 20 + product go to state 52 + + +State 33 + + 214 product: product '/' . product + + MODE shift, and go to state 17 + STRING shift, and go to state 18 + '(' shift, and go to state 19 + + algebra_ident go to state 20 + product go to state 53 + + +State 34 + + 218 product: product '|' . product + + MODE shift, and go to state 17 + STRING shift, and go to state 18 + '(' shift, and go to state 19 + + algebra_ident go to state 20 + product go to state 54 + + +State 35 + + 215 product: product '%' . product + + MODE shift, and go to state 17 + STRING shift, and go to state 18 + '(' shift, and go to state 19 + + algebra_ident go to state 20 + product go to state 55 + + +State 36 + + 217 product: product '.' . product + + MODE shift, and go to state 17 + STRING shift, and go to state 18 + '(' shift, and go to state 19 + + algebra_ident go to state 20 + product go to state 56 + + +State 37 + + 216 product: product '^' . product + + MODE shift, and go to state 17 + STRING shift, and go to state 18 + '(' shift, and go to state 19 + + algebra_ident go to state 20 + product go to state 57 + + +State 38 + + 219 product: product '{' . defaults '}' + + MODE shift, and go to state 43 + STRING shift, and go to state 44 + + ident go to state 58 + var_access go to state 59 + defaults go to state 60 + default go to state 61 + + +State 39 + + 11 import: IMPORT '"' STRING '"' . + + $default reduce using rule 11 (import) + + +State 40 + + 14 input_opt: INPUT '<' inputs . '>' + 17 inputs: inputs . ',' input + + '>' shift, and go to state 62 + ',' shift, and go to state 63 + + +State 41 + + 16 inputs: input . + + $default reduce using rule 16 (inputs) + + +State 42 + + 18 input: input_specifier . + + $default reduce using rule 18 (input) + + +State 43 + + 80 ident: MODE . + + $default reduce using rule 80 (ident) + + +State 44 + + 79 ident: STRING . + + $default reduce using rule 79 (ident) + + +State 45 + + 24 type: TYPE ident . '=' datatype + 25 | TYPE ident . '=' EXTERN + + '=' shift, and go to state 64 + + +State 46 + + 37 signature: SIGNATURE . ident '(' sig_args ')' @3 '{' sig_decls '}' + + MODE shift, and go to state 43 + STRING shift, and go to state 44 + + ident go to state 65 + + +State 47 + + 5 program: imports_opt input_opt types_opt signature . algebras_opt grammars $@2 instances_opt + + ALGEBRA shift, and go to state 66 + MODE shift, and go to state 67 + + $default reduce using rule 56 (algebras_opt) + + algebras_opt go to state 68 + algebras go to state 69 + algebra go to state 70 + mode go to state 71 + algebra_head go to state 72 + + +State 48 + + 23 types: types type . + + $default reduce using rule 23 (types) + + +State 49 + + 220 product: '(' product ')' . + + $default reduce using rule 220 (product) + + +State 50 + + 192 filter_fn: ident . + 193 | ident . '(' exprs ')' + + '(' shift, and go to state 73 + + $default reduce using rule 192 (filter_fn) + + +State 51 + + 222 product: product SUCHTHAT filter_fn . + + $default reduce using rule 222 (product) + + +State 52 + + 213 product: product . '*' product + 213 | product '*' product . + 214 | product . '/' product + 215 | product . '%' product + 216 | product . '^' product + 217 | product . '.' product + 218 | product . '|' product + 219 | product . '{' defaults '}' + 222 | product . SUCHTHAT filter_fn + + SUCHTHAT shift, and go to state 31 + '{' shift, and go to state 38 + + $default reduce using rule 213 (product) + + +State 53 + + 213 product: product . '*' product + 214 | product . '/' product + 214 | product '/' product . + 215 | product . '%' product + 216 | product . '^' product + 217 | product . '.' product + 218 | product . '|' product + 219 | product . '{' defaults '}' + 222 | product . SUCHTHAT filter_fn + + SUCHTHAT shift, and go to state 31 + '{' shift, and go to state 38 + + $default reduce using rule 214 (product) + + +State 54 + + 213 product: product . '*' product + 214 | product . '/' product + 215 | product . '%' product + 216 | product . '^' product + 217 | product . '.' product + 218 | product . '|' product + 218 | product '|' product . + 219 | product . '{' defaults '}' + 222 | product . SUCHTHAT filter_fn + + SUCHTHAT shift, and go to state 31 + '{' shift, and go to state 38 + + $default reduce using rule 218 (product) + + +State 55 + + 213 product: product . '*' product + 214 | product . '/' product + 215 | product . '%' product + 215 | product '%' product . + 216 | product . '^' product + 217 | product . '.' product + 218 | product . '|' product + 219 | product . '{' defaults '}' + 222 | product . SUCHTHAT filter_fn + + SUCHTHAT shift, and go to state 31 + '{' shift, and go to state 38 + + $default reduce using rule 215 (product) + + +State 56 + + 213 product: product . '*' product + 214 | product . '/' product + 215 | product . '%' product + 216 | product . '^' product + 217 | product . '.' product + 217 | product '.' product . + 218 | product . '|' product + 219 | product . '{' defaults '}' + 222 | product . SUCHTHAT filter_fn + + SUCHTHAT shift, and go to state 31 + '{' shift, and go to state 38 + + $default reduce using rule 217 (product) + + +State 57 + + 213 product: product . '*' product + 214 | product . '/' product + 215 | product . '%' product + 216 | product . '^' product + 216 | product '^' product . + 217 | product . '.' product + 218 | product . '|' product + 219 | product . '{' defaults '}' + 222 | product . SUCHTHAT filter_fn + + SUCHTHAT shift, and go to state 31 + '{' shift, and go to state 38 + + $default reduce using rule 216 (product) + + +State 58 + + 122 var_access: ident . + + $default reduce using rule 122 (var_access) + + +State 59 + + 123 var_access: var_access . '.' name_ident + 124 | var_access . '[' expr ']' + 225 default: var_access . '=' expr + + '.' shift, and go to state 74 + '=' shift, and go to state 75 + '[' shift, and go to state 76 + + +State 60 + + 219 product: product '{' defaults . '}' + 224 defaults: defaults . ',' default + + ',' shift, and go to state 77 + '}' shift, and go to state 78 + + +State 61 + + 223 defaults: default . + + $default reduce using rule 223 (defaults) + + +State 62 + + 14 input_opt: INPUT '<' inputs '>' . + + $default reduce using rule 14 (input_opt) + + +State 63 + + 17 inputs: inputs ',' . input + + STRING shift, and go to state 23 + + input go to state 79 + input_specifier go to state 42 + + +State 64 + + 24 type: TYPE ident '=' . datatype + 25 | TYPE ident '=' . EXTERN + + "alphabet keyword" shift, and go to state 80 + STRING shift, and go to state 81 + EXTERN shift, and go to state 82 + VOID shift, and go to state 83 + '[' shift, and go to state 84 + '(' shift, and go to state 85 + + datatype go to state 86 + type_specifier go to state 87 + + +State 65 + + 37 signature: SIGNATURE ident . '(' sig_args ')' @3 '{' sig_decls '}' + + '(' shift, and go to state 88 + + +State 66 + + 60 algebra: ALGEBRA . ident AUTOMATIC automatic_specifier ';' + 64 algebra_head: ALGEBRA . ident parameters IMPLEMENTS signature_ident '(' eqs ')' + 65 | ALGEBRA . ident parameters EXTENDS algebra_ident + + MODE shift, and go to state 43 + STRING shift, and go to state 44 + + ident go to state 89 + + +State 67 + + 62 mode: MODE . + + $default reduce using rule 62 (mode) + + +State 68 + + 5 program: imports_opt input_opt types_opt signature algebras_opt . grammars $@2 instances_opt + + GRAMMAR shift, and go to state 90 + + grammars go to state 91 + grammar go to state 92 + + +State 69 + + 55 algebras_opt: algebras . + 58 algebras: algebras . algebra + + ALGEBRA shift, and go to state 66 + MODE shift, and go to state 67 + + $default reduce using rule 55 (algebras_opt) + + algebra go to state 93 + mode go to state 71 + algebra_head go to state 72 + + +State 70 + + 57 algebras: algebra . + + $default reduce using rule 57 (algebras) + + +State 71 + + 63 algebra_head: mode . ALGEBRA ident parameters IMPLEMENTS signature_ident '(' eqs ')' + + ALGEBRA shift, and go to state 94 + + +State 72 + + 59 algebra: algebra_head . '{' fn_defs '}' + + '{' shift, and go to state 95 + + +State 73 + + 193 filter_fn: ident '(' . exprs ')' + + MODE shift, and go to state 43 + STRING shift, and go to state 96 + NOT shift, and go to state 97 + NUMBER shift, and go to state 98 + FLOAT shift, and go to state 99 + '-' shift, and go to state 100 + '"' shift, and go to state 101 + '(' shift, and go to state 102 + '\'' shift, and go to state 103 + + ident go to state 58 + var_access go to state 104 + expr go to state 105 + number go to state 106 + exprs go to state 107 + const go to state 108 + + +State 74 + + 123 var_access: var_access '.' . name_ident + + STRING shift, and go to state 109 + + name_ident go to state 110 + + +State 75 + + 225 default: var_access '=' . expr + + MODE shift, and go to state 43 + STRING shift, and go to state 96 + NOT shift, and go to state 97 + NUMBER shift, and go to state 98 + FLOAT shift, and go to state 99 + '-' shift, and go to state 100 + '"' shift, and go to state 101 + '(' shift, and go to state 102 + '\'' shift, and go to state 103 + + ident go to state 58 + var_access go to state 104 + expr go to state 111 + number go to state 106 + const go to state 108 + + +State 76 + + 124 var_access: var_access '[' . expr ']' + + MODE shift, and go to state 43 + STRING shift, and go to state 96 + NOT shift, and go to state 97 + NUMBER shift, and go to state 98 + FLOAT shift, and go to state 99 + '-' shift, and go to state 100 + '"' shift, and go to state 101 + '(' shift, and go to state 102 + '\'' shift, and go to state 103 + + ident go to state 58 + var_access go to state 104 + expr go to state 112 + number go to state 106 + const go to state 108 + + +State 77 + + 224 defaults: defaults ',' . default + + MODE shift, and go to state 43 + STRING shift, and go to state 44 + + ident go to state 58 + var_access go to state 59 + default go to state 113 + + +State 78 + + 219 product: product '{' defaults '}' . + + $default reduce using rule 219 (product) + + +State 79 + + 17 inputs: inputs ',' input . + + $default reduce using rule 17 (inputs) + + +State 80 + + 27 datatype: "alphabet keyword" . + + $default reduce using rule 27 (datatype) + + +State 81 + + 31 type_specifier: STRING . + + $default reduce using rule 31 (type_specifier) + + +State 82 + + 25 type: TYPE ident '=' EXTERN . + + $default reduce using rule 25 (type) + + +State 83 + + 28 datatype: VOID . + + $default reduce using rule 28 (datatype) + + +State 84 + + 29 datatype: '[' . type_specifier ']' + + STRING shift, and go to state 81 + + type_specifier go to state 114 + + +State 85 + + 30 datatype: '(' . named_datatypes ')' + + "alphabet keyword" shift, and go to state 80 + STRING shift, and go to state 81 + VOID shift, and go to state 83 + '[' shift, and go to state 84 + '(' shift, and go to state 85 + + datatype go to state 115 + type_specifier go to state 87 + named_datatypes go to state 116 + named_datatype go to state 117 + + +State 86 + + 24 type: TYPE ident '=' datatype . + + $default reduce using rule 24 (type) + + +State 87 + + 26 datatype: type_specifier . + + $default reduce using rule 26 (datatype) + + +State 88 + + 37 signature: SIGNATURE ident '(' . sig_args ')' @3 '{' sig_decls '}' + + "alphabet keyword" shift, and go to state 118 + + sig_args go to state 119 + + +State 89 + + 60 algebra: ALGEBRA ident . AUTOMATIC automatic_specifier ';' + 64 algebra_head: ALGEBRA ident . parameters IMPLEMENTS signature_ident '(' eqs ')' + 65 | ALGEBRA ident . parameters EXTENDS algebra_ident + + AUTOMATIC shift, and go to state 120 + '(' shift, and go to state 121 + + $default reduce using rule 67 (parameters) + + parameters go to state 122 + parameter_block go to state 123 + + +State 90 + + 153 grammar: GRAMMAR . ident USES signature_ident '(' AXIOM '=' nt_ident ')' '{' grammar_body '}' + + MODE shift, and go to state 43 + STRING shift, and go to state 44 + + ident go to state 124 + + +State 91 + + 5 program: imports_opt input_opt types_opt signature algebras_opt grammars . $@2 instances_opt + 152 grammars: grammars . grammar + + GRAMMAR shift, and go to state 90 + + $default reduce using rule 4 ($@2) + + $@2 go to state 125 + grammar go to state 126 + + +State 92 + + 151 grammars: grammar . + + $default reduce using rule 151 (grammars) + + +State 93 + + 58 algebras: algebras algebra . + + $default reduce using rule 58 (algebras) + + +State 94 + + 63 algebra_head: mode ALGEBRA . ident parameters IMPLEMENTS signature_ident '(' eqs ')' + + MODE shift, and go to state 43 + STRING shift, and go to state 44 + + ident go to state 127 + + +State 95 + + 59 algebra: algebra_head '{' . fn_defs '}' + + $default reduce using rule 87 (fn_defs) + + fn_defs go to state 128 + + +State 96 + + 79 ident: STRING . + 139 expr: STRING . '(' exprs_empty ')' + + '(' shift, and go to state 129 + + $default reduce using rule 79 (ident) + + +State 97 + + 134 expr: NOT . expr + + MODE shift, and go to state 43 + STRING shift, and go to state 96 + NOT shift, and go to state 97 + NUMBER shift, and go to state 98 + FLOAT shift, and go to state 99 + '-' shift, and go to state 100 + '"' shift, and go to state 101 + '(' shift, and go to state 102 + '\'' shift, and go to state 103 + + ident go to state 58 + var_access go to state 104 + expr go to state 130 + number go to state 106 + const go to state 108 + + +State 98 + + 142 number: NUMBER . + 143 | NUMBER . '.' NUMBER + 145 | NUMBER . '$' NUMBER + + '.' shift, and go to state 131 + '$' shift, and go to state 132 + + $default reduce using rule 142 (number) + + +State 99 + + 144 number: FLOAT . + + $default reduce using rule 144 (number) + + +State 100 + + 146 number: '-' . number + + NUMBER shift, and go to state 98 + FLOAT shift, and go to state 99 + '-' shift, and go to state 100 + + number go to state 133 + + +State 101 + + 200 const: '"' . string_constant '"' + + STRING shift, and go to state 134 + + $default reduce using rule 202 (string_constant) + + string_constant go to state 135 + + +State 102 + + 133 expr: '(' . expr ')' + + MODE shift, and go to state 43 + STRING shift, and go to state 96 + NOT shift, and go to state 97 + NUMBER shift, and go to state 98 + FLOAT shift, and go to state 99 + '-' shift, and go to state 100 + '"' shift, and go to state 101 + '(' shift, and go to state 102 + '\'' shift, and go to state 103 + + ident go to state 58 + var_access go to state 104 + expr go to state 136 + number go to state 106 + const go to state 108 + + +State 103 + + 199 const: '\'' . character_constant '\'' + + STRING shift, and go to state 137 + + character_constant go to state 138 + + +State 104 + + 123 var_access: var_access . '.' name_ident + 124 | var_access . '[' expr ']' + 140 expr: var_access . + + '.' shift, and go to state 74 + '[' shift, and go to state 76 + + $default reduce using rule 140 (expr) + + +State 105 + + 125 expr: expr . '<' expr + 126 | expr . '>' expr + 127 | expr . LT expr + 128 | expr . GT expr + 129 | expr . EQ expr + 130 | expr . NEQ expr + 131 | expr . AND expr + 132 | expr . OR expr + 135 | expr . '+' expr + 136 | expr . '-' expr + 137 | expr . '*' expr + 138 | expr . '/' expr + 147 exprs: expr . + + AND shift, and go to state 139 + EQ shift, and go to state 140 + GT shift, and go to state 141 + LT shift, and go to state 142 + NEQ shift, and go to state 143 + OR shift, and go to state 144 + '<' shift, and go to state 145 + '>' shift, and go to state 146 + '-' shift, and go to state 147 + '+' shift, and go to state 148 + '*' shift, and go to state 149 + '/' shift, and go to state 150 + + $default reduce using rule 147 (exprs) + + +State 106 + + 198 const: number . + + $default reduce using rule 198 (const) + + +State 107 + + 148 exprs: exprs . ',' expr + 193 filter_fn: ident '(' exprs . ')' + + ',' shift, and go to state 151 + ')' shift, and go to state 152 + + +State 108 + + 141 expr: const . + + $default reduce using rule 141 (expr) + + +State 109 + + 35 name_ident: STRING . + + $default reduce using rule 35 (name_ident) + + +State 110 + + 123 var_access: var_access '.' name_ident . + + $default reduce using rule 123 (var_access) + + +State 111 + + 125 expr: expr . '<' expr + 126 | expr . '>' expr + 127 | expr . LT expr + 128 | expr . GT expr + 129 | expr . EQ expr + 130 | expr . NEQ expr + 131 | expr . AND expr + 132 | expr . OR expr + 135 | expr . '+' expr + 136 | expr . '-' expr + 137 | expr . '*' expr + 138 | expr . '/' expr + 225 default: var_access '=' expr . + + AND shift, and go to state 139 + EQ shift, and go to state 140 + GT shift, and go to state 141 + LT shift, and go to state 142 + NEQ shift, and go to state 143 + OR shift, and go to state 144 + '<' shift, and go to state 145 + '>' shift, and go to state 146 + '-' shift, and go to state 147 + '+' shift, and go to state 148 + '*' shift, and go to state 149 + '/' shift, and go to state 150 + + $default reduce using rule 225 (default) + + +State 112 + + 124 var_access: var_access '[' expr . ']' + 125 expr: expr . '<' expr + 126 | expr . '>' expr + 127 | expr . LT expr + 128 | expr . GT expr + 129 | expr . EQ expr + 130 | expr . NEQ expr + 131 | expr . AND expr + 132 | expr . OR expr + 135 | expr . '+' expr + 136 | expr . '-' expr + 137 | expr . '*' expr + 138 | expr . '/' expr + + AND shift, and go to state 139 + EQ shift, and go to state 140 + GT shift, and go to state 141 + LT shift, and go to state 142 + NEQ shift, and go to state 143 + OR shift, and go to state 144 + '<' shift, and go to state 145 + '>' shift, and go to state 146 + '-' shift, and go to state 147 + '+' shift, and go to state 148 + '*' shift, and go to state 149 + '/' shift, and go to state 150 + ']' shift, and go to state 153 + + +State 113 + + 224 defaults: defaults ',' default . + + $default reduce using rule 224 (defaults) + + +State 114 + + 29 datatype: '[' type_specifier . ']' + + ']' shift, and go to state 154 + + +State 115 + + 34 named_datatype: datatype . name_ident + + STRING shift, and go to state 109 + + name_ident go to state 155 + + +State 116 + + 30 datatype: '(' named_datatypes . ')' + 33 named_datatypes: named_datatypes . ',' named_datatype + + ',' shift, and go to state 156 + ')' shift, and go to state 157 + + +State 117 + + 32 named_datatypes: named_datatype . + + $default reduce using rule 32 (named_datatypes) + + +State 118 + + 38 sig_args: "alphabet keyword" . ',' args signtparas + + ',' shift, and go to state 158 + + +State 119 + + 37 signature: SIGNATURE ident '(' sig_args . ')' @3 '{' sig_decls '}' + + ')' shift, and go to state 159 + + +State 120 + + 60 algebra: ALGEBRA ident AUTOMATIC . automatic_specifier ';' + + STRING shift, and go to state 160 + + automatic_specifier go to state 161 + + +State 121 + + 68 parameter_block: '(' . var_decl_init_p + 69 | '(' . var_decl_inits var_decl_init_p + + "alphabet keyword" shift, and go to state 80 + STRING shift, and go to state 81 + VOID shift, and go to state 83 + '[' shift, and go to state 84 + '(' shift, and go to state 85 + + datatype go to state 162 + type_specifier go to state 87 + var_decl_inits go to state 163 + var_decl_init_p go to state 164 + var_decl_init_k go to state 165 + + +State 122 + + 64 algebra_head: ALGEBRA ident parameters . IMPLEMENTS signature_ident '(' eqs ')' + 65 | ALGEBRA ident parameters . EXTENDS algebra_ident + + EXTENDS shift, and go to state 166 + IMPLEMENTS shift, and go to state 167 + + +State 123 + + 66 parameters: parameter_block . + + $default reduce using rule 66 (parameters) + + +State 124 + + 153 grammar: GRAMMAR ident . USES signature_ident '(' AXIOM '=' nt_ident ')' '{' grammar_body '}' + + USES shift, and go to state 168 + + +State 125 + + 5 program: imports_opt input_opt types_opt signature algebras_opt grammars $@2 . instances_opt + + INSTANCE shift, and go to state 169 + + $default reduce using rule 205 (instances_opt) + + instances_opt go to state 170 + instances go to state 171 + instances_ go to state 172 + instance go to state 173 + + +State 126 + + 152 grammars: grammars grammar . + + $default reduce using rule 152 (grammars) + + +State 127 + + 63 algebra_head: mode ALGEBRA ident . parameters IMPLEMENTS signature_ident '(' eqs ')' + + '(' shift, and go to state 121 + + $default reduce using rule 67 (parameters) + + parameters go to state 174 + parameter_block go to state 123 + + +State 128 + + 59 algebra: algebra_head '{' fn_defs . '}' + 88 fn_defs: fn_defs . fn_def + + MODE shift, and go to state 67 + '}' shift, and go to state 175 + + $default reduce using rule 93 (mode_opt) + + mode go to state 176 + fn_def go to state 177 + mode_opt go to state 178 + + +State 129 + + 139 expr: STRING '(' . exprs_empty ')' + + MODE shift, and go to state 43 + STRING shift, and go to state 96 + NOT shift, and go to state 97 + NUMBER shift, and go to state 98 + FLOAT shift, and go to state 99 + '-' shift, and go to state 100 + '"' shift, and go to state 101 + '(' shift, and go to state 102 + '\'' shift, and go to state 103 + + $default reduce using rule 150 (exprs_empty) + + ident go to state 58 + var_access go to state 104 + expr go to state 105 + number go to state 106 + exprs go to state 179 + exprs_empty go to state 180 + const go to state 108 + + +State 130 + + 125 expr: expr . '<' expr + 126 | expr . '>' expr + 127 | expr . LT expr + 128 | expr . GT expr + 129 | expr . EQ expr + 130 | expr . NEQ expr + 131 | expr . AND expr + 132 | expr . OR expr + 134 | NOT expr . + 135 | expr . '+' expr + 136 | expr . '-' expr + 137 | expr . '*' expr + 138 | expr . '/' expr + + $default reduce using rule 134 (expr) + + +State 131 + + 143 number: NUMBER '.' . NUMBER + + NUMBER shift, and go to state 181 + + +State 132 + + 145 number: NUMBER '$' . NUMBER + + NUMBER shift, and go to state 182 + + +State 133 + + 146 number: '-' number . + + $default reduce using rule 146 (number) + + +State 134 + + 201 string_constant: STRING . + + $default reduce using rule 201 (string_constant) + + +State 135 + + 200 const: '"' string_constant . '"' + + '"' shift, and go to state 183 + + +State 136 + + 125 expr: expr . '<' expr + 126 | expr . '>' expr + 127 | expr . LT expr + 128 | expr . GT expr + 129 | expr . EQ expr + 130 | expr . NEQ expr + 131 | expr . AND expr + 132 | expr . OR expr + 133 | '(' expr . ')' + 135 | expr . '+' expr + 136 | expr . '-' expr + 137 | expr . '*' expr + 138 | expr . '/' expr + + AND shift, and go to state 139 + EQ shift, and go to state 140 + GT shift, and go to state 141 + LT shift, and go to state 142 + NEQ shift, and go to state 143 + OR shift, and go to state 144 + '<' shift, and go to state 145 + '>' shift, and go to state 146 + '-' shift, and go to state 147 + '+' shift, and go to state 148 + '*' shift, and go to state 149 + '/' shift, and go to state 150 + ')' shift, and go to state 184 + + +State 137 + + 203 character_constant: STRING . + + $default reduce using rule 203 (character_constant) + + +State 138 + + 199 const: '\'' character_constant . '\'' + + '\'' shift, and go to state 185 + + +State 139 + + 131 expr: expr AND . expr + + MODE shift, and go to state 43 + STRING shift, and go to state 96 + NOT shift, and go to state 97 + NUMBER shift, and go to state 98 + FLOAT shift, and go to state 99 + '-' shift, and go to state 100 + '"' shift, and go to state 101 + '(' shift, and go to state 102 + '\'' shift, and go to state 103 + + ident go to state 58 + var_access go to state 104 + expr go to state 186 + number go to state 106 + const go to state 108 + + +State 140 + + 129 expr: expr EQ . expr + + MODE shift, and go to state 43 + STRING shift, and go to state 96 + NOT shift, and go to state 97 + NUMBER shift, and go to state 98 + FLOAT shift, and go to state 99 + '-' shift, and go to state 100 + '"' shift, and go to state 101 + '(' shift, and go to state 102 + '\'' shift, and go to state 103 + + ident go to state 58 + var_access go to state 104 + expr go to state 187 + number go to state 106 + const go to state 108 + + +State 141 + + 128 expr: expr GT . expr + + MODE shift, and go to state 43 + STRING shift, and go to state 96 + NOT shift, and go to state 97 + NUMBER shift, and go to state 98 + FLOAT shift, and go to state 99 + '-' shift, and go to state 100 + '"' shift, and go to state 101 + '(' shift, and go to state 102 + '\'' shift, and go to state 103 + + ident go to state 58 + var_access go to state 104 + expr go to state 188 + number go to state 106 + const go to state 108 + + +State 142 + + 127 expr: expr LT . expr + + MODE shift, and go to state 43 + STRING shift, and go to state 96 + NOT shift, and go to state 97 + NUMBER shift, and go to state 98 + FLOAT shift, and go to state 99 + '-' shift, and go to state 100 + '"' shift, and go to state 101 + '(' shift, and go to state 102 + '\'' shift, and go to state 103 + + ident go to state 58 + var_access go to state 104 + expr go to state 189 + number go to state 106 + const go to state 108 + + +State 143 + + 130 expr: expr NEQ . expr + + MODE shift, and go to state 43 + STRING shift, and go to state 96 + NOT shift, and go to state 97 + NUMBER shift, and go to state 98 + FLOAT shift, and go to state 99 + '-' shift, and go to state 100 + '"' shift, and go to state 101 + '(' shift, and go to state 102 + '\'' shift, and go to state 103 + + ident go to state 58 + var_access go to state 104 + expr go to state 190 + number go to state 106 + const go to state 108 + + +State 144 + + 132 expr: expr OR . expr + + MODE shift, and go to state 43 + STRING shift, and go to state 96 + NOT shift, and go to state 97 + NUMBER shift, and go to state 98 + FLOAT shift, and go to state 99 + '-' shift, and go to state 100 + '"' shift, and go to state 101 + '(' shift, and go to state 102 + '\'' shift, and go to state 103 + + ident go to state 58 + var_access go to state 104 + expr go to state 191 + number go to state 106 + const go to state 108 + + +State 145 + + 125 expr: expr '<' . expr + + MODE shift, and go to state 43 + STRING shift, and go to state 96 + NOT shift, and go to state 97 + NUMBER shift, and go to state 98 + FLOAT shift, and go to state 99 + '-' shift, and go to state 100 + '"' shift, and go to state 101 + '(' shift, and go to state 102 + '\'' shift, and go to state 103 + + ident go to state 58 + var_access go to state 104 + expr go to state 192 + number go to state 106 + const go to state 108 + + +State 146 + + 126 expr: expr '>' . expr + + MODE shift, and go to state 43 + STRING shift, and go to state 96 + NOT shift, and go to state 97 + NUMBER shift, and go to state 98 + FLOAT shift, and go to state 99 + '-' shift, and go to state 100 + '"' shift, and go to state 101 + '(' shift, and go to state 102 + '\'' shift, and go to state 103 + + ident go to state 58 + var_access go to state 104 + expr go to state 193 + number go to state 106 + const go to state 108 + + +State 147 + + 136 expr: expr '-' . expr + + MODE shift, and go to state 43 + STRING shift, and go to state 96 + NOT shift, and go to state 97 + NUMBER shift, and go to state 98 + FLOAT shift, and go to state 99 + '-' shift, and go to state 100 + '"' shift, and go to state 101 + '(' shift, and go to state 102 + '\'' shift, and go to state 103 + + ident go to state 58 + var_access go to state 104 + expr go to state 194 + number go to state 106 + const go to state 108 + + +State 148 + + 135 expr: expr '+' . expr + + MODE shift, and go to state 43 + STRING shift, and go to state 96 + NOT shift, and go to state 97 + NUMBER shift, and go to state 98 + FLOAT shift, and go to state 99 + '-' shift, and go to state 100 + '"' shift, and go to state 101 + '(' shift, and go to state 102 + '\'' shift, and go to state 103 + + ident go to state 58 + var_access go to state 104 + expr go to state 195 + number go to state 106 + const go to state 108 + + +State 149 + + 137 expr: expr '*' . expr + + MODE shift, and go to state 43 + STRING shift, and go to state 96 + NOT shift, and go to state 97 + NUMBER shift, and go to state 98 + FLOAT shift, and go to state 99 + '-' shift, and go to state 100 + '"' shift, and go to state 101 + '(' shift, and go to state 102 + '\'' shift, and go to state 103 + + ident go to state 58 + var_access go to state 104 + expr go to state 196 + number go to state 106 + const go to state 108 + + +State 150 + + 138 expr: expr '/' . expr + + MODE shift, and go to state 43 + STRING shift, and go to state 96 + NOT shift, and go to state 97 + NUMBER shift, and go to state 98 + FLOAT shift, and go to state 99 + '-' shift, and go to state 100 + '"' shift, and go to state 101 + '(' shift, and go to state 102 + '\'' shift, and go to state 103 + + ident go to state 58 + var_access go to state 104 + expr go to state 197 + number go to state 106 + const go to state 108 + + +State 151 + + 148 exprs: exprs ',' . expr + + MODE shift, and go to state 43 + STRING shift, and go to state 96 + NOT shift, and go to state 97 + NUMBER shift, and go to state 98 + FLOAT shift, and go to state 99 + '-' shift, and go to state 100 + '"' shift, and go to state 101 + '(' shift, and go to state 102 + '\'' shift, and go to state 103 + + ident go to state 58 + var_access go to state 104 + expr go to state 198 + number go to state 106 + const go to state 108 + + +State 152 + + 193 filter_fn: ident '(' exprs ')' . + + $default reduce using rule 193 (filter_fn) + + +State 153 + + 124 var_access: var_access '[' expr ']' . + + $default reduce using rule 124 (var_access) + + +State 154 + + 29 datatype: '[' type_specifier ']' . + + $default reduce using rule 29 (datatype) + + +State 155 + + 34 named_datatype: datatype name_ident . + + $default reduce using rule 34 (named_datatype) + + +State 156 + + 33 named_datatypes: named_datatypes ',' . named_datatype + + "alphabet keyword" shift, and go to state 80 + STRING shift, and go to state 81 + VOID shift, and go to state 83 + '[' shift, and go to state 84 + '(' shift, and go to state 85 + + datatype go to state 115 + type_specifier go to state 87 + named_datatype go to state 199 + + +State 157 + + 30 datatype: '(' named_datatypes ')' . + + $default reduce using rule 30 (datatype) + + +State 158 + + 38 sig_args: "alphabet keyword" ',' . args signtparas + + MODE shift, and go to state 43 + STRING shift, and go to state 44 + + args go to state 200 + arg go to state 201 + ident go to state 202 + + +State 159 + + 37 signature: SIGNATURE ident '(' sig_args ')' . @3 '{' sig_decls '}' + + $default reduce using rule 36 (@3) + + @3 go to state 203 + + +State 160 + + 61 automatic_specifier: STRING . + + $default reduce using rule 61 (automatic_specifier) + + +State 161 + + 60 algebra: ALGEBRA ident AUTOMATIC automatic_specifier . ';' + + ';' shift, and go to state 204 + + +State 162 + + 72 var_decl_init_p: datatype . ident '=' expr ')' + 73 var_decl_init_k: datatype . ident '=' expr ',' + + MODE shift, and go to state 43 + STRING shift, and go to state 44 + + ident go to state 205 + + +State 163 + + 69 parameter_block: '(' var_decl_inits . var_decl_init_p + 71 var_decl_inits: var_decl_inits . var_decl_init_k + + "alphabet keyword" shift, and go to state 80 + STRING shift, and go to state 81 + VOID shift, and go to state 83 + '[' shift, and go to state 84 + '(' shift, and go to state 85 + + datatype go to state 162 + type_specifier go to state 87 + var_decl_init_p go to state 206 + var_decl_init_k go to state 207 + + +State 164 + + 68 parameter_block: '(' var_decl_init_p . + + $default reduce using rule 68 (parameter_block) + + +State 165 + + 70 var_decl_inits: var_decl_init_k . + + $default reduce using rule 70 (var_decl_inits) + + +State 166 + + 65 algebra_head: ALGEBRA ident parameters EXTENDS . algebra_ident + + MODE shift, and go to state 17 + STRING shift, and go to state 18 + + algebra_ident go to state 208 + + +State 167 + + 64 algebra_head: ALGEBRA ident parameters IMPLEMENTS . signature_ident '(' eqs ')' + + STRING shift, and go to state 209 + + signature_ident go to state 210 + + +State 168 + + 153 grammar: GRAMMAR ident USES . signature_ident '(' AXIOM '=' nt_ident ')' '{' grammar_body '}' + + STRING shift, and go to state 209 + + signature_ident go to state 211 + + +State 169 + + 210 instance: INSTANCE . i_lhs '=' ident $@4 '(' product ')' ';' + + MODE shift, and go to state 43 + STRING shift, and go to state 44 + + ident go to state 212 + i_lhs go to state 213 + + +State 170 + + 5 program: imports_opt input_opt types_opt signature algebras_opt grammars $@2 instances_opt . + + $default reduce using rule 5 (program) + + +State 171 + + 204 instances_opt: instances . + + $default reduce using rule 204 (instances_opt) + + +State 172 + + 206 instances: instances_ . + 208 instances_: instances_ . instance + + INSTANCE shift, and go to state 169 + + $default reduce using rule 206 (instances) + + instance go to state 214 + + +State 173 + + 207 instances_: instance . + + $default reduce using rule 207 (instances_) + + +State 174 + + 63 algebra_head: mode ALGEBRA ident parameters . IMPLEMENTS signature_ident '(' eqs ')' + + IMPLEMENTS shift, and go to state 215 + + +State 175 + + 59 algebra: algebra_head '{' fn_defs '}' . + + $default reduce using rule 59 (algebra) + + +State 176 + + 92 mode_opt: mode . + + $default reduce using rule 92 (mode_opt) + + +State 177 + + 88 fn_defs: fn_defs fn_def . + + $default reduce using rule 88 (fn_defs) + + +State 178 + + 89 fn_def: mode_opt . qual_datatype ident '(' para_decls fnntparas ')' '{' statements '}' + + "alphabet keyword" shift, and go to state 80 + CHOICE shift, and go to state 216 + STRING shift, and go to state 81 + VOID shift, and go to state 83 + '[' shift, and go to state 84 + '(' shift, and go to state 85 + + datatype go to state 217 + type_specifier go to state 87 + qual_datatype go to state 218 + + +State 179 + + 148 exprs: exprs . ',' expr + 149 exprs_empty: exprs . + + ',' shift, and go to state 151 + + $default reduce using rule 149 (exprs_empty) + + +State 180 + + 139 expr: STRING '(' exprs_empty . ')' + + ')' shift, and go to state 219 + + +State 181 + + 143 number: NUMBER '.' NUMBER . + + $default reduce using rule 143 (number) + + +State 182 + + 145 number: NUMBER '$' NUMBER . + + $default reduce using rule 145 (number) + + +State 183 + + 200 const: '"' string_constant '"' . + + $default reduce using rule 200 (const) + + +State 184 + + 133 expr: '(' expr ')' . + + $default reduce using rule 133 (expr) + + +State 185 + + 199 const: '\'' character_constant '\'' . + + $default reduce using rule 199 (const) + + +State 186 + + 125 expr: expr . '<' expr + 126 | expr . '>' expr + 127 | expr . LT expr + 128 | expr . GT expr + 129 | expr . EQ expr + 130 | expr . NEQ expr + 131 | expr . AND expr + 131 | expr AND expr . + 132 | expr . OR expr + 135 | expr . '+' expr + 136 | expr . '-' expr + 137 | expr . '*' expr + 138 | expr . '/' expr + + EQ shift, and go to state 140 + GT shift, and go to state 141 + LT shift, and go to state 142 + NEQ shift, and go to state 143 + '<' shift, and go to state 145 + '>' shift, and go to state 146 + '-' shift, and go to state 147 + '+' shift, and go to state 148 + '*' shift, and go to state 149 + '/' shift, and go to state 150 + + $default reduce using rule 131 (expr) + + +State 187 + + 125 expr: expr . '<' expr + 126 | expr . '>' expr + 127 | expr . LT expr + 128 | expr . GT expr + 129 | expr . EQ expr + 129 | expr EQ expr . + 130 | expr . NEQ expr + 131 | expr . AND expr + 132 | expr . OR expr + 135 | expr . '+' expr + 136 | expr . '-' expr + 137 | expr . '*' expr + 138 | expr . '/' expr + + '-' shift, and go to state 147 + '+' shift, and go to state 148 + '*' shift, and go to state 149 + '/' shift, and go to state 150 + + $default reduce using rule 129 (expr) + + +State 188 + + 125 expr: expr . '<' expr + 126 | expr . '>' expr + 127 | expr . LT expr + 128 | expr . GT expr + 128 | expr GT expr . + 129 | expr . EQ expr + 130 | expr . NEQ expr + 131 | expr . AND expr + 132 | expr . OR expr + 135 | expr . '+' expr + 136 | expr . '-' expr + 137 | expr . '*' expr + 138 | expr . '/' expr + + '-' shift, and go to state 147 + '+' shift, and go to state 148 + '*' shift, and go to state 149 + '/' shift, and go to state 150 + + $default reduce using rule 128 (expr) + + +State 189 + + 125 expr: expr . '<' expr + 126 | expr . '>' expr + 127 | expr . LT expr + 127 | expr LT expr . + 128 | expr . GT expr + 129 | expr . EQ expr + 130 | expr . NEQ expr + 131 | expr . AND expr + 132 | expr . OR expr + 135 | expr . '+' expr + 136 | expr . '-' expr + 137 | expr . '*' expr + 138 | expr . '/' expr + + '-' shift, and go to state 147 + '+' shift, and go to state 148 + '*' shift, and go to state 149 + '/' shift, and go to state 150 + + $default reduce using rule 127 (expr) + + +State 190 + + 125 expr: expr . '<' expr + 126 | expr . '>' expr + 127 | expr . LT expr + 128 | expr . GT expr + 129 | expr . EQ expr + 130 | expr . NEQ expr + 130 | expr NEQ expr . + 131 | expr . AND expr + 132 | expr . OR expr + 135 | expr . '+' expr + 136 | expr . '-' expr + 137 | expr . '*' expr + 138 | expr . '/' expr + + '-' shift, and go to state 147 + '+' shift, and go to state 148 + '*' shift, and go to state 149 + '/' shift, and go to state 150 + + $default reduce using rule 130 (expr) + + +State 191 + + 125 expr: expr . '<' expr + 126 | expr . '>' expr + 127 | expr . LT expr + 128 | expr . GT expr + 129 | expr . EQ expr + 130 | expr . NEQ expr + 131 | expr . AND expr + 132 | expr . OR expr + 132 | expr OR expr . + 135 | expr . '+' expr + 136 | expr . '-' expr + 137 | expr . '*' expr + 138 | expr . '/' expr + + AND shift, and go to state 139 + EQ shift, and go to state 140 + GT shift, and go to state 141 + LT shift, and go to state 142 + NEQ shift, and go to state 143 + '<' shift, and go to state 145 + '>' shift, and go to state 146 + '-' shift, and go to state 147 + '+' shift, and go to state 148 + '*' shift, and go to state 149 + '/' shift, and go to state 150 + + $default reduce using rule 132 (expr) + + +State 192 + + 125 expr: expr . '<' expr + 125 | expr '<' expr . + 126 | expr . '>' expr + 127 | expr . LT expr + 128 | expr . GT expr + 129 | expr . EQ expr + 130 | expr . NEQ expr + 131 | expr . AND expr + 132 | expr . OR expr + 135 | expr . '+' expr + 136 | expr . '-' expr + 137 | expr . '*' expr + 138 | expr . '/' expr + + '-' shift, and go to state 147 + '+' shift, and go to state 148 + '*' shift, and go to state 149 + '/' shift, and go to state 150 + + $default reduce using rule 125 (expr) + + +State 193 + + 125 expr: expr . '<' expr + 126 | expr . '>' expr + 126 | expr '>' expr . + 127 | expr . LT expr + 128 | expr . GT expr + 129 | expr . EQ expr + 130 | expr . NEQ expr + 131 | expr . AND expr + 132 | expr . OR expr + 135 | expr . '+' expr + 136 | expr . '-' expr + 137 | expr . '*' expr + 138 | expr . '/' expr + + '-' shift, and go to state 147 + '+' shift, and go to state 148 + '*' shift, and go to state 149 + '/' shift, and go to state 150 + + $default reduce using rule 126 (expr) + + +State 194 + + 125 expr: expr . '<' expr + 126 | expr . '>' expr + 127 | expr . LT expr + 128 | expr . GT expr + 129 | expr . EQ expr + 130 | expr . NEQ expr + 131 | expr . AND expr + 132 | expr . OR expr + 135 | expr . '+' expr + 136 | expr . '-' expr + 136 | expr '-' expr . + 137 | expr . '*' expr + 138 | expr . '/' expr + + '*' shift, and go to state 149 + '/' shift, and go to state 150 + + $default reduce using rule 136 (expr) + + +State 195 + + 125 expr: expr . '<' expr + 126 | expr . '>' expr + 127 | expr . LT expr + 128 | expr . GT expr + 129 | expr . EQ expr + 130 | expr . NEQ expr + 131 | expr . AND expr + 132 | expr . OR expr + 135 | expr . '+' expr + 135 | expr '+' expr . + 136 | expr . '-' expr + 137 | expr . '*' expr + 138 | expr . '/' expr + + '*' shift, and go to state 149 + '/' shift, and go to state 150 + + $default reduce using rule 135 (expr) + + +State 196 + + 125 expr: expr . '<' expr + 126 | expr . '>' expr + 127 | expr . LT expr + 128 | expr . GT expr + 129 | expr . EQ expr + 130 | expr . NEQ expr + 131 | expr . AND expr + 132 | expr . OR expr + 135 | expr . '+' expr + 136 | expr . '-' expr + 137 | expr . '*' expr + 137 | expr '*' expr . + 138 | expr . '/' expr + + $default reduce using rule 137 (expr) + + +State 197 + + 125 expr: expr . '<' expr + 126 | expr . '>' expr + 127 | expr . LT expr + 128 | expr . GT expr + 129 | expr . EQ expr + 130 | expr . NEQ expr + 131 | expr . AND expr + 132 | expr . OR expr + 135 | expr . '+' expr + 136 | expr . '-' expr + 137 | expr . '*' expr + 138 | expr . '/' expr + 138 | expr '/' expr . + + $default reduce using rule 138 (expr) + + +State 198 + + 125 expr: expr . '<' expr + 126 | expr . '>' expr + 127 | expr . LT expr + 128 | expr . GT expr + 129 | expr . EQ expr + 130 | expr . NEQ expr + 131 | expr . AND expr + 132 | expr . OR expr + 135 | expr . '+' expr + 136 | expr . '-' expr + 137 | expr . '*' expr + 138 | expr . '/' expr + 148 exprs: exprs ',' expr . + + AND shift, and go to state 139 + EQ shift, and go to state 140 + GT shift, and go to state 141 + LT shift, and go to state 142 + NEQ shift, and go to state 143 + OR shift, and go to state 144 + '<' shift, and go to state 145 + '>' shift, and go to state 146 + '-' shift, and go to state 147 + '+' shift, and go to state 148 + '*' shift, and go to state 149 + '/' shift, and go to state 150 + + $default reduce using rule 148 (exprs) + + +State 199 + + 33 named_datatypes: named_datatypes ',' named_datatype . + + $default reduce using rule 33 (named_datatypes) + + +State 200 + + 38 sig_args: "alphabet keyword" ',' args . signtparas + 40 args: args . ',' arg + + ',' shift, and go to state 220 + ';' shift, and go to state 221 + + $default reduce using rule 43 (signtparas) + + signtparas go to state 222 + + +State 201 + + 39 args: arg . + + $default reduce using rule 39 (args) + + +State 202 + + 41 arg: ident . + + $default reduce using rule 41 (arg) + + +State 203 + + 37 signature: SIGNATURE ident '(' sig_args ')' @3 . '{' sig_decls '}' + + '{' shift, and go to state 223 + + +State 204 + + 60 algebra: ALGEBRA ident AUTOMATIC automatic_specifier ';' . + + $default reduce using rule 60 (algebra) + + +State 205 + + 72 var_decl_init_p: datatype ident . '=' expr ')' + 73 var_decl_init_k: datatype ident . '=' expr ',' + + '=' shift, and go to state 224 + + +State 206 + + 69 parameter_block: '(' var_decl_inits var_decl_init_p . + + $default reduce using rule 69 (parameter_block) + + +State 207 + + 71 var_decl_inits: var_decl_inits var_decl_init_k . + + $default reduce using rule 71 (var_decl_inits) + + +State 208 + + 65 algebra_head: ALGEBRA ident parameters EXTENDS algebra_ident . + + $default reduce using rule 65 (algebra_head) + + +State 209 + + 157 signature_ident: STRING . + + $default reduce using rule 157 (signature_ident) + + +State 210 + + 64 algebra_head: ALGEBRA ident parameters IMPLEMENTS signature_ident . '(' eqs ')' + + '(' shift, and go to state 225 + + +State 211 + + 153 grammar: GRAMMAR ident USES signature_ident . '(' AXIOM '=' nt_ident ')' '{' grammar_body '}' + + '(' shift, and go to state 226 + + +State 212 + + 211 i_lhs: ident . + 212 | ident . '(' args ')' + + '(' shift, and go to state 227 + + $default reduce using rule 211 (i_lhs) + + +State 213 + + 210 instance: INSTANCE i_lhs . '=' ident $@4 '(' product ')' ';' + + '=' shift, and go to state 228 + + +State 214 + + 208 instances_: instances_ instance . + + $default reduce using rule 208 (instances_) + + +State 215 + + 63 algebra_head: mode ALGEBRA ident parameters IMPLEMENTS . signature_ident '(' eqs ')' + + STRING shift, and go to state 209 + + signature_ident go to state 229 + + +State 216 + + 48 qual_datatype: CHOICE . datatype + + "alphabet keyword" shift, and go to state 80 + STRING shift, and go to state 81 + VOID shift, and go to state 83 + '[' shift, and go to state 84 + '(' shift, and go to state 85 + + datatype go to state 230 + type_specifier go to state 87 + + +State 217 + + 47 qual_datatype: datatype . + + $default reduce using rule 47 (qual_datatype) + + +State 218 + + 89 fn_def: mode_opt qual_datatype . ident '(' para_decls fnntparas ')' '{' statements '}' + + MODE shift, and go to state 43 + STRING shift, and go to state 44 + + ident go to state 231 + + +State 219 + + 139 expr: STRING '(' exprs_empty ')' . + + $default reduce using rule 139 (expr) + + +State 220 + + 40 args: args ',' . arg + + MODE shift, and go to state 43 + STRING shift, and go to state 44 + + arg go to state 232 + ident go to state 202 + + +State 221 + + 42 signtparas: ';' . datatypes + + "alphabet keyword" shift, and go to state 80 + STRING shift, and go to state 81 + VOID shift, and go to state 83 + '[' shift, and go to state 84 + '(' shift, and go to state 85 + + datatype go to state 233 + type_specifier go to state 87 + datatypes go to state 234 + + +State 222 + + 38 sig_args: "alphabet keyword" ',' args signtparas . + + $default reduce using rule 38 (sig_args) + + +State 223 + + 37 signature: SIGNATURE ident '(' sig_args ')' @3 '{' . sig_decls '}' + + "alphabet keyword" shift, and go to state 80 + CHOICE shift, and go to state 216 + STRING shift, and go to state 81 + VOID shift, and go to state 83 + '[' shift, and go to state 84 + '(' shift, and go to state 85 + + datatype go to state 217 + type_specifier go to state 87 + sig_decls go to state 235 + decl go to state 236 + qual_datatype go to state 237 + + +State 224 + + 72 var_decl_init_p: datatype ident '=' . expr ')' + 73 var_decl_init_k: datatype ident '=' . expr ',' + + MODE shift, and go to state 43 + STRING shift, and go to state 96 + NOT shift, and go to state 97 + NUMBER shift, and go to state 98 + FLOAT shift, and go to state 99 + '-' shift, and go to state 100 + '"' shift, and go to state 101 + '(' shift, and go to state 102 + '\'' shift, and go to state 103 + + ident go to state 58 + var_access go to state 104 + expr go to state 238 + number go to state 106 + const go to state 108 + + +State 225 + + 64 algebra_head: ALGEBRA ident parameters IMPLEMENTS signature_ident '(' . eqs ')' + + "alphabet keyword" shift, and go to state 239 + STRING shift, and go to state 240 + + eqs go to state 241 + eq go to state 242 + sig_var go to state 243 + sort_ident go to state 244 + + +State 226 + + 153 grammar: GRAMMAR ident USES signature_ident '(' . AXIOM '=' nt_ident ')' '{' grammar_body '}' + + AXIOM shift, and go to state 245 + + +State 227 + + 212 i_lhs: ident '(' . args ')' + + MODE shift, and go to state 43 + STRING shift, and go to state 44 + + args go to state 246 + arg go to state 201 + ident go to state 202 + + +State 228 + + 210 instance: INSTANCE i_lhs '=' . ident $@4 '(' product ')' ';' + + MODE shift, and go to state 43 + STRING shift, and go to state 44 + + ident go to state 247 + + +State 229 + + 63 algebra_head: mode ALGEBRA ident parameters IMPLEMENTS signature_ident . '(' eqs ')' + + '(' shift, and go to state 248 + + +State 230 + + 48 qual_datatype: CHOICE datatype . + + $default reduce using rule 48 (qual_datatype) + + +State 231 + + 89 fn_def: mode_opt qual_datatype ident . '(' para_decls fnntparas ')' '{' statements '}' + + '(' shift, and go to state 249 + + +State 232 + + 40 args: args ',' arg . + + $default reduce using rule 40 (args) + + +State 233 + + 49 datatypes: datatype . + + $default reduce using rule 49 (datatypes) + + +State 234 + + 42 signtparas: ';' datatypes . + 50 datatypes: datatypes . ',' datatype + + ',' shift, and go to state 250 + + $default reduce using rule 42 (signtparas) + + +State 235 + + 37 signature: SIGNATURE ident '(' sig_args ')' @3 '{' sig_decls . '}' + 45 sig_decls: sig_decls . decl ';' + + "alphabet keyword" shift, and go to state 80 + CHOICE shift, and go to state 216 + STRING shift, and go to state 81 + VOID shift, and go to state 83 + '[' shift, and go to state 84 + '(' shift, and go to state 85 + '}' shift, and go to state 251 + + datatype go to state 217 + type_specifier go to state 87 + decl go to state 252 + qual_datatype go to state 237 + + +State 236 + + 44 sig_decls: decl . ';' + + ';' shift, and go to state 253 + + +State 237 + + 46 decl: qual_datatype . ident '(' multi_datatypes signtparas ')' + + MODE shift, and go to state 43 + STRING shift, and go to state 44 + + ident go to state 254 + + +State 238 + + 72 var_decl_init_p: datatype ident '=' expr . ')' + 73 var_decl_init_k: datatype ident '=' expr . ',' + 125 expr: expr . '<' expr + 126 | expr . '>' expr + 127 | expr . LT expr + 128 | expr . GT expr + 129 | expr . EQ expr + 130 | expr . NEQ expr + 131 | expr . AND expr + 132 | expr . OR expr + 135 | expr . '+' expr + 136 | expr . '-' expr + 137 | expr . '*' expr + 138 | expr . '/' expr + + AND shift, and go to state 139 + EQ shift, and go to state 140 + GT shift, and go to state 141 + LT shift, and go to state 142 + NEQ shift, and go to state 143 + OR shift, and go to state 144 + '<' shift, and go to state 145 + '>' shift, and go to state 146 + '-' shift, and go to state 147 + '+' shift, and go to state 148 + '*' shift, and go to state 149 + '/' shift, and go to state 150 + ',' shift, and go to state 255 + ')' shift, and go to state 256 + + +State 239 + + 85 sig_var: "alphabet keyword" . + + $default reduce using rule 85 (sig_var) + + +State 240 + + 86 sort_ident: STRING . + + $default reduce using rule 86 (sort_ident) + + +State 241 + + 64 algebra_head: ALGEBRA ident parameters IMPLEMENTS signature_ident '(' eqs . ')' + 82 eqs: eqs . ',' eq + + ',' shift, and go to state 257 + ')' shift, and go to state 258 + + +State 242 + + 81 eqs: eq . + + $default reduce using rule 81 (eqs) + + +State 243 + + 83 eq: sig_var . '=' datatype + + '=' shift, and go to state 259 + + +State 244 + + 84 sig_var: sort_ident . + + $default reduce using rule 84 (sig_var) + + +State 245 + + 153 grammar: GRAMMAR ident USES signature_ident '(' AXIOM . '=' nt_ident ')' '{' grammar_body '}' + + '=' shift, and go to state 260 + + +State 246 + + 40 args: args . ',' arg + 212 i_lhs: ident '(' args . ')' + + ',' shift, and go to state 220 + ')' shift, and go to state 261 + + +State 247 + + 210 instance: INSTANCE i_lhs '=' ident . $@4 '(' product ')' ';' + + $default reduce using rule 209 ($@4) + + $@4 go to state 262 + + +State 248 + + 63 algebra_head: mode ALGEBRA ident parameters IMPLEMENTS signature_ident '(' . eqs ')' + + "alphabet keyword" shift, and go to state 239 + STRING shift, and go to state 240 + + eqs go to state 263 + eq go to state 242 + sig_var go to state 243 + sort_ident go to state 244 + + +State 249 + + 89 fn_def: mode_opt qual_datatype ident '(' . para_decls fnntparas ')' '{' statements '}' + + "alphabet keyword" shift, and go to state 80 + STRING shift, and go to state 81 + VOID shift, and go to state 264 + '<' shift, and go to state 265 + '[' shift, and go to state 84 + '(' shift, and go to state 85 + + $default reduce using rule 94 (para_decls) + + datatype go to state 266 + type_specifier go to state 87 + para_decls go to state 267 + para_decl go to state 268 + + +State 250 + + 50 datatypes: datatypes ',' . datatype + + "alphabet keyword" shift, and go to state 80 + STRING shift, and go to state 81 + VOID shift, and go to state 83 + '[' shift, and go to state 84 + '(' shift, and go to state 85 + + datatype go to state 269 + type_specifier go to state 87 + + +State 251 + + 37 signature: SIGNATURE ident '(' sig_args ')' @3 '{' sig_decls '}' . + + $default reduce using rule 37 (signature) + + +State 252 + + 45 sig_decls: sig_decls decl . ';' + + ';' shift, and go to state 270 + + +State 253 + + 44 sig_decls: decl ';' . + + $default reduce using rule 44 (sig_decls) + + +State 254 + + 46 decl: qual_datatype ident . '(' multi_datatypes signtparas ')' + + '(' shift, and go to state 271 + + +State 255 + + 73 var_decl_init_k: datatype ident '=' expr ',' . + + $default reduce using rule 73 (var_decl_init_k) + + +State 256 + + 72 var_decl_init_p: datatype ident '=' expr ')' . + + $default reduce using rule 72 (var_decl_init_p) + + +State 257 + + 82 eqs: eqs ',' . eq + + "alphabet keyword" shift, and go to state 239 + STRING shift, and go to state 240 + + eq go to state 272 + sig_var go to state 243 + sort_ident go to state 244 + + +State 258 + + 64 algebra_head: ALGEBRA ident parameters IMPLEMENTS signature_ident '(' eqs ')' . + + $default reduce using rule 64 (algebra_head) + + +State 259 + + 83 eq: sig_var '=' . datatype + + "alphabet keyword" shift, and go to state 80 + STRING shift, and go to state 81 + VOID shift, and go to state 83 + '[' shift, and go to state 84 + '(' shift, and go to state 85 + + datatype go to state 273 + type_specifier go to state 87 + + +State 260 + + 153 grammar: GRAMMAR ident USES signature_ident '(' AXIOM '=' . nt_ident ')' '{' grammar_body '}' + + STRING shift, and go to state 274 + + nt_ident go to state 275 + + +State 261 + + 212 i_lhs: ident '(' args ')' . + + $default reduce using rule 212 (i_lhs) + + +State 262 + + 210 instance: INSTANCE i_lhs '=' ident $@4 . '(' product ')' ';' + + '(' shift, and go to state 276 + + +State 263 + + 63 algebra_head: mode ALGEBRA ident parameters IMPLEMENTS signature_ident '(' eqs . ')' + 82 eqs: eqs . ',' eq + + ',' shift, and go to state 257 + ')' shift, and go to state 277 + + +State 264 + + 28 datatype: VOID . + 99 para_decl: VOID . + + MODE reduce using rule 28 (datatype) + STRING reduce using rule 28 (datatype) + $default reduce using rule 99 (para_decl) + + +State 265 + + 98 para_decl: '<' . para_decls '>' + + "alphabet keyword" shift, and go to state 80 + STRING shift, and go to state 81 + VOID shift, and go to state 264 + '<' shift, and go to state 265 + '[' shift, and go to state 84 + '(' shift, and go to state 85 + + $default reduce using rule 94 (para_decls) + + datatype go to state 266 + type_specifier go to state 87 + para_decls go to state 278 + para_decl go to state 268 + + +State 266 + + 97 para_decl: datatype . ident + + MODE shift, and go to state 43 + STRING shift, and go to state 44 + + ident go to state 279 + + +State 267 + + 89 fn_def: mode_opt qual_datatype ident '(' para_decls . fnntparas ')' '{' statements '}' + 96 para_decls: para_decls . ',' para_decl + + ',' shift, and go to state 280 + ';' shift, and go to state 281 + + $default reduce using rule 91 (fnntparas) + + fnntparas go to state 282 + + +State 268 + + 95 para_decls: para_decl . + + $default reduce using rule 95 (para_decls) + + +State 269 + + 50 datatypes: datatypes ',' datatype . + + $default reduce using rule 50 (datatypes) + + +State 270 + + 45 sig_decls: sig_decls decl ';' . + + $default reduce using rule 45 (sig_decls) + + +State 271 + + 46 decl: qual_datatype ident '(' . multi_datatypes signtparas ')' + + "alphabet keyword" shift, and go to state 80 + STRING shift, and go to state 81 + VOID shift, and go to state 83 + '<' shift, and go to state 283 + '[' shift, and go to state 84 + '(' shift, and go to state 85 + + datatype go to state 284 + type_specifier go to state 87 + multi_datatype go to state 285 + multi_datatypes go to state 286 + + +State 272 + + 82 eqs: eqs ',' eq . + + $default reduce using rule 82 (eqs) + + +State 273 + + 83 eq: sig_var '=' datatype . + + $default reduce using rule 83 (eq) + + +State 274 + + 158 nt_ident: STRING . + + $default reduce using rule 158 (nt_ident) + + +State 275 + + 153 grammar: GRAMMAR ident USES signature_ident '(' AXIOM '=' nt_ident . ')' '{' grammar_body '}' + + ')' shift, and go to state 287 + + +State 276 + + 210 instance: INSTANCE i_lhs '=' ident $@4 '(' . product ')' ';' + + MODE shift, and go to state 17 + STRING shift, and go to state 18 + '(' shift, and go to state 19 + + algebra_ident go to state 20 + product go to state 288 + + +State 277 + + 63 algebra_head: mode ALGEBRA ident parameters IMPLEMENTS signature_ident '(' eqs ')' . + + $default reduce using rule 63 (algebra_head) + + +State 278 + + 96 para_decls: para_decls . ',' para_decl + 98 para_decl: '<' para_decls . '>' + + '>' shift, and go to state 289 + ',' shift, and go to state 280 + + +State 279 + + 97 para_decl: datatype ident . + + $default reduce using rule 97 (para_decl) + + +State 280 + + 96 para_decls: para_decls ',' . para_decl + + "alphabet keyword" shift, and go to state 80 + STRING shift, and go to state 81 + VOID shift, and go to state 264 + '<' shift, and go to state 265 + '[' shift, and go to state 84 + '(' shift, and go to state 85 + + datatype go to state 266 + type_specifier go to state 87 + para_decl go to state 290 + + +State 281 + + 90 fnntparas: ';' . para_decls + + "alphabet keyword" shift, and go to state 80 + STRING shift, and go to state 81 + VOID shift, and go to state 264 + '<' shift, and go to state 265 + '[' shift, and go to state 84 + '(' shift, and go to state 85 + + $default reduce using rule 94 (para_decls) + + datatype go to state 266 + type_specifier go to state 87 + para_decls go to state 291 + para_decl go to state 268 + + +State 282 + + 89 fn_def: mode_opt qual_datatype ident '(' para_decls fnntparas . ')' '{' statements '}' + + ')' shift, and go to state 292 + + +State 283 + + 51 multi_datatype: '<' . datatypes '>' + + "alphabet keyword" shift, and go to state 80 + STRING shift, and go to state 81 + VOID shift, and go to state 83 + '[' shift, and go to state 84 + '(' shift, and go to state 85 + + datatype go to state 233 + type_specifier go to state 87 + datatypes go to state 293 + + +State 284 + + 52 multi_datatype: datatype . + + $default reduce using rule 52 (multi_datatype) + + +State 285 + + 53 multi_datatypes: multi_datatype . + + $default reduce using rule 53 (multi_datatypes) + + +State 286 + + 46 decl: qual_datatype ident '(' multi_datatypes . signtparas ')' + 54 multi_datatypes: multi_datatypes . ',' multi_datatype + + ',' shift, and go to state 294 + ';' shift, and go to state 221 + + $default reduce using rule 43 (signtparas) + + signtparas go to state 295 + + +State 287 + + 153 grammar: GRAMMAR ident USES signature_ident '(' AXIOM '=' nt_ident ')' . '{' grammar_body '}' + + '{' shift, and go to state 296 + + +State 288 + + 210 instance: INSTANCE i_lhs '=' ident $@4 '(' product . ')' ';' + 213 product: product . '*' product + 214 | product . '/' product + 215 | product . '%' product + 216 | product . '^' product + 217 | product . '.' product + 218 | product . '|' product + 219 | product . '{' defaults '}' + 222 | product . SUCHTHAT filter_fn + + SUCHTHAT shift, and go to state 31 + '*' shift, and go to state 32 + '/' shift, and go to state 33 + '|' shift, and go to state 34 + '%' shift, and go to state 35 + '.' shift, and go to state 36 + '^' shift, and go to state 37 + '{' shift, and go to state 38 + ')' shift, and go to state 297 + + +State 289 + + 98 para_decl: '<' para_decls '>' . + + $default reduce using rule 98 (para_decl) + + +State 290 + + 96 para_decls: para_decls ',' para_decl . + + $default reduce using rule 96 (para_decls) + + +State 291 + + 90 fnntparas: ';' para_decls . + 96 para_decls: para_decls . ',' para_decl + + ',' shift, and go to state 280 + + $default reduce using rule 90 (fnntparas) + + +State 292 + + 89 fn_def: mode_opt qual_datatype ident '(' para_decls fnntparas ')' . '{' statements '}' + + '{' shift, and go to state 298 + + +State 293 + + 50 datatypes: datatypes . ',' datatype + 51 multi_datatype: '<' datatypes . '>' + + '>' shift, and go to state 299 + ',' shift, and go to state 250 + + +State 294 + + 54 multi_datatypes: multi_datatypes ',' . multi_datatype + + "alphabet keyword" shift, and go to state 80 + STRING shift, and go to state 81 + VOID shift, and go to state 83 + '<' shift, and go to state 283 + '[' shift, and go to state 84 + '(' shift, and go to state 85 + + datatype go to state 284 + type_specifier go to state 87 + multi_datatype go to state 300 + + +State 295 + + 46 decl: qual_datatype ident '(' multi_datatypes signtparas . ')' + + ')' shift, and go to state 301 + + +State 296 + + 153 grammar: GRAMMAR ident USES signature_ident '(' AXIOM '=' nt_ident ')' '{' . grammar_body '}' + + MODE shift, and go to state 43 + STRING shift, and go to state 44 + TABULATED shift, and go to state 302 + + ident go to state 303 + grammar_body go to state 304 + tabulated go to state 305 + productions go to state 306 + production go to state 307 + + +State 297 + + 210 instance: INSTANCE i_lhs '=' ident $@4 '(' product ')' . ';' + + ';' shift, and go to state 308 + + +State 298 + + 89 fn_def: mode_opt qual_datatype ident '(' para_decls fnntparas ')' '{' . statements '}' + + MODE shift, and go to state 43 + "alphabet keyword" shift, and go to state 80 + FOR shift, and go to state 309 + WHILE shift, and go to state 310 + STRING shift, and go to state 311 + IF shift, and go to state 312 + RETURN shift, and go to state 313 + CONTINUE shift, and go to state 314 + BREAK shift, and go to state 315 + VOID shift, and go to state 83 + '{' shift, and go to state 316 + '[' shift, and go to state 84 + '(' shift, and go to state 85 + + datatype go to state 317 + type_specifier go to state 87 + var_decl_init go to state 318 + var_decl go to state 319 + ident go to state 320 + statements go to state 321 + statement go to state 322 + continue go to state 323 + break go to state 324 + fn_call go to state 325 + return go to state 326 + if go to state 327 + for go to state 328 + while go to state 329 + assign go to state 330 + var_access go to state 331 + + +State 299 + + 51 multi_datatype: '<' datatypes '>' . + + $default reduce using rule 51 (multi_datatype) + + +State 300 + + 54 multi_datatypes: multi_datatypes ',' multi_datatype . + + $default reduce using rule 54 (multi_datatypes) + + +State 301 + + 46 decl: qual_datatype ident '(' multi_datatypes signtparas ')' . + + $default reduce using rule 46 (decl) + + +State 302 + + 156 tabulated: TABULATED . '{' args '}' + + '{' shift, and go to state 332 + + +State 303 + + 161 production: ident . ntargs '=' rhs ';' + + '(' shift, and go to state 333 + + $default reduce using rule 163 (ntargs) + + ntargs go to state 334 + + +State 304 + + 153 grammar: GRAMMAR ident USES signature_ident '(' AXIOM '=' nt_ident ')' '{' grammar_body . '}' + + '}' shift, and go to state 335 + + +State 305 + + 154 grammar_body: tabulated . productions + + MODE shift, and go to state 43 + STRING shift, and go to state 44 + + ident go to state 303 + productions go to state 336 + production go to state 307 + + +State 306 + + 155 grammar_body: productions . + 160 productions: productions . production + + MODE shift, and go to state 43 + STRING shift, and go to state 44 + + $default reduce using rule 155 (grammar_body) + + ident go to state 303 + production go to state 337 + + +State 307 + + 159 productions: production . + + $default reduce using rule 159 (productions) + + +State 308 + + 210 instance: INSTANCE i_lhs '=' ident $@4 '(' product ')' ';' . + + $default reduce using rule 210 (instance) + + +State 309 + + 118 for: FOR . '(' var_decl_init expr ';' inc_stmt ')' statement + + '(' shift, and go to state 338 + + +State 310 + + 119 while: WHILE . '(' expr ')' statement + + '(' shift, and go to state 339 + + +State 311 + + 31 type_specifier: STRING . + 79 ident: STRING . + + MODE reduce using rule 31 (type_specifier) + STRING reduce using rule 31 (type_specifier) + $default reduce using rule 79 (ident) + + +State 312 + + 116 if: IF . '(' expr ')' statement + 117 | IF . '(' expr ')' statement ELSE statement + + '(' shift, and go to state 340 + + +State 313 + + 115 return: RETURN . expr ';' + + MODE shift, and go to state 43 + STRING shift, and go to state 96 + NOT shift, and go to state 97 + NUMBER shift, and go to state 98 + FLOAT shift, and go to state 99 + '-' shift, and go to state 100 + '"' shift, and go to state 101 + '(' shift, and go to state 102 + '\'' shift, and go to state 103 + + ident go to state 58 + var_access go to state 104 + expr go to state 341 + number go to state 106 + const go to state 108 + + +State 314 + + 112 continue: CONTINUE . ';' + + ';' shift, and go to state 342 + + +State 315 + + 113 break: BREAK . ';' + + ';' shift, and go to state 343 + + +State 316 + + 111 statement: '{' . statements '}' + + MODE shift, and go to state 43 + "alphabet keyword" shift, and go to state 80 + FOR shift, and go to state 309 + WHILE shift, and go to state 310 + STRING shift, and go to state 311 + IF shift, and go to state 312 + RETURN shift, and go to state 313 + CONTINUE shift, and go to state 314 + BREAK shift, and go to state 315 + VOID shift, and go to state 83 + '{' shift, and go to state 316 + '[' shift, and go to state 84 + '(' shift, and go to state 85 + + datatype go to state 317 + type_specifier go to state 87 + var_decl_init go to state 318 + var_decl go to state 319 + ident go to state 320 + statements go to state 344 + statement go to state 322 + continue go to state 323 + break go to state 324 + fn_call go to state 325 + return go to state 326 + if go to state 327 + for go to state 328 + while go to state 329 + assign go to state 330 + var_access go to state 331 + + +State 317 + + 74 var_decl_init: datatype . ident '=' expr ';' + 75 var_decl: datatype . ident ';' + + MODE shift, and go to state 43 + STRING shift, and go to state 44 + + ident go to state 345 + + +State 318 + + 76 var_decl: var_decl_init . + + $default reduce using rule 76 (var_decl) + + +State 319 + + 109 statement: var_decl . + + $default reduce using rule 109 (statement) + + +State 320 + + 114 fn_call: ident . '(' exprs ')' ';' + 122 var_access: ident . + + '(' shift, and go to state 346 + + $default reduce using rule 122 (var_access) + + +State 321 + + 89 fn_def: mode_opt qual_datatype ident '(' para_decls fnntparas ')' '{' statements . '}' + 101 statements: statements . statement + + MODE shift, and go to state 43 + "alphabet keyword" shift, and go to state 80 + FOR shift, and go to state 309 + WHILE shift, and go to state 310 + STRING shift, and go to state 311 + IF shift, and go to state 312 + RETURN shift, and go to state 313 + CONTINUE shift, and go to state 314 + BREAK shift, and go to state 315 + VOID shift, and go to state 83 + '{' shift, and go to state 316 + '[' shift, and go to state 84 + '(' shift, and go to state 85 + '}' shift, and go to state 347 + + datatype go to state 317 + type_specifier go to state 87 + var_decl_init go to state 318 + var_decl go to state 319 + ident go to state 320 + statement go to state 348 + continue go to state 323 + break go to state 324 + fn_call go to state 325 + return go to state 326 + if go to state 327 + for go to state 328 + while go to state 329 + assign go to state 330 + var_access go to state 331 + + +State 322 + + 100 statements: statement . + + $default reduce using rule 100 (statements) + + +State 323 + + 102 statement: continue . + + $default reduce using rule 102 (statement) + + +State 324 + + 103 statement: break . + + $default reduce using rule 103 (statement) + + +State 325 + + 110 statement: fn_call . + + $default reduce using rule 110 (statement) + + +State 326 + + 104 statement: return . + + $default reduce using rule 104 (statement) + + +State 327 + + 105 statement: if . + + $default reduce using rule 105 (statement) + + +State 328 + + 106 statement: for . + + $default reduce using rule 106 (statement) + + +State 329 + + 107 statement: while . + + $default reduce using rule 107 (statement) + + +State 330 + + 108 statement: assign . + + $default reduce using rule 108 (statement) + + +State 331 + + 120 assign: var_access . '=' expr ';' + 123 var_access: var_access . '.' name_ident + 124 | var_access . '[' expr ']' + + '.' shift, and go to state 74 + '=' shift, and go to state 349 + '[' shift, and go to state 76 + + +State 332 + + 156 tabulated: TABULATED '{' . args '}' + + MODE shift, and go to state 43 + STRING shift, and go to state 44 + + args go to state 350 + arg go to state 201 + ident go to state 202 + + +State 333 + + 162 ntargs: '(' . para_decls ')' + + "alphabet keyword" shift, and go to state 80 + STRING shift, and go to state 81 + VOID shift, and go to state 264 + '<' shift, and go to state 265 + '[' shift, and go to state 84 + '(' shift, and go to state 85 + + $default reduce using rule 94 (para_decls) + + datatype go to state 266 + type_specifier go to state 87 + para_decls go to state 351 + para_decl go to state 268 + + +State 334 + + 161 production: ident ntargs . '=' rhs ';' + + '=' shift, and go to state 352 + + +State 335 + + 153 grammar: GRAMMAR ident USES signature_ident '(' AXIOM '=' nt_ident ')' '{' grammar_body '}' . + + $default reduce using rule 153 (grammar) + + +State 336 + + 154 grammar_body: tabulated productions . + 160 productions: productions . production + + MODE shift, and go to state 43 + STRING shift, and go to state 44 + + $default reduce using rule 154 (grammar_body) + + ident go to state 303 + production go to state 337 + + +State 337 + + 160 productions: productions production . + + $default reduce using rule 160 (productions) + + +State 338 + + 118 for: FOR '(' . var_decl_init expr ';' inc_stmt ')' statement + + "alphabet keyword" shift, and go to state 80 + STRING shift, and go to state 81 + VOID shift, and go to state 83 + '[' shift, and go to state 84 + '(' shift, and go to state 85 + + datatype go to state 353 + type_specifier go to state 87 + var_decl_init go to state 354 + + +State 339 + + 119 while: WHILE '(' . expr ')' statement + + MODE shift, and go to state 43 + STRING shift, and go to state 96 + NOT shift, and go to state 97 + NUMBER shift, and go to state 98 + FLOAT shift, and go to state 99 + '-' shift, and go to state 100 + '"' shift, and go to state 101 + '(' shift, and go to state 102 + '\'' shift, and go to state 103 + + ident go to state 58 + var_access go to state 104 + expr go to state 355 + number go to state 106 + const go to state 108 + + +State 340 + + 116 if: IF '(' . expr ')' statement + 117 | IF '(' . expr ')' statement ELSE statement + + MODE shift, and go to state 43 + STRING shift, and go to state 96 + NOT shift, and go to state 97 + NUMBER shift, and go to state 98 + FLOAT shift, and go to state 99 + '-' shift, and go to state 100 + '"' shift, and go to state 101 + '(' shift, and go to state 102 + '\'' shift, and go to state 103 + + ident go to state 58 + var_access go to state 104 + expr go to state 356 + number go to state 106 + const go to state 108 + + +State 341 + + 115 return: RETURN expr . ';' + 125 expr: expr . '<' expr + 126 | expr . '>' expr + 127 | expr . LT expr + 128 | expr . GT expr + 129 | expr . EQ expr + 130 | expr . NEQ expr + 131 | expr . AND expr + 132 | expr . OR expr + 135 | expr . '+' expr + 136 | expr . '-' expr + 137 | expr . '*' expr + 138 | expr . '/' expr + + AND shift, and go to state 139 + EQ shift, and go to state 140 + GT shift, and go to state 141 + LT shift, and go to state 142 + NEQ shift, and go to state 143 + OR shift, and go to state 144 + '<' shift, and go to state 145 + '>' shift, and go to state 146 + '-' shift, and go to state 147 + '+' shift, and go to state 148 + '*' shift, and go to state 149 + '/' shift, and go to state 150 + ';' shift, and go to state 357 + + +State 342 + + 112 continue: CONTINUE ';' . + + $default reduce using rule 112 (continue) + + +State 343 + + 113 break: BREAK ';' . + + $default reduce using rule 113 (break) + + +State 344 + + 101 statements: statements . statement + 111 statement: '{' statements . '}' + + MODE shift, and go to state 43 + "alphabet keyword" shift, and go to state 80 + FOR shift, and go to state 309 + WHILE shift, and go to state 310 + STRING shift, and go to state 311 + IF shift, and go to state 312 + RETURN shift, and go to state 313 + CONTINUE shift, and go to state 314 + BREAK shift, and go to state 315 + VOID shift, and go to state 83 + '{' shift, and go to state 316 + '[' shift, and go to state 84 + '(' shift, and go to state 85 + '}' shift, and go to state 358 + + datatype go to state 317 + type_specifier go to state 87 + var_decl_init go to state 318 + var_decl go to state 319 + ident go to state 320 + statement go to state 348 + continue go to state 323 + break go to state 324 + fn_call go to state 325 + return go to state 326 + if go to state 327 + for go to state 328 + while go to state 329 + assign go to state 330 + var_access go to state 331 + + +State 345 + + 74 var_decl_init: datatype ident . '=' expr ';' + 75 var_decl: datatype ident . ';' + + '=' shift, and go to state 359 + ';' shift, and go to state 360 + + +State 346 + + 114 fn_call: ident '(' . exprs ')' ';' + + MODE shift, and go to state 43 + STRING shift, and go to state 96 + NOT shift, and go to state 97 + NUMBER shift, and go to state 98 + FLOAT shift, and go to state 99 + '-' shift, and go to state 100 + '"' shift, and go to state 101 + '(' shift, and go to state 102 + '\'' shift, and go to state 103 + + ident go to state 58 + var_access go to state 104 + expr go to state 105 + number go to state 106 + exprs go to state 361 + const go to state 108 + + +State 347 + + 89 fn_def: mode_opt qual_datatype ident '(' para_decls fnntparas ')' '{' statements '}' . + + $default reduce using rule 89 (fn_def) + + +State 348 + + 101 statements: statements statement . + + $default reduce using rule 101 (statements) + + +State 349 + + 120 assign: var_access '=' . expr ';' + + MODE shift, and go to state 43 + STRING shift, and go to state 96 + NOT shift, and go to state 97 + NUMBER shift, and go to state 98 + FLOAT shift, and go to state 99 + '-' shift, and go to state 100 + '"' shift, and go to state 101 + '(' shift, and go to state 102 + '\'' shift, and go to state 103 + + ident go to state 58 + var_access go to state 104 + expr go to state 362 + number go to state 106 + const go to state 108 + + +State 350 + + 40 args: args . ',' arg + 156 tabulated: TABULATED '{' args . '}' + + ',' shift, and go to state 220 + '}' shift, and go to state 363 + + +State 351 + + 96 para_decls: para_decls . ',' para_decl + 162 ntargs: '(' para_decls . ')' + + ',' shift, and go to state 280 + ')' shift, and go to state 364 + + +State 352 + + 161 production: ident ntargs '=' . rhs ';' + + STRING shift, and go to state 365 + '<' shift, and go to state 366 + '.' shift, and go to state 367 + '{' shift, and go to state 368 + + rhs go to state 369 + alts go to state 370 + alt go to state 371 + sig_fn_or_term_ident go to state 372 + symbol_ident go to state 373 + + +State 353 + + 74 var_decl_init: datatype . ident '=' expr ';' + + MODE shift, and go to state 43 + STRING shift, and go to state 44 + + ident go to state 374 + + +State 354 + + 118 for: FOR '(' var_decl_init . expr ';' inc_stmt ')' statement + + MODE shift, and go to state 43 + STRING shift, and go to state 96 + NOT shift, and go to state 97 + NUMBER shift, and go to state 98 + FLOAT shift, and go to state 99 + '-' shift, and go to state 100 + '"' shift, and go to state 101 + '(' shift, and go to state 102 + '\'' shift, and go to state 103 + + ident go to state 58 + var_access go to state 104 + expr go to state 375 + number go to state 106 + const go to state 108 + + +State 355 + + 119 while: WHILE '(' expr . ')' statement + 125 expr: expr . '<' expr + 126 | expr . '>' expr + 127 | expr . LT expr + 128 | expr . GT expr + 129 | expr . EQ expr + 130 | expr . NEQ expr + 131 | expr . AND expr + 132 | expr . OR expr + 135 | expr . '+' expr + 136 | expr . '-' expr + 137 | expr . '*' expr + 138 | expr . '/' expr + + AND shift, and go to state 139 + EQ shift, and go to state 140 + GT shift, and go to state 141 + LT shift, and go to state 142 + NEQ shift, and go to state 143 + OR shift, and go to state 144 + '<' shift, and go to state 145 + '>' shift, and go to state 146 + '-' shift, and go to state 147 + '+' shift, and go to state 148 + '*' shift, and go to state 149 + '/' shift, and go to state 150 + ')' shift, and go to state 376 + + +State 356 + + 116 if: IF '(' expr . ')' statement + 117 | IF '(' expr . ')' statement ELSE statement + 125 expr: expr . '<' expr + 126 | expr . '>' expr + 127 | expr . LT expr + 128 | expr . GT expr + 129 | expr . EQ expr + 130 | expr . NEQ expr + 131 | expr . AND expr + 132 | expr . OR expr + 135 | expr . '+' expr + 136 | expr . '-' expr + 137 | expr . '*' expr + 138 | expr . '/' expr + + AND shift, and go to state 139 + EQ shift, and go to state 140 + GT shift, and go to state 141 + LT shift, and go to state 142 + NEQ shift, and go to state 143 + OR shift, and go to state 144 + '<' shift, and go to state 145 + '>' shift, and go to state 146 + '-' shift, and go to state 147 + '+' shift, and go to state 148 + '*' shift, and go to state 149 + '/' shift, and go to state 150 + ')' shift, and go to state 377 + + +State 357 + + 115 return: RETURN expr ';' . + + $default reduce using rule 115 (return) + + +State 358 + + 111 statement: '{' statements '}' . + + $default reduce using rule 111 (statement) + + +State 359 + + 74 var_decl_init: datatype ident '=' . expr ';' + + MODE shift, and go to state 43 + STRING shift, and go to state 96 + NOT shift, and go to state 97 + NUMBER shift, and go to state 98 + FLOAT shift, and go to state 99 + '-' shift, and go to state 100 + '"' shift, and go to state 101 + '(' shift, and go to state 102 + '\'' shift, and go to state 103 + + ident go to state 58 + var_access go to state 104 + expr go to state 378 + number go to state 106 + const go to state 108 + + +State 360 + + 75 var_decl: datatype ident ';' . + + $default reduce using rule 75 (var_decl) + + +State 361 + + 114 fn_call: ident '(' exprs . ')' ';' + 148 exprs: exprs . ',' expr + + ',' shift, and go to state 151 + ')' shift, and go to state 379 + + +State 362 + + 120 assign: var_access '=' expr . ';' + 125 expr: expr . '<' expr + 126 | expr . '>' expr + 127 | expr . LT expr + 128 | expr . GT expr + 129 | expr . EQ expr + 130 | expr . NEQ expr + 131 | expr . AND expr + 132 | expr . OR expr + 135 | expr . '+' expr + 136 | expr . '-' expr + 137 | expr . '*' expr + 138 | expr . '/' expr + + AND shift, and go to state 139 + EQ shift, and go to state 140 + GT shift, and go to state 141 + LT shift, and go to state 142 + NEQ shift, and go to state 143 + OR shift, and go to state 144 + '<' shift, and go to state 145 + '>' shift, and go to state 146 + '-' shift, and go to state 147 + '+' shift, and go to state 148 + '*' shift, and go to state 149 + '/' shift, and go to state 150 + ';' shift, and go to state 380 + + +State 363 + + 156 tabulated: TABULATED '{' args '}' . + + $default reduce using rule 156 (tabulated) + + +State 364 + + 162 ntargs: '(' para_decls ')' . + + $default reduce using rule 162 (ntargs) + + +State 365 + + 186 sig_fn_or_term_ident: STRING . + 187 symbol_ident: STRING . + + '(' reduce using rule 186 (sig_fn_or_term_ident) + $default reduce using rule 187 (symbol_ident) + + +State 366 + + 180 alt: '<' . tracks '>' + + STRING shift, and go to state 365 + '<' shift, and go to state 366 + '.' shift, and go to state 367 + '{' shift, and go to state 368 + + tracks go to state 381 + track go to state 382 + alt go to state 383 + sig_fn_or_term_ident go to state 372 + symbol_ident go to state 373 + + +State 367 + + 185 alt: '.' . '[' statements ']' '.' '{' alt '}' + + '[' shift, and go to state 384 + + +State 368 + + 176 alt: '{' . alts '}' + + STRING shift, and go to state 365 + '<' shift, and go to state 366 + '.' shift, and go to state 367 + '{' shift, and go to state 368 + + alts go to state 385 + alt go to state 371 + sig_fn_or_term_ident go to state 372 + symbol_ident go to state 373 + + +State 369 + + 161 production: ident ntargs '=' rhs . ';' + + ';' shift, and go to state 386 + + +State 370 + + 164 rhs: alts . + 165 | alts . '#' choice_fn_ident + 175 alts: alts . '|' alt + + '|' shift, and go to state 387 + '#' shift, and go to state 388 + + $default reduce using rule 164 (rhs) + + +State 371 + + 174 alts: alt . + 179 alt: alt . filter_kw filter_fn + 181 | alt . filter_kw '<' filters '>' + 182 | alt . '.' '(' exprs ')' '.' + 184 | alt . '.' '{' alt '}' '.' + + WITH shift, and go to state 389 + SUCHTHAT shift, and go to state 390 + WITH_OVERLAY shift, and go to state 391 + SUCHTHAT_OVERLAY shift, and go to state 392 + '.' shift, and go to state 393 + + $default reduce using rule 174 (alts) + + filter_kw go to state 394 + + +State 372 + + 177 alt: sig_fn_or_term_ident . '(' rhs_args ntparas ')' + + '(' shift, and go to state 395 + + +State 373 + + 178 alt: symbol_ident . + 183 | symbol_ident . '[' exprs ']' + + '[' shift, and go to state 396 + + $default reduce using rule 178 (alt) + + +State 374 + + 74 var_decl_init: datatype ident . '=' expr ';' + + '=' shift, and go to state 359 + + +State 375 + + 118 for: FOR '(' var_decl_init expr . ';' inc_stmt ')' statement + 125 expr: expr . '<' expr + 126 | expr . '>' expr + 127 | expr . LT expr + 128 | expr . GT expr + 129 | expr . EQ expr + 130 | expr . NEQ expr + 131 | expr . AND expr + 132 | expr . OR expr + 135 | expr . '+' expr + 136 | expr . '-' expr + 137 | expr . '*' expr + 138 | expr . '/' expr + + AND shift, and go to state 139 + EQ shift, and go to state 140 + GT shift, and go to state 141 + LT shift, and go to state 142 + NEQ shift, and go to state 143 + OR shift, and go to state 144 + '<' shift, and go to state 145 + '>' shift, and go to state 146 + '-' shift, and go to state 147 + '+' shift, and go to state 148 + '*' shift, and go to state 149 + '/' shift, and go to state 150 + ';' shift, and go to state 397 + + +State 376 + + 119 while: WHILE '(' expr ')' . statement + + MODE shift, and go to state 43 + "alphabet keyword" shift, and go to state 80 + FOR shift, and go to state 309 + WHILE shift, and go to state 310 + STRING shift, and go to state 311 + IF shift, and go to state 312 + RETURN shift, and go to state 313 + CONTINUE shift, and go to state 314 + BREAK shift, and go to state 315 + VOID shift, and go to state 83 + '{' shift, and go to state 316 + '[' shift, and go to state 84 + '(' shift, and go to state 85 + + datatype go to state 317 + type_specifier go to state 87 + var_decl_init go to state 318 + var_decl go to state 319 + ident go to state 320 + statement go to state 398 + continue go to state 323 + break go to state 324 + fn_call go to state 325 + return go to state 326 + if go to state 327 + for go to state 328 + while go to state 329 + assign go to state 330 + var_access go to state 331 + + +State 377 + + 116 if: IF '(' expr ')' . statement + 117 | IF '(' expr ')' . statement ELSE statement + + MODE shift, and go to state 43 + "alphabet keyword" shift, and go to state 80 + FOR shift, and go to state 309 + WHILE shift, and go to state 310 + STRING shift, and go to state 311 + IF shift, and go to state 312 + RETURN shift, and go to state 313 + CONTINUE shift, and go to state 314 + BREAK shift, and go to state 315 + VOID shift, and go to state 83 + '{' shift, and go to state 316 + '[' shift, and go to state 84 + '(' shift, and go to state 85 + + datatype go to state 317 + type_specifier go to state 87 + var_decl_init go to state 318 + var_decl go to state 319 + ident go to state 320 + statement go to state 399 + continue go to state 323 + break go to state 324 + fn_call go to state 325 + return go to state 326 + if go to state 327 + for go to state 328 + while go to state 329 + assign go to state 330 + var_access go to state 331 + + +State 378 + + 74 var_decl_init: datatype ident '=' expr . ';' + 125 expr: expr . '<' expr + 126 | expr . '>' expr + 127 | expr . LT expr + 128 | expr . GT expr + 129 | expr . EQ expr + 130 | expr . NEQ expr + 131 | expr . AND expr + 132 | expr . OR expr + 135 | expr . '+' expr + 136 | expr . '-' expr + 137 | expr . '*' expr + 138 | expr . '/' expr + + AND shift, and go to state 139 + EQ shift, and go to state 140 + GT shift, and go to state 141 + LT shift, and go to state 142 + NEQ shift, and go to state 143 + OR shift, and go to state 144 + '<' shift, and go to state 145 + '>' shift, and go to state 146 + '-' shift, and go to state 147 + '+' shift, and go to state 148 + '*' shift, and go to state 149 + '/' shift, and go to state 150 + ';' shift, and go to state 400 + + +State 379 + + 114 fn_call: ident '(' exprs ')' . ';' + + ';' shift, and go to state 401 + + +State 380 + + 120 assign: var_access '=' expr ';' . + + $default reduce using rule 120 (assign) + + +State 381 + + 172 tracks: tracks . ',' track + 180 alt: '<' tracks . '>' + + '>' shift, and go to state 402 + ',' shift, and go to state 403 + + +State 382 + + 171 tracks: track . + + $default reduce using rule 171 (tracks) + + +State 383 + + 173 track: alt . + 179 alt: alt . filter_kw filter_fn + 181 | alt . filter_kw '<' filters '>' + 182 | alt . '.' '(' exprs ')' '.' + 184 | alt . '.' '{' alt '}' '.' + + WITH shift, and go to state 389 + SUCHTHAT shift, and go to state 390 + WITH_OVERLAY shift, and go to state 391 + SUCHTHAT_OVERLAY shift, and go to state 392 + '.' shift, and go to state 393 + + $default reduce using rule 173 (track) + + filter_kw go to state 394 + + +State 384 + + 185 alt: '.' '[' . statements ']' '.' '{' alt '}' + + MODE shift, and go to state 43 + "alphabet keyword" shift, and go to state 80 + FOR shift, and go to state 309 + WHILE shift, and go to state 310 + STRING shift, and go to state 311 + IF shift, and go to state 312 + RETURN shift, and go to state 313 + CONTINUE shift, and go to state 314 + BREAK shift, and go to state 315 + VOID shift, and go to state 83 + '{' shift, and go to state 316 + '[' shift, and go to state 84 + '(' shift, and go to state 85 + + datatype go to state 317 + type_specifier go to state 87 + var_decl_init go to state 318 + var_decl go to state 319 + ident go to state 320 + statements go to state 404 + statement go to state 322 + continue go to state 323 + break go to state 324 + fn_call go to state 325 + return go to state 326 + if go to state 327 + for go to state 328 + while go to state 329 + assign go to state 330 + var_access go to state 331 + + +State 385 + + 175 alts: alts . '|' alt + 176 alt: '{' alts . '}' + + '|' shift, and go to state 387 + '}' shift, and go to state 405 + + +State 386 + + 161 production: ident ntargs '=' rhs ';' . + + $default reduce using rule 161 (production) + + +State 387 + + 175 alts: alts '|' . alt + + STRING shift, and go to state 365 + '<' shift, and go to state 366 + '.' shift, and go to state 367 + '{' shift, and go to state 368 + + alt go to state 406 + sig_fn_or_term_ident go to state 372 + symbol_ident go to state 373 + + +State 388 + + 165 rhs: alts '#' . choice_fn_ident + + STRING shift, and go to state 407 + + choice_fn_ident go to state 408 + + +State 389 + + 188 filter_kw: WITH . + + $default reduce using rule 188 (filter_kw) + + +State 390 + + 189 filter_kw: SUCHTHAT . + + $default reduce using rule 189 (filter_kw) + + +State 391 + + 190 filter_kw: WITH_OVERLAY . + + $default reduce using rule 190 (filter_kw) + + +State 392 + + 191 filter_kw: SUCHTHAT_OVERLAY . + + $default reduce using rule 191 (filter_kw) + + +State 393 + + 182 alt: alt '.' . '(' exprs ')' '.' + 184 | alt '.' . '{' alt '}' '.' + + '{' shift, and go to state 409 + '(' shift, and go to state 410 + + +State 394 + + 179 alt: alt filter_kw . filter_fn + 181 | alt filter_kw . '<' filters '>' + + MODE shift, and go to state 43 + STRING shift, and go to state 44 + '<' shift, and go to state 411 + + ident go to state 50 + filter_fn go to state 412 + + +State 395 + + 177 alt: sig_fn_or_term_ident '(' . rhs_args ntparas ')' + + STRING shift, and go to state 365 + NUMBER shift, and go to state 98 + FLOAT shift, and go to state 99 + '<' shift, and go to state 366 + '-' shift, and go to state 100 + '.' shift, and go to state 367 + '{' shift, and go to state 368 + '"' shift, and go to state 101 + '\'' shift, and go to state 103 + + number go to state 106 + alt go to state 413 + sig_fn_or_term_ident go to state 372 + symbol_ident go to state 373 + rhs_args go to state 414 + rhs_arg go to state 415 + const go to state 416 + + +State 396 + + 183 alt: symbol_ident '[' . exprs ']' + + MODE shift, and go to state 43 + STRING shift, and go to state 96 + NOT shift, and go to state 97 + NUMBER shift, and go to state 98 + FLOAT shift, and go to state 99 + '-' shift, and go to state 100 + '"' shift, and go to state 101 + '(' shift, and go to state 102 + '\'' shift, and go to state 103 + + ident go to state 58 + var_access go to state 104 + expr go to state 105 + number go to state 106 + exprs go to state 417 + const go to state 108 + + +State 397 + + 118 for: FOR '(' var_decl_init expr ';' . inc_stmt ')' statement + + MODE shift, and go to state 43 + STRING shift, and go to state 44 + + ident go to state 58 + inc_stmt go to state 418 + var_access go to state 419 + + +State 398 + + 119 while: WHILE '(' expr ')' statement . + + $default reduce using rule 119 (while) + + +State 399 + + 116 if: IF '(' expr ')' statement . + 117 | IF '(' expr ')' statement . ELSE statement + + ELSE shift, and go to state 420 + + $default reduce using rule 116 (if) + + +State 400 + + 74 var_decl_init: datatype ident '=' expr ';' . + + $default reduce using rule 74 (var_decl_init) + + +State 401 + + 114 fn_call: ident '(' exprs ')' ';' . + + $default reduce using rule 114 (fn_call) + + +State 402 + + 180 alt: '<' tracks '>' . + + $default reduce using rule 180 (alt) + + +State 403 + + 172 tracks: tracks ',' . track + + STRING shift, and go to state 365 + '<' shift, and go to state 366 + '.' shift, and go to state 367 + '{' shift, and go to state 368 + + track go to state 421 + alt go to state 383 + sig_fn_or_term_ident go to state 372 + symbol_ident go to state 373 + + +State 404 + + 101 statements: statements . statement + 185 alt: '.' '[' statements . ']' '.' '{' alt '}' + + MODE shift, and go to state 43 + "alphabet keyword" shift, and go to state 80 + FOR shift, and go to state 309 + WHILE shift, and go to state 310 + STRING shift, and go to state 311 + IF shift, and go to state 312 + RETURN shift, and go to state 313 + CONTINUE shift, and go to state 314 + BREAK shift, and go to state 315 + VOID shift, and go to state 83 + '{' shift, and go to state 316 + '[' shift, and go to state 84 + ']' shift, and go to state 422 + '(' shift, and go to state 85 + + datatype go to state 317 + type_specifier go to state 87 + var_decl_init go to state 318 + var_decl go to state 319 + ident go to state 320 + statement go to state 348 + continue go to state 323 + break go to state 324 + fn_call go to state 325 + return go to state 326 + if go to state 327 + for go to state 328 + while go to state 329 + assign go to state 330 + var_access go to state 331 + + +State 405 + + 176 alt: '{' alts '}' . + + $default reduce using rule 176 (alt) + + +State 406 + + 175 alts: alts '|' alt . + 179 alt: alt . filter_kw filter_fn + 181 | alt . filter_kw '<' filters '>' + 182 | alt . '.' '(' exprs ')' '.' + 184 | alt . '.' '{' alt '}' '.' + + WITH shift, and go to state 389 + SUCHTHAT shift, and go to state 390 + WITH_OVERLAY shift, and go to state 391 + SUCHTHAT_OVERLAY shift, and go to state 392 + '.' shift, and go to state 393 + + $default reduce using rule 175 (alts) + + filter_kw go to state 394 + + +State 407 + + 166 choice_fn_ident: STRING . + + $default reduce using rule 166 (choice_fn_ident) + + +State 408 + + 165 rhs: alts '#' choice_fn_ident . + + $default reduce using rule 165 (rhs) + + +State 409 + + 184 alt: alt '.' '{' . alt '}' '.' + + STRING shift, and go to state 365 + '<' shift, and go to state 366 + '.' shift, and go to state 367 + '{' shift, and go to state 368 + + alt go to state 423 + sig_fn_or_term_ident go to state 372 + symbol_ident go to state 373 + + +State 410 + + 182 alt: alt '.' '(' . exprs ')' '.' + + MODE shift, and go to state 43 + STRING shift, and go to state 96 + NOT shift, and go to state 97 + NUMBER shift, and go to state 98 + FLOAT shift, and go to state 99 + '-' shift, and go to state 100 + '"' shift, and go to state 101 + '(' shift, and go to state 102 + '\'' shift, and go to state 103 + + ident go to state 58 + var_access go to state 104 + expr go to state 105 + number go to state 106 + exprs go to state 424 + const go to state 108 + + +State 411 + + 181 alt: alt filter_kw '<' . filters '>' + + MODE shift, and go to state 43 + STRING shift, and go to state 44 + + ident go to state 50 + filters go to state 425 + filter_fn go to state 426 + + +State 412 + + 179 alt: alt filter_kw filter_fn . + + $default reduce using rule 179 (alt) + + +State 413 + + 179 alt: alt . filter_kw filter_fn + 181 | alt . filter_kw '<' filters '>' + 182 | alt . '.' '(' exprs ')' '.' + 184 | alt . '.' '{' alt '}' '.' + 196 rhs_arg: alt . + + WITH shift, and go to state 389 + SUCHTHAT shift, and go to state 390 + WITH_OVERLAY shift, and go to state 391 + SUCHTHAT_OVERLAY shift, and go to state 392 + '.' shift, and go to state 393 + + $default reduce using rule 196 (rhs_arg) + + filter_kw go to state 394 + + +State 414 + + 177 alt: sig_fn_or_term_ident '(' rhs_args . ntparas ')' + 195 rhs_args: rhs_args . ',' rhs_arg + + ',' shift, and go to state 427 + ';' shift, and go to state 428 + + $default reduce using rule 168 (ntparas) + + ntparas go to state 429 + + +State 415 + + 194 rhs_args: rhs_arg . + + $default reduce using rule 194 (rhs_args) + + +State 416 + + 197 rhs_arg: const . + + $default reduce using rule 197 (rhs_arg) + + +State 417 + + 148 exprs: exprs . ',' expr + 183 alt: symbol_ident '[' exprs . ']' + + ',' shift, and go to state 151 + ']' shift, and go to state 430 + + +State 418 + + 118 for: FOR '(' var_decl_init expr ';' inc_stmt . ')' statement + + ')' shift, and go to state 431 + + +State 419 + + 121 inc_stmt: var_access . '=' expr + 123 var_access: var_access . '.' name_ident + 124 | var_access . '[' expr ']' + + '.' shift, and go to state 74 + '=' shift, and go to state 432 + '[' shift, and go to state 76 + + +State 420 + + 117 if: IF '(' expr ')' statement ELSE . statement + + MODE shift, and go to state 43 + "alphabet keyword" shift, and go to state 80 + FOR shift, and go to state 309 + WHILE shift, and go to state 310 + STRING shift, and go to state 311 + IF shift, and go to state 312 + RETURN shift, and go to state 313 + CONTINUE shift, and go to state 314 + BREAK shift, and go to state 315 + VOID shift, and go to state 83 + '{' shift, and go to state 316 + '[' shift, and go to state 84 + '(' shift, and go to state 85 + + datatype go to state 317 + type_specifier go to state 87 + var_decl_init go to state 318 + var_decl go to state 319 + ident go to state 320 + statement go to state 433 + continue go to state 323 + break go to state 324 + fn_call go to state 325 + return go to state 326 + if go to state 327 + for go to state 328 + while go to state 329 + assign go to state 330 + var_access go to state 331 + + +State 421 + + 172 tracks: tracks ',' track . + + $default reduce using rule 172 (tracks) + + +State 422 + + 185 alt: '.' '[' statements ']' . '.' '{' alt '}' + + '.' shift, and go to state 434 + + +State 423 + + 179 alt: alt . filter_kw filter_fn + 181 | alt . filter_kw '<' filters '>' + 182 | alt . '.' '(' exprs ')' '.' + 184 | alt . '.' '{' alt '}' '.' + 184 | alt '.' '{' alt . '}' '.' + + WITH shift, and go to state 389 + SUCHTHAT shift, and go to state 390 + WITH_OVERLAY shift, and go to state 391 + SUCHTHAT_OVERLAY shift, and go to state 392 + '.' shift, and go to state 393 + '}' shift, and go to state 435 + + filter_kw go to state 394 + + +State 424 + + 148 exprs: exprs . ',' expr + 182 alt: alt '.' '(' exprs . ')' '.' + + ',' shift, and go to state 151 + ')' shift, and go to state 436 + + +State 425 + + 169 filters: filters . ',' filter_fn + 181 alt: alt filter_kw '<' filters . '>' + + '>' shift, and go to state 437 + ',' shift, and go to state 438 + + +State 426 + + 170 filters: filter_fn . + + $default reduce using rule 170 (filters) + + +State 427 + + 195 rhs_args: rhs_args ',' . rhs_arg + + STRING shift, and go to state 365 + NUMBER shift, and go to state 98 + FLOAT shift, and go to state 99 + '<' shift, and go to state 366 + '-' shift, and go to state 100 + '.' shift, and go to state 367 + '{' shift, and go to state 368 + '"' shift, and go to state 101 + '\'' shift, and go to state 103 + + number go to state 106 + alt go to state 413 + sig_fn_or_term_ident go to state 372 + symbol_ident go to state 373 + rhs_arg go to state 439 + const go to state 416 + + +State 428 + + 167 ntparas: ';' . exprs + + MODE shift, and go to state 43 + STRING shift, and go to state 96 + NOT shift, and go to state 97 + NUMBER shift, and go to state 98 + FLOAT shift, and go to state 99 + '-' shift, and go to state 100 + '"' shift, and go to state 101 + '(' shift, and go to state 102 + '\'' shift, and go to state 103 + + ident go to state 58 + var_access go to state 104 + expr go to state 105 + number go to state 106 + exprs go to state 440 + const go to state 108 + + +State 429 + + 177 alt: sig_fn_or_term_ident '(' rhs_args ntparas . ')' + + ')' shift, and go to state 441 + + +State 430 + + 183 alt: symbol_ident '[' exprs ']' . + + $default reduce using rule 183 (alt) + + +State 431 + + 118 for: FOR '(' var_decl_init expr ';' inc_stmt ')' . statement + + MODE shift, and go to state 43 + "alphabet keyword" shift, and go to state 80 + FOR shift, and go to state 309 + WHILE shift, and go to state 310 + STRING shift, and go to state 311 + IF shift, and go to state 312 + RETURN shift, and go to state 313 + CONTINUE shift, and go to state 314 + BREAK shift, and go to state 315 + VOID shift, and go to state 83 + '{' shift, and go to state 316 + '[' shift, and go to state 84 + '(' shift, and go to state 85 + + datatype go to state 317 + type_specifier go to state 87 + var_decl_init go to state 318 + var_decl go to state 319 + ident go to state 320 + statement go to state 442 + continue go to state 323 + break go to state 324 + fn_call go to state 325 + return go to state 326 + if go to state 327 + for go to state 328 + while go to state 329 + assign go to state 330 + var_access go to state 331 + + +State 432 + + 121 inc_stmt: var_access '=' . expr + + MODE shift, and go to state 43 + STRING shift, and go to state 96 + NOT shift, and go to state 97 + NUMBER shift, and go to state 98 + FLOAT shift, and go to state 99 + '-' shift, and go to state 100 + '"' shift, and go to state 101 + '(' shift, and go to state 102 + '\'' shift, and go to state 103 + + ident go to state 58 + var_access go to state 104 + expr go to state 443 + number go to state 106 + const go to state 108 + + +State 433 + + 117 if: IF '(' expr ')' statement ELSE statement . + + $default reduce using rule 117 (if) + + +State 434 + + 185 alt: '.' '[' statements ']' '.' . '{' alt '}' + + '{' shift, and go to state 444 + + +State 435 + + 184 alt: alt '.' '{' alt '}' . '.' + + '.' shift, and go to state 445 + + +State 436 + + 182 alt: alt '.' '(' exprs ')' . '.' + + '.' shift, and go to state 446 + + +State 437 + + 181 alt: alt filter_kw '<' filters '>' . + + $default reduce using rule 181 (alt) + + +State 438 + + 169 filters: filters ',' . filter_fn + + MODE shift, and go to state 43 + STRING shift, and go to state 44 + + ident go to state 50 + filter_fn go to state 447 + + +State 439 + + 195 rhs_args: rhs_args ',' rhs_arg . + + $default reduce using rule 195 (rhs_args) + + +State 440 + + 148 exprs: exprs . ',' expr + 167 ntparas: ';' exprs . + + ',' shift, and go to state 151 + + $default reduce using rule 167 (ntparas) + + +State 441 + + 177 alt: sig_fn_or_term_ident '(' rhs_args ntparas ')' . + + $default reduce using rule 177 (alt) + + +State 442 + + 118 for: FOR '(' var_decl_init expr ';' inc_stmt ')' statement . + + $default reduce using rule 118 (for) + + +State 443 + + 121 inc_stmt: var_access '=' expr . + 125 expr: expr . '<' expr + 126 | expr . '>' expr + 127 | expr . LT expr + 128 | expr . GT expr + 129 | expr . EQ expr + 130 | expr . NEQ expr + 131 | expr . AND expr + 132 | expr . OR expr + 135 | expr . '+' expr + 136 | expr . '-' expr + 137 | expr . '*' expr + 138 | expr . '/' expr + + AND shift, and go to state 139 + EQ shift, and go to state 140 + GT shift, and go to state 141 + LT shift, and go to state 142 + NEQ shift, and go to state 143 + OR shift, and go to state 144 + '<' shift, and go to state 145 + '>' shift, and go to state 146 + '-' shift, and go to state 147 + '+' shift, and go to state 148 + '*' shift, and go to state 149 + '/' shift, and go to state 150 + + $default reduce using rule 121 (inc_stmt) + + +State 444 + + 185 alt: '.' '[' statements ']' '.' '{' . alt '}' + + STRING shift, and go to state 365 + '<' shift, and go to state 366 + '.' shift, and go to state 367 + '{' shift, and go to state 368 + + alt go to state 448 + sig_fn_or_term_ident go to state 372 + symbol_ident go to state 373 + + +State 445 + + 184 alt: alt '.' '{' alt '}' '.' . + + $default reduce using rule 184 (alt) + + +State 446 + + 182 alt: alt '.' '(' exprs ')' '.' . + + $default reduce using rule 182 (alt) + + +State 447 + + 169 filters: filters ',' filter_fn . + + $default reduce using rule 169 (filters) + + +State 448 + + 179 alt: alt . filter_kw filter_fn + 181 | alt . filter_kw '<' filters '>' + 182 | alt . '.' '(' exprs ')' '.' + 184 | alt . '.' '{' alt '}' '.' + 185 | '.' '[' statements ']' '.' '{' alt . '}' + + WITH shift, and go to state 389 + SUCHTHAT shift, and go to state 390 + WITH_OVERLAY shift, and go to state 391 + SUCHTHAT_OVERLAY shift, and go to state 392 + '.' shift, and go to state 393 + '}' shift, and go to state 449 + + filter_kw go to state 394 + + +State 449 + + 185 alt: '.' '[' statements ']' '.' '{' alt '}' . + + $default reduce using rule 185 (alt) diff --git a/src/parser.y b/src/parser.y index c0b3e8efb..39ef6ae8c 100644 --- a/src/parser.y +++ b/src/parser.y @@ -764,7 +764,8 @@ algebra: algebra_head '{' fn_defs '}' \begin{lstlisting} automatic_specifier: @enum@ | - @count@ + @count@ | + @enum_graph@ ; \end{lstlisting} The {\tt automatic} keyword specifies the auto generation of the diff --git a/src/position.hh b/src/position.hh new file mode 100644 index 000000000..bf34c1c57 --- /dev/null +++ b/src/position.hh @@ -0,0 +1,11 @@ +// A Bison parser, made by GNU Bison 3.5.1. + +// Starting with Bison 3.2, this file is useless: the structure it +// used to define is now defined in "location.hh". +// +// To get rid of this file: +// 1. add '%require "3.2"' (or newer) to your grammar file +// 2. remove references to this file from your build system +// 3. if you used to include it, include "location.hh" instead. + +#include "location.hh" diff --git a/src/prefix.cc b/src/prefix.cc new file mode 100644 index 000000000..6db7529ca --- /dev/null +++ b/src/prefix.cc @@ -0,0 +1,6 @@ +#include "prefix.hh" + +namespace gapc { +const char prefix[] = "/homes/dtischle/Projekte"; +const char systemsuffix[] = "_linux-gnu"; +} diff --git a/src/signature.cc b/src/signature.cc index ccfc54b22..2d8c521e9 100644 --- a/src/signature.cc +++ b/src/signature.cc @@ -149,10 +149,14 @@ Algebra *Signature::generate(std::string *n, std::string *mode) { return generate_count(n); if (*mode == "enum") return generate_enum(n); + if (*mode == "enum_graph") + return generate_enum_graph(n); return NULL; } + + struct Generate_Stmts { virtual void apply(Fn_Def &fn) const = 0; virtual ~Generate_Stmts() {} @@ -413,6 +417,163 @@ Algebra *Signature::generate_enum(std::string *n) { } + +//------------------------------------------------------------------------------------------------------------ + + +struct Generate_Enum_Graph_Stmts : public Generate_Stmts { + // Used enum logic. Now adjust for graphviz code + // TODO Generate Graphviz code in out.cc? All in one File. Subgraphs +private: + + void apply(std::list &l, Para_Decl::Simple *s, + Statement::Var_Decl *&cur) const { + Statement::Fn_Call *f = new Statement::Fn_Call( + Statement::Fn_Call::STR_APPEND); + f->add_arg(*cur); // prints the ret in out.cc + // std::cout << "Value of the pointer: " << *cur << std::endl; **Helperline, delete + f->add_arg(s->name()); // this print the original char + l.push_back(f); + } + + + void apply(std::list &l, Para_Decl::Multi *m, + Statement::Var_Decl *&cur) const { + Statement::Fn_Call * f = new Statement::Fn_Call( + Statement::Fn_Call::STR_APPEND); + f->add_arg(*cur); + f->add_arg(new Expr::Const("< ")); + f->add_arg(new Expr::Const(2)); + l.push_back(f); + + const std::list &p = m->list(); + std::list::const_iterator j = p.begin(); + if (j != p.end()) { + apply(l, *j, cur); + ++j; + } + for (; j != p.end(); ++j) { + f = new Statement::Fn_Call(Statement::Fn_Call::STR_APPEND); + f->add_arg(*cur); + f->add_arg(new Expr::Const(", ")); + f->add_arg(new Expr::Const(2)); + l.push_back(f); + apply(l, *j, cur); + } + + f = new Statement::Fn_Call(Statement::Fn_Call::STR_APPEND); + f->add_arg(*cur); + f->add_arg(new Expr::Const(" >")); + f->add_arg(new Expr::Const(2)); + l.push_back(f); + } + + + void apply(std::list &l, + const std::list ¶s, + Statement::Var_Decl *&cur) const { + std::list apps; + unsigned int a = 0; + for (std::list::const_iterator i = paras.begin(); + i != paras.end(); ++i) { + if (a > 0 && !(a % 3)) { + std::ostringstream o; + o << "ret_" << a; + Type::External *str = new Type::External("Rope"); + Statement::Var_Decl *t = new Statement::Var_Decl(str, o.str()); + l.push_back(t); + Statement::Fn_Call *f = + new Statement::Fn_Call(Statement::Fn_Call::STR_APPEND); + f->add_arg(*cur); + f->add_arg(*t); + cur = t; + apps.push_front(f); + } + Statement::Fn_Call *f = new Statement::Fn_Call( + Statement::Fn_Call::STR_APPEND); + f->add_arg(*cur); + f->add_arg(new Expr::Const(' ')); + + l.push_back(f); + + Para_Decl::Multi *m = dynamic_cast(*i); + if (m) { + apply(l, m, cur); + } else { + Para_Decl::Simple *s = dynamic_cast(*i); + assert(s); + apply(l, s, cur); + } + a++; + } + l.insert(l.end(), apps.begin(), apps.end()); + } + + +public: + + void apply(Fn_Def &fn) const { + if (fn.is_Choice_Fn()) { + Statement::Return *ret = new Statement::Return(fn.names.front()); + fn.stmts.push_back(ret); + return; + } + Type::External *str = new Type::External("Rope"); + Statement::Var_Decl *ret = new Statement::Var_Decl(str, "ret"); + fn.stmts.push_back(ret); + Statement::Fn_Call *f = new Statement::Fn_Call( + Statement::Fn_Call::STR_APPEND); + f->add_arg(*ret); + + std::string t = " [label=\\\"" + *fn.name + "\\\"]"; // Here should be fn.name the name of the grammaroperations used Also place NodeID here + + + f->add_arg(new Expr::Const(t)); //t represents above line + f->add_arg(new Expr::Const(static_cast(t.size()))); // need the length of all chars for right appending + fn.stmts.push_back(f); + + Statement::Var_Decl *cur = ret; + std::list l; + apply(l, fn.paras, cur); + fn.stmts.insert(fn.stmts.end(), l.begin(), l.end()); + + if (fn.ntparas().size() > 0) { + f = new Statement::Fn_Call(Statement::Fn_Call::STR_APPEND); + f->add_arg(*ret); + f->add_arg(new Expr::Const(';')); + fn.stmts.push_back(f); + std::list lntparas; + apply(lntparas, fn.ntparas(), ret); + fn.stmts.insert(fn.stmts.end(), lntparas.begin(), lntparas.end()); + } + + f = new Statement::Fn_Call(Statement::Fn_Call::STR_APPEND); + f->add_arg(*ret); + f->add_arg(new Expr::Const(' ')); + fn.stmts.push_back(f); + + f = new Statement::Fn_Call(Statement::Fn_Call::STR_APPEND); + f->add_arg(*ret); + f->add_arg(new Expr::Const(')')); // Should close parenthesis at the end of the rope + fn.stmts.push_back(f); + + Statement::Return *r = new Statement::Return(*ret); + fn.stmts.push_back(r); + } +}; + + +Algebra *Signature::generate_enum_graph(std::string *n) { + return generate_algebra(n, Mode::PRETTY, new Type::External("Rope"), + Generate_Enum_Graph_Stmts()); +} + + + + +//------------------------------------------------------------------------------------------------------------ + + struct Generate_Backtrace_Stmts : public Generate_Stmts { Generate_Backtrace_Stmts() : value_type(0), pos_type(0) {} Type::Base *value_type; diff --git a/src/signature.hh b/src/signature.hh index 69b09d731..2e2f1d955 100644 --- a/src/signature.hh +++ b/src/signature.hh @@ -97,6 +97,7 @@ class Signature : public Signature_Base { private: Algebra *generate_count(std::string *n); Algebra *generate_enum(std::string *n); + Algebra *generate_enum_graph(std::string *n); Algebra *generate_algebra( std::string *n, Mode::Type mode_type, Type::Base *answer_type, Type::Base *alph, const Generate_Stmts &generate_stmts); diff --git a/src/stack.hh b/src/stack.hh new file mode 100644 index 000000000..c15d84c73 --- /dev/null +++ b/src/stack.hh @@ -0,0 +1,8 @@ +// A Bison parser, made by GNU Bison 3.5.1. + +// Starting with Bison 3.2, this file is useless: the structure it +// used to define is now defined with the parser itself. +// +// To get rid of this file: +// 1. add '%require "3.2"' (or newer) to your grammar file +// 2. remove references to this file from your build system. diff --git a/src/symbol.cc b/src/symbol.cc index d4defab6b..d27996cd1 100644 --- a/src/symbol.cc +++ b/src/symbol.cc @@ -861,7 +861,7 @@ void Symbol::NT::add_specialised_arguments(Statement::Fn_Call *fn, void Symbol::NT::set_ret_decl_rhs(Code::Mode mode) { ret_decl = new Statement::Var_Decl(data_type_before_eval(), - new std::string("answers")); + new std::string("answer")); //changes all answers in out.cc post_alt_stmts.clear(); assert(datatype); diff --git a/src/version.cc b/src/version.cc new file mode 100644 index 000000000..ec339532a --- /dev/null +++ b/src/version.cc @@ -0,0 +1,5 @@ +#include "version.hh" + +namespace gapc { + const char version_id[] = "2023.07.05"; +} diff --git a/src/version.txt b/src/version.txt new file mode 100644 index 000000000..6af07714a --- /dev/null +++ b/src/version.txt @@ -0,0 +1 @@ +2023.07.05 diff --git a/testdata/grammar/aliglob2.gap b/testdata/grammar/aliglob2.gap index 808027e5d..e21473b14 100644 --- a/testdata/grammar/aliglob2.gap +++ b/testdata/grammar/aliglob2.gap @@ -13,6 +13,7 @@ signature Alignment (alphabet, answer) { algebra count auto count; algebra enum auto enum; +algebra enum_graph auto enum_graph; grammar globsim uses Alignment (axiom=alignment) { tabulated{alignment} @@ -23,4 +24,4 @@ grammar globsim uses Alignment (axiom=alignment) { } -instance enum = globsim(enum); \ No newline at end of file +instance enum_graph = globsim(enum_graph);