From cfd64648d9dd4d2b9741ed7d406fd15c82096700 Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Fri, 7 Feb 2025 00:59:03 -0500 Subject: [PATCH 001/105] Added simple rules for literals based on documentation. Still have to test them and refine further --- lexicalStructure.lex | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lexicalStructure.lex b/lexicalStructure.lex index c41b8ce..706baca 100644 --- a/lexicalStructure.lex +++ b/lexicalStructure.lex @@ -7,6 +7,17 @@ %} %% -//rules +/* rules */ +[0-9]+ {printf( "C_INTEGER: %s (%d)\n", yytext, atoi( yytext ) );} + +"null" {printf( "C_NULL: %s (%d)\n", yytext, atoi( yytext ) );} + +['][.]['] | [']\\[nt'\\]['] {printf( "C_CHARACTER: %s (%d)\n", yytext, atoi( yytext ) );} /*using double \ per documentation to show escaped chars*/ + +"true" {printf( "C_TRUE: %s (%d)\n", yytext, atoi( yytext ) );} + +"false" {printf( "C_FALSE: %s (%d)\n", yytext, atoi( yytext ) );} + +["][.]+["] {printf( "C_STRING: %s (%d)\n", yytext, atoi( yytext ) );} %% -//user code +/* user code */ From 145d3eeb85d874364198fe6af8c01bac2d646ff4 Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Fri, 7 Feb 2025 14:31:10 -0500 Subject: [PATCH 002/105] updated lex file to have working code for all except for chars and strings. Also added the test files for just Int Testing and for testing for all literals (that is still failing for char and strings) --- lexicalStructure.lex | 36 +++++++++++++++++++++++++----------- simpleIntTest.txt | 4 ++++ simpleLiteralTest.a | 11 +++++++++++ 3 files changed, 40 insertions(+), 11 deletions(-) create mode 100644 simpleIntTest.txt create mode 100644 simpleLiteralTest.a diff --git a/lexicalStructure.lex b/lexicalStructure.lex index 706baca..de6d394 100644 --- a/lexicalStructure.lex +++ b/lexicalStructure.lex @@ -1,23 +1,37 @@ -/* Lexical Analysis with Flex (2.6.0) We used some of the code from this manual */ -/* so we placed the citation here. */ -/* definitions */ + /* Lexical Analysis with Flex (2.6.0) We used some of the code from this manual */ + /* so we placed the citation here. */ + /* definitions */ %option noyywrap - %{ - #include - %} +%{ +#include "typedefs.h" +%} +DIGIT [0-9] %% -/* rules */ -[0-9]+ {printf( "C_INTEGER: %s (%d)\n", yytext, atoi( yytext ) );} + /* rules */ +{DIGIT}+ {printf( "C_INTEGER: %s (%d)\n", yytext, atoi( yytext ) );} "null" {printf( "C_NULL: %s (%d)\n", yytext, atoi( yytext ) );} -['][.]['] | [']\\[nt'\\]['] {printf( "C_CHARACTER: %s (%d)\n", yytext, atoi( yytext ) );} /*using double \ per documentation to show escaped chars*/ +"'"[.|\n]"'" {printf( "C_CHARACTER: %s (%d)\n", yytext, atoi( yytext ) );} /*using double \ per documentation to show escaped chars*/ "true" {printf( "C_TRUE: %s (%d)\n", yytext, atoi( yytext ) );} "false" {printf( "C_FALSE: %s (%d)\n", yytext, atoi( yytext ) );} -["][.]+["] {printf( "C_STRING: %s (%d)\n", yytext, atoi( yytext ) );} +"\""[\^{}}\n]*"\"" {printf( "C_STRING: %s (%d)\n", yytext, atoi( yytext ) );} + +.|\n + %% -/* user code */ + /* user code */ + +int main( int argc, char **argv ) +{ + argc--, argv++; /* skip over program name */ + if ( argc > 0 ) + yyin = fopen( argv[0], "r" ); + else + yyin = stdin; + yylex(); +} diff --git a/simpleIntTest.txt b/simpleIntTest.txt new file mode 100644 index 0000000..507ec22 --- /dev/null +++ b/simpleIntTest.txt @@ -0,0 +1,4 @@ +45 +123 +8392 + diff --git a/simpleLiteralTest.a b/simpleLiteralTest.a new file mode 100644 index 0000000..d93c06a --- /dev/null +++ b/simpleLiteralTest.a @@ -0,0 +1,11 @@ +"this is a string" 721398 'g' '/n' +12893 "this is not a string +" +false +nullfalse +"nulltrue +null +'7' +true +'189 + From 78c743736cc5d1a8bf6e76618706e86bf7c0b237 Mon Sep 17 00:00:00 2001 From: Meyer Simon Date: Fri, 7 Feb 2025 14:34:37 -0500 Subject: [PATCH 003/105] Added the keywards and types t#01 --- lex.yy.c | 1870 +++++++++++++++++++++++++++++++++++++ lexer | Bin 0 -> 31224 bytes lexicalStructure | Bin 0 -> 27128 bytes lexicalStructure.lex | 39 +- tests/test_keywards.alpha | 29 + tests/test_types.alpha | 10 + 6 files changed, 1943 insertions(+), 5 deletions(-) create mode 100644 lex.yy.c create mode 100755 lexer create mode 100755 lexicalStructure create mode 100644 tests/test_keywards.alpha create mode 100644 tests/test_types.alpha diff --git a/lex.yy.c b/lex.yy.c new file mode 100644 index 0000000..206d850 --- /dev/null +++ b/lex.yy.c @@ -0,0 +1,1870 @@ + +#line 3 "lex.yy.c" + +#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 16 +#define YY_END_OF_BUFFER 17 +/* 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[81] = + { 0, + 0, 0, 17, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 0, 0, 15, 0, 0, 0, + 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 10, 0, 0, 0, 0, 0, 9, + 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 7, 0, 0, 0, 0, 0, 0, 13, 6, 4, + 3, 0, 0, 0, 2, 0, 14, 12, 5, 0 + } ; + +static const YY_CHAR yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, + 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, 3, 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, 4, 1, 5, 6, + + 7, 8, 9, 10, 11, 1, 1, 12, 1, 13, + 14, 15, 1, 16, 17, 18, 19, 1, 20, 21, + 22, 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, 1, 1, 1, 1 + } ; + +static const YY_CHAR yy_meta[23] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1 + } ; + +static const flex_int16_t yy_base[81] = + { 0, + 0, 0, 88, 89, 73, 17, 76, 12, 66, 17, + 77, 65, 16, 72, 67, 74, 89, 75, 61, 59, + 63, 89, 57, 56, 57, 65, 56, 59, 57, 52, + 51, 59, 58, 59, 56, 43, 50, 47, 52, 46, + 50, 49, 51, 89, 38, 35, 43, 35, 37, 89, + 89, 42, 44, 30, 41, 32, 33, 36, 29, 32, + 89, 27, 22, 19, 32, 21, 16, 89, 89, 89, + 89, 24, 17, 15, 89, 11, 89, 89, 89, 89 + } ; + +static const flex_int16_t yy_def[81] = + { 0, + 80, 1, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 0 + } ; + +static const flex_int16_t yy_nxt[112] = + { 0, + 4, 4, 5, 6, 7, 4, 8, 9, 4, 4, + 10, 4, 4, 4, 4, 11, 12, 13, 4, 14, + 4, 4, 16, 19, 22, 26, 79, 78, 77, 23, + 76, 75, 20, 17, 74, 73, 72, 27, 71, 70, + 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, + 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, + 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, + 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, + 29, 28, 25, 24, 21, 18, 15, 80, 3, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80 + } ; + +static const flex_int16_t yy_chk[112] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 6, 8, 10, 13, 76, 74, 73, 10, + 72, 67, 8, 6, 66, 65, 64, 13, 63, 62, + 60, 59, 58, 57, 56, 55, 54, 53, 52, 49, + 48, 47, 46, 45, 43, 42, 41, 40, 39, 38, + 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, + 27, 26, 25, 24, 23, 21, 20, 19, 18, 16, + 15, 14, 12, 11, 9, 7, 5, 3, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80 + } ; + +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 "lexicalStructure.lex" +/* Lexical Analysis with Flex (2.6.0) We used some of the code from this manual */ +/* so we placed the citation here. */ +/* definitions */ +#line 6 "lexicalStructure.lex" +#include "typedefs.h" +#line 496 "lex.yy.c" +#line 497 "lex.yy.c" + +#define INITIAL 0 + +#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 + + static void yyunput ( int c, char *buf_ptr ); + +#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 \ + 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 10 "lexicalStructure.lex" + + +#line 717 "lex.yy.c" + + 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_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 >= 81 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 89 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + 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: +/* rule 1 can match eol */ +YY_RULE_SETUP +#line 12 "lexicalStructure.lex" + + YY_BREAK +case 2: +YY_RULE_SETUP +#line 13 "lexicalStructure.lex" +{printf("T_INTEGER %s, Token %d\n",yytext, T_INTEGER);} //{return T_INTEGER} + YY_BREAK +case 3: +YY_RULE_SETUP +#line 14 "lexicalStructure.lex" +{printf("T_ADDRESS %s, Token %d\n",yytext, T_ADDRESS);} //{return T_ADDRESS} + YY_BREAK +case 4: +YY_RULE_SETUP +#line 15 "lexicalStructure.lex" +{printf("T_BOOLEAN %s, Token %d\n",yytext, T_BOOLEAN);} //{return T_BOOLEAN} + YY_BREAK +case 5: +YY_RULE_SETUP +#line 16 "lexicalStructure.lex" +{printf("T_CHARACTER %s, Token %d\n",yytext, T_CHARACTER);} //{return T_CHARACTER} + YY_BREAK +case 6: +YY_RULE_SETUP +#line 17 "lexicalStructure.lex" +{printf("T_STRING %s, Token %d\n",yytext, T_STRING);} //{return T_STRING} + YY_BREAK +/* KEYWARDS */ +case 7: +YY_RULE_SETUP +#line 22 "lexicalStructure.lex" +{printf("WHILE %s, Token %d\n",yytext, WHILE);} //{return WHILE} + YY_BREAK +case 8: +YY_RULE_SETUP +#line 23 "lexicalStructure.lex" +{printf("IF %s, Token %d\n",yytext, IF);} //{return IF} + YY_BREAK +case 9: +YY_RULE_SETUP +#line 24 "lexicalStructure.lex" +{printf("THEN %s, Token %d\n",yytext, THEN);} //{return THEN} + YY_BREAK +case 10: +YY_RULE_SETUP +#line 25 "lexicalStructure.lex" +{printf("ELSE %s, Token %d\n",yytext, ELSE);} //{return ELSE} + YY_BREAK +case 11: +YY_RULE_SETUP +#line 26 "lexicalStructure.lex" +{printf("TYPE %s, Token %d\n",yytext, TYPE);} //{return TYPE} + YY_BREAK +case 12: +YY_RULE_SETUP +#line 27 "lexicalStructure.lex" +{printf("FUNCTION %s, Token %d\n",yytext, FUNCTION);} //{return FUNCTION} + YY_BREAK +case 13: +YY_RULE_SETUP +#line 28 "lexicalStructure.lex" +{printf("RETURN %s, Token %d\n",yytext, RETURN);} //{return RETURN} + YY_BREAK +case 14: +YY_RULE_SETUP +#line 29 "lexicalStructure.lex" +{printf("EXTERNAL %s, Token %d\n",yytext, EXTERNAL);} //{return EXTERNAL} + YY_BREAK +case 15: +YY_RULE_SETUP +#line 30 "lexicalStructure.lex" +{printf("AS %s, Token %d\n",yytext, AS);} //{return AS} + YY_BREAK +case 16: +YY_RULE_SETUP +#line 33 "lexicalStructure.lex" +ECHO; + YY_BREAK +#line 856 "lex.yy.c" +case YY_STATE_EOF(INITIAL): + yyterminate(); + + 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_c_buf_p); + 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); + + 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 >= 81 ) + 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 >= 81 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_is_jam = (yy_current_state == 80); + + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_UNPUT + + static void yyunput (int c, char * yy_bp ) +{ + char *yy_cp; + + yy_cp = (yy_c_buf_p); + + /* undo effects of setting up yytext */ + *yy_cp = (yy_hold_char); + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + int number_to_move = (yy_n_chars) + 2; + char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; +} + +#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); + + 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 33 "lexicalStructure.lex" + +int main(int argc, char *argv[]){ + argc--, argv++; + if ( argc > 0 ) + yyin = fopen( argv[0], "r" ); + else + yyin = stdin; + yylex(); +} + diff --git a/lexer b/lexer new file mode 100755 index 0000000000000000000000000000000000000000..26f06a85a656ac0136dac24d6120f67a669e32aa GIT binary patch literal 31224 zcmeHw3v^V~x&NMo1K|-SU_TJxqo_)^DxmPb*m}avv71G%pMyayFf>S631%4R;D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tEA1(3{PjIeO?aUXUj3u&n4URO2(Z z9X{!$Pf2Fs(uyPoFFY)ub$w0prAD-MTOdm5`*E*{`S7J>%+LW1W&8|gh!93~TP z$o$?~4=Ko4Lv4WN@)Ui%xYVtf`c+Ayyy8 zHB?+aT#CZcNX|vevs^5Dby&?VU5Nii4xM*msmHap2=oir6cknGoq{W{Do%79K6KQl z^b4fEqH?=IP#%o+U#4e*n)R*kJsdA_il}{{O4E6gSzn!JDe6=}Nv-;~f&X7Pqg3Tr z=eUZh>wj!xc(9h=11_E6Dt&d%tLRQCpfZx5mA*P}tpSf*ru5ahv7+jn7!V%FhB@4g z1f9VueRb}tXn_Q)@++L88zHANU6oenx{9jyvzA|#p#>50snS>H%!;b(2$jFJ{!d8# zdD5Udw^mf0bCW*#%&NZ&Jo1UMZ|qm)zEz#)1Hyx~{l5pUS>Gx33~F(>6dTz*Ytb*1 z8+}C;UgVzGPAmQ%i+-`xSJeD$E!j|dioR&kSJy>~zThOSL{NH)^D-jl`m1vYMb-Th zg}3_eRjIGqpA|}^q#vmUlWeD?iX20P@>lxmd`eOE{!xXu=Knj3e&Njmsc1H?SIogu z9CjAMf%wR2%Q#O~?boj`b#ABLJF6T+ zkfbvlRem-9 n_61LsU1*5^9seX~t}(HQw8~duX}G4+AAPq#47Vs)lI*_$6O3sM literal 0 HcmV?d00001 diff --git a/lexicalStructure b/lexicalStructure new file mode 100755 index 0000000000000000000000000000000000000000..8817fe4a700f2d81959706bfad8672a168461b04 GIT binary patch literal 27128 zcmeHwdw5jUx%Zk08^R?dAfw?vAX=`GAkd&ihs(gATml5k`C2=fBomTjl8KWUO{@{@ zfMw1uimh7eER&lK@EsZP^nO`a+LOqia299Hb$(eMd$q9b=kA`HiLco zo#%VLKeBjc-nD-3Wv%tD>s~vv*yvrp#OZJ_6>``$j8f&p1>%v6k_s6C@vst>hwt%h z9P5vCKaL5$M-XsDIO(*~T#4s^l3pQ2dZA+k%oJ56BuaYOLfat0QIr*kH0fy+m1#Tu z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w^RT)%T(OowEQmL<~`JFJ?P&jJ`_ zen}ZndMZu-Ujbn%e|NdyjF9>}l%S+;TY8wxf2Ivr`qOMUm6d{-s=gyQ;@czh-z8tT ujRj0+II8?={v8NRm0f6x@2>wPXpyb|s(h6!4cFfE#|4DMD4T*U$^IKH7El-f literal 0 HcmV?d00001 diff --git a/lexicalStructure.lex b/lexicalStructure.lex index c41b8ce..7aabad8 100644 --- a/lexicalStructure.lex +++ b/lexicalStructure.lex @@ -2,11 +2,40 @@ /* so we placed the citation here. */ /* definitions */ %option noyywrap - %{ - #include - %} +%{ +#include "typedefs.h" +%} + %% -//rules + +.|\n +"integer" {printf("T_INTEGER %s, Token %d\n",yytext, T_INTEGER);} //{return T_INTEGER} +"address" {printf("T_ADDRESS %s, Token %d\n",yytext, T_ADDRESS);} //{return T_ADDRESS} +"Boolean" {printf("T_BOOLEAN %s, Token %d\n",yytext, T_BOOLEAN);} //{return T_BOOLEAN} +"character" {printf("T_CHARACTER %s, Token %d\n",yytext, T_CHARACTER);} //{return T_CHARACTER} +"string" {printf("T_STRING %s, Token %d\n",yytext, T_STRING);} //{return T_STRING} + + /* KEYWARDS */ + + +"while" {printf("WHILE %s, Token %d\n",yytext, WHILE);} //{return WHILE} +"if" {printf("IF %s, Token %d\n",yytext, IF);} //{return IF} +"then" {printf("THEN %s, Token %d\n",yytext, THEN);} //{return THEN} +"else" {printf("ELSE %s, Token %d\n",yytext, ELSE);} //{return ELSE} +"type" {printf("TYPE %s, Token %d\n",yytext, TYPE);} //{return TYPE} +"function" {printf("FUNCTION %s, Token %d\n",yytext, FUNCTION);} //{return FUNCTION} +"return" {printf("RETURN %s, Token %d\n",yytext, RETURN);} //{return RETURN} +"external" {printf("EXTERNAL %s, Token %d\n",yytext, EXTERNAL);} //{return EXTERNAL} +"as" {printf("AS %s, Token %d\n",yytext, AS);} //{return AS} + + %% -//user code +int main(int argc, char *argv[]){ + argc--, argv++; + if ( argc > 0 ) + yyin = fopen( argv[0], "r" ); + else + yyin = stdin; + yylex(); +} diff --git a/tests/test_keywards.alpha b/tests/test_keywards.alpha new file mode 100644 index 0000000..ff18168 --- /dev/null +++ b/tests/test_keywards.alpha @@ -0,0 +1,29 @@ +while +While +whiLe +if +IF +If +iF +then +Then +theN +else +eLse +elSe +Else +type +Type +tyPe +function +Function +functioN +return +Return +returN +external +External +exteRnal +as +As +aS diff --git a/tests/test_types.alpha b/tests/test_types.alpha new file mode 100644 index 0000000..4fde8cd --- /dev/null +++ b/tests/test_types.alpha @@ -0,0 +1,10 @@ +integer +Integer +address +Address +Boolean +boolean +character +Character +string +String From db66b040336455d7ebc6cf38b59bee119598facc Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Fri, 7 Feb 2025 15:40:48 -0500 Subject: [PATCH 004/105] got some chars to identify and edited the simple literal test to include more examples -Task01 --- lexicalStructure.lex | 2 +- simpleLiteralTest.a | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lexicalStructure.lex b/lexicalStructure.lex index de6d394..5027607 100644 --- a/lexicalStructure.lex +++ b/lexicalStructure.lex @@ -13,7 +13,7 @@ DIGIT [0-9] "null" {printf( "C_NULL: %s (%d)\n", yytext, atoi( yytext ) );} -"'"[.|\n]"'" {printf( "C_CHARACTER: %s (%d)\n", yytext, atoi( yytext ) );} /*using double \ per documentation to show escaped chars*/ +\'.\'|\'\\[nt]\' {printf( "C_CHARACTER: %s (%d)\n", yytext, atoi( yytext ) );} /*using double \ per documentation to show escaped chars*/ "true" {printf( "C_TRUE: %s (%d)\n", yytext, atoi( yytext ) );} diff --git a/simpleLiteralTest.a b/simpleLiteralTest.a index d93c06a..d33541e 100644 --- a/simpleLiteralTest.a +++ b/simpleLiteralTest.a @@ -8,4 +8,9 @@ null '7' true '189 +'/n' +'/t' +'"' +'/' + From bd8d410c0be8ad69ea0da8182bb373e42ad1f470 Mon Sep 17 00:00:00 2001 From: Annie Date: Fri, 7 Feb 2025 16:30:55 -0500 Subject: [PATCH 005/105] Adding macros and function to detect -tok input --- runner.c | 26 ++++++++++++++++++++++++++ runner.h | 8 ++++++++ 2 files changed, 34 insertions(+) create mode 100644 runner.h diff --git a/runner.c b/runner.c index e69de29..eee0d2b 100644 --- a/runner.c +++ b/runner.c @@ -0,0 +1,26 @@ +#include runner.h + +int main(int argc, char *argv[]) { + char *check_input; + + //check_input can be compared to INVALID_ARG and DIFF_ARG to determine if -tok and holds the generated file name if it is + check_input = is_tok(argc, argv); + + return 0; //not sure what to do yet +} + +char *is_tok(int argc, char *argv[]) { + if (argc == 3 && strcmp("-tok", argv[1])) { + char *input_prog = argv[2]; + int file_len = strlen(input); + //check that input program is a .alpha file + if (strcmp(".alpha", input_prog[file_len - ALPHA_OFFSET]) != 0) { + return INVALID_ARG; + } + char *FILE_tok[file_len - ALPHA_OFFSET + TOK_LEN]; + strncpy(input, FILE_tok, file_len - ALPHA_OFFSET); //copy name of prog before .alpha + strcpy(".tok", FILE_tok[file_len - ALPHA_OFFSET]); //add .tok to end of file name + return FILE_tok; + } + return DIFF_ARG; +} diff --git a/runner.h b/runner.h new file mode 100644 index 0000000..dff315f --- /dev/null +++ b/runner.h @@ -0,0 +1,8 @@ +#define ALPHA_OFFSET 5 +#define TOK_LEN 3 +#define INVALID_ARG "invalid" +#define DIFF_ARG "diff" +#include + +int main(int argc, char* argv); +char *is_tok(int argc, char* argv); From 200307291c827eaa09fcb2aa9ec7e4dd09153122 Mon Sep 17 00:00:00 2001 From: Meyer Simon Date: Fri, 7 Feb 2025 16:48:12 -0500 Subject: [PATCH 006/105] Removed garbage files --- lex.yy.c | 1870 ------------------------------------------------------ lexer | Bin 31224 -> 0 bytes 2 files changed, 1870 deletions(-) delete mode 100644 lex.yy.c delete mode 100755 lexer diff --git a/lex.yy.c b/lex.yy.c deleted file mode 100644 index 206d850..0000000 --- a/lex.yy.c +++ /dev/null @@ -1,1870 +0,0 @@ - -#line 3 "lex.yy.c" - -#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 16 -#define YY_END_OF_BUFFER 17 -/* 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[81] = - { 0, - 0, 0, 17, 1, 1, 1, 1, 1, 1, 1, - 1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 1, 1, 1, 1 - } ; - -static const YY_CHAR yy_meta[23] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1 - } ; - -static const flex_int16_t yy_base[81] = - { 0, - 0, 0, 88, 89, 73, 17, 76, 12, 66, 17, - 77, 65, 16, 72, 67, 74, 89, 75, 61, 59, - 63, 89, 57, 56, 57, 65, 56, 59, 57, 52, - 51, 59, 58, 59, 56, 43, 50, 47, 52, 46, - 50, 49, 51, 89, 38, 35, 43, 35, 37, 89, - 89, 42, 44, 30, 41, 32, 33, 36, 29, 32, - 89, 27, 22, 19, 32, 21, 16, 89, 89, 89, - 89, 24, 17, 15, 89, 11, 89, 89, 89, 89 - } ; - -static const flex_int16_t yy_def[81] = - { 0, - 80, 1, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 0 - } ; - -static const flex_int16_t yy_nxt[112] = - { 0, - 4, 4, 5, 6, 7, 4, 8, 9, 4, 4, - 10, 4, 4, 4, 4, 11, 12, 13, 4, 14, - 4, 4, 16, 19, 22, 26, 79, 78, 77, 23, - 76, 75, 20, 17, 74, 73, 72, 27, 71, 70, - 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, - 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, - 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, - 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, - 29, 28, 25, 24, 21, 18, 15, 80, 3, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80 - } ; - -static const flex_int16_t yy_chk[112] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 6, 8, 10, 13, 76, 74, 73, 10, - 72, 67, 8, 6, 66, 65, 64, 13, 63, 62, - 60, 59, 58, 57, 56, 55, 54, 53, 52, 49, - 48, 47, 46, 45, 43, 42, 41, 40, 39, 38, - 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, - 27, 26, 25, 24, 23, 21, 20, 19, 18, 16, - 15, 14, 12, 11, 9, 7, 5, 3, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80 - } ; - -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 "lexicalStructure.lex" -/* Lexical Analysis with Flex (2.6.0) We used some of the code from this manual */ -/* so we placed the citation here. */ -/* definitions */ -#line 6 "lexicalStructure.lex" -#include "typedefs.h" -#line 496 "lex.yy.c" -#line 497 "lex.yy.c" - -#define INITIAL 0 - -#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 - - static void yyunput ( int c, char *buf_ptr ); - -#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 \ - 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 10 "lexicalStructure.lex" - - -#line 717 "lex.yy.c" - - 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_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 >= 81 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 89 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - 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: -/* rule 1 can match eol */ -YY_RULE_SETUP -#line 12 "lexicalStructure.lex" - - YY_BREAK -case 2: -YY_RULE_SETUP -#line 13 "lexicalStructure.lex" -{printf("T_INTEGER %s, Token %d\n",yytext, T_INTEGER);} //{return T_INTEGER} - YY_BREAK -case 3: -YY_RULE_SETUP -#line 14 "lexicalStructure.lex" -{printf("T_ADDRESS %s, Token %d\n",yytext, T_ADDRESS);} //{return T_ADDRESS} - YY_BREAK -case 4: -YY_RULE_SETUP -#line 15 "lexicalStructure.lex" -{printf("T_BOOLEAN %s, Token %d\n",yytext, T_BOOLEAN);} //{return T_BOOLEAN} - YY_BREAK -case 5: -YY_RULE_SETUP -#line 16 "lexicalStructure.lex" -{printf("T_CHARACTER %s, Token %d\n",yytext, T_CHARACTER);} //{return T_CHARACTER} - YY_BREAK -case 6: -YY_RULE_SETUP -#line 17 "lexicalStructure.lex" -{printf("T_STRING %s, Token %d\n",yytext, T_STRING);} //{return T_STRING} - YY_BREAK -/* KEYWARDS */ -case 7: -YY_RULE_SETUP -#line 22 "lexicalStructure.lex" -{printf("WHILE %s, Token %d\n",yytext, WHILE);} //{return WHILE} - YY_BREAK -case 8: -YY_RULE_SETUP -#line 23 "lexicalStructure.lex" -{printf("IF %s, Token %d\n",yytext, IF);} //{return IF} - YY_BREAK -case 9: -YY_RULE_SETUP -#line 24 "lexicalStructure.lex" -{printf("THEN %s, Token %d\n",yytext, THEN);} //{return THEN} - YY_BREAK -case 10: -YY_RULE_SETUP -#line 25 "lexicalStructure.lex" -{printf("ELSE %s, Token %d\n",yytext, ELSE);} //{return ELSE} - YY_BREAK -case 11: -YY_RULE_SETUP -#line 26 "lexicalStructure.lex" -{printf("TYPE %s, Token %d\n",yytext, TYPE);} //{return TYPE} - YY_BREAK -case 12: -YY_RULE_SETUP -#line 27 "lexicalStructure.lex" -{printf("FUNCTION %s, Token %d\n",yytext, FUNCTION);} //{return FUNCTION} - YY_BREAK -case 13: -YY_RULE_SETUP -#line 28 "lexicalStructure.lex" -{printf("RETURN %s, Token %d\n",yytext, RETURN);} //{return RETURN} - YY_BREAK -case 14: -YY_RULE_SETUP -#line 29 "lexicalStructure.lex" -{printf("EXTERNAL %s, Token %d\n",yytext, EXTERNAL);} //{return EXTERNAL} - YY_BREAK -case 15: -YY_RULE_SETUP -#line 30 "lexicalStructure.lex" -{printf("AS %s, Token %d\n",yytext, AS);} //{return AS} - YY_BREAK -case 16: -YY_RULE_SETUP -#line 33 "lexicalStructure.lex" -ECHO; - YY_BREAK -#line 856 "lex.yy.c" -case YY_STATE_EOF(INITIAL): - yyterminate(); - - 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_c_buf_p); - 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); - - 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 >= 81 ) - 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 >= 81 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - yy_is_jam = (yy_current_state == 80); - - return yy_is_jam ? 0 : yy_current_state; -} - -#ifndef YY_NO_UNPUT - - static void yyunput (int c, char * yy_bp ) -{ - char *yy_cp; - - yy_cp = (yy_c_buf_p); - - /* undo effects of setting up yytext */ - *yy_cp = (yy_hold_char); - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - int number_to_move = (yy_n_chars) + 2; - char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; -} - -#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); - - 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 33 "lexicalStructure.lex" - -int main(int argc, char *argv[]){ - argc--, argv++; - if ( argc > 0 ) - yyin = fopen( argv[0], "r" ); - else - yyin = stdin; - yylex(); -} - diff --git a/lexer b/lexer deleted file mode 100755 index 26f06a85a656ac0136dac24d6120f67a669e32aa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 31224 zcmeHw3v^V~x&NMo1K|-SU_TJxqo_)^DxmPb*m}avv71G%pMyayFf>S631%4R;DP#pK6aUAs z(X2Ppy*N+E3k88xgi~qBG(+;!K}j!%A}Q!d!Dfo85)vi7?m}xnAyJfNi8SeH6qRW! zy>gtuDXQc~euYAAR7|Ez?1HbTS&w`(@eU!MSeH!COTTQF^;detCcOfwS0MEiWl~R3 zUFq;9V;!84Xvok?-uBh zU;f&lnt6rHue)}z_D`8Tn_62_K6Coi+R7=lHTA*uQ`Q&EoHBEIZlf=E8ZQEs%ZU&5 zsYT05sX1DSr z_EeLr^bkY{!~J2~wdp=BYb^0{@EL*6#8D57JmGz#uBz0N^-uRcxnWjkWaN8o$CXQf zxHNnZEIH(pgf-pp-|B`><#OU<4KI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}tXn_Q)@++L88zHANU6oenx{9jyvzA|#p#>50snS>H%!;b(2$jFJ{!d8# zdD5Udw^mf0bCW*#%&NZ&Jo1UMZ|qm)zEz#)1Hyx~{l5pUS>Gx33~F(>6dTz*Ytb*1 z8+}C;UgVzGPAmQ%i+-`xSJeD$E!j|dioR&kSJy>~zThOSL{NH)^D-jl`m1vYMb-Th zg}3_eRjIGqpA|}^q#vmUlWeD?iX20P@>lxmd`eOE{!xXu=Knj3e&Njmsc1H?SIogu z9CjAMf%wR2%Q#O~?boj`b#ABLJF6T+ zkfbvlRem-9 n_61LsU1*5^9seX~t}(HQw8~duX}G4+AAPq#47Vs)lI*_$6O3sM From 6c3951b6ab098ab3ec4a68b695302aeff3901f9a Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Fri, 7 Feb 2025 18:59:45 -0500 Subject: [PATCH 007/105] character identifier seems to work. Still working on strings. Updated tests to include more. Task01 --- lexicalStructure.lex | 7 ++++--- simpleLiteralTest.a | 12 ++++++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lexicalStructure.lex b/lexicalStructure.lex index 5027607..d2b3bcf 100644 --- a/lexicalStructure.lex +++ b/lexicalStructure.lex @@ -1,4 +1,3 @@ - /* Lexical Analysis with Flex (2.6.0) We used some of the code from this manual */ /* so we placed the citation here. */ /* definitions */ %option noyywrap @@ -7,19 +6,21 @@ %} DIGIT [0-9] +CHAR \\\\n|\\\\t|\\\'|[^'\\\n\t] +STRINGVAL CHAR | " " %% /* rules */ {DIGIT}+ {printf( "C_INTEGER: %s (%d)\n", yytext, atoi( yytext ) );} "null" {printf( "C_NULL: %s (%d)\n", yytext, atoi( yytext ) );} -\'.\'|\'\\[nt]\' {printf( "C_CHARACTER: %s (%d)\n", yytext, atoi( yytext ) );} /*using double \ per documentation to show escaped chars*/ +'{CHAR}' {printf( "C_CHARACTER: %s (%d)\n", yytext, atoi( yytext ) );} /*using double \ per documentation to show escaped chars*/ "true" {printf( "C_TRUE: %s (%d)\n", yytext, atoi( yytext ) );} "false" {printf( "C_FALSE: %s (%d)\n", yytext, atoi( yytext ) );} -"\""[\^{}}\n]*"\"" {printf( "C_STRING: %s (%d)\n", yytext, atoi( yytext ) );} +"{STRINGVAL}+" {printf( "C_STRING: %s (%d)\n", yytext, atoi( yytext ) );} .|\n diff --git a/simpleLiteralTest.a b/simpleLiteralTest.a index d33541e..e74e4ee 100644 --- a/simpleLiteralTest.a +++ b/simpleLiteralTest.a @@ -1,16 +1,24 @@ "this is a string" 721398 'g' '/n' 12893 "this is not a string " +''' +'\' false +''' nullfalse "nulltrue null '7' true '189 -'/n' -'/t' +'\t' '"' '/' +'\n' +'\'' +'\t' +'\\' +'\' +''' From f0f96dec8d13e4f835ef7e2c667bca12b3064572 Mon Sep 17 00:00:00 2001 From: Annie Date: Mon, 10 Feb 2025 11:05:30 -0500 Subject: [PATCH 008/105] moved runner.h contents to runner.c --- runner.c | 10 +++++++++- runner.h | 8 -------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/runner.c b/runner.c index eee0d2b..af078f9 100644 --- a/runner.c +++ b/runner.c @@ -1,4 +1,12 @@ -#include runner.h +#define ALPHA_OFFSET 5 +#define TOK_LEN 3 +#define INVALID_ARG "invalid" +#define DIFF_ARG "diff" +#include + +int main(int argc, char* argv); +char *is_tok(int argc, char* argv); + int main(int argc, char *argv[]) { char *check_input; diff --git a/runner.h b/runner.h index dff315f..e69de29 100644 --- a/runner.h +++ b/runner.h @@ -1,8 +0,0 @@ -#define ALPHA_OFFSET 5 -#define TOK_LEN 3 -#define INVALID_ARG "invalid" -#define DIFF_ARG "diff" -#include - -int main(int argc, char* argv); -char *is_tok(int argc, char* argv); From 232ad5c9ae70dcfa88be47e4f0dde0f778fa6006 Mon Sep 17 00:00:00 2001 From: Scarlett Date: Mon, 10 Feb 2025 12:26:23 -0500 Subject: [PATCH 009/105] Branch Initialize --- Makefile | 33 +++++++++++++----------- lexicalStructure.lex | 42 ++++++++++++++++++------------- tests/test_constants_literals.txt | 23 +++++++++++++++++ tests/test_variables.txt | 0 4 files changed, 67 insertions(+), 31 deletions(-) create mode 100644 tests/test_constants_literals.txt create mode 100644 tests/test_variables.txt diff --git a/Makefile b/Makefile index a9544ee..5044506 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,19 @@ -# Basic Makefile example from flex documentation -- provides explicit rules -# Creates "myprogram" from "scan.l" and "myprogram.c" -# -#LEX=flex -#myprogram: scan.o myprogram.o - #$(CC) -o $@ $(LDFLAGS) $^ -#myprogram.o: myprogram.c - #$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $^ -#scan.o: scan.c - #$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $^ -#scan.c: scan.l - #$(LEX) $(LFLAGS) -o $@ $^ -#clean: - #$(RM) *.o scan.c +CC := gcc +FLEX := flex +LEX := lexicalStructure.lex +EXE := lexicalStructure + +lexicalStructure: + $(FLEX) $(LEX) + $(CC) lex.yy.c -o $(EXE) + +test: + ./$(EXE) ./tests/test_constants_literals.txt + ./$(EXE) ./tests/test_keywards.alpha + ./$(EXE) ./tests/test_types.alpha + ./$(EXE) ./tests/test_variables.txt + +clean: + rm -f *.o + rm -f lex.yy.c + rm -f $(EXE) \ No newline at end of file diff --git a/lexicalStructure.lex b/lexicalStructure.lex index 7aabad8..bf444a4 100644 --- a/lexicalStructure.lex +++ b/lexicalStructure.lex @@ -6,31 +6,39 @@ #include "typedefs.h" %} +DIGIT [0-9] +CHAR \\\\n|\\\\t|\\\'|[^'\\\n\t] +STRINGVAL CHAR | " " %% +{DIGIT}+ {printf( "C_INTEGER: %s (%d)\n", yytext, atoi( yytext ) );} +"null" {printf( "C_NULL: %s (%d)\n", yytext, atoi( yytext ) );} +'{CHAR}' {printf( "C_CHARACTER: %s (%d)\n", yytext, atoi( yytext ) );} /*using double \ per documentation to show escaped chars*/ +"true" {printf( "C_TRUE: %s (%d)\n", yytext, atoi( yytext ) );} +"false" {printf( "C_FALSE: %s (%d)\n", yytext, atoi( yytext ) );} +"{STRINGVAL}+" {printf( "C_STRING: %s (%d)\n", yytext, atoi( yytext ) );} + .|\n -"integer" {printf("T_INTEGER %s, Token %d\n",yytext, T_INTEGER);} //{return T_INTEGER} -"address" {printf("T_ADDRESS %s, Token %d\n",yytext, T_ADDRESS);} //{return T_ADDRESS} -"Boolean" {printf("T_BOOLEAN %s, Token %d\n",yytext, T_BOOLEAN);} //{return T_BOOLEAN} -"character" {printf("T_CHARACTER %s, Token %d\n",yytext, T_CHARACTER);} //{return T_CHARACTER} -"string" {printf("T_STRING %s, Token %d\n",yytext, T_STRING);} //{return T_STRING} +"integer" {printf("T_INTEGER %s, Token %d\n",yytext, T_INTEGER);} // {return T_INTEGER} +"address" {printf("T_ADDRESS %s, Token %d\n",yytext, T_ADDRESS);} // {return T_ADDRESS} +"Boolean" {printf("T_BOOLEAN %s, Token %d\n",yytext, T_BOOLEAN);} // {return T_BOOLEAN} +"character" {printf("T_CHARACTER %s, Token %d\n",yytext, T_CHARACTER);} // {return T_CHARACTER} +"string" {printf("T_STRING %s, Token %d\n",yytext, T_STRING);} // {return T_STRING} /* KEYWARDS */ - - -"while" {printf("WHILE %s, Token %d\n",yytext, WHILE);} //{return WHILE} -"if" {printf("IF %s, Token %d\n",yytext, IF);} //{return IF} -"then" {printf("THEN %s, Token %d\n",yytext, THEN);} //{return THEN} -"else" {printf("ELSE %s, Token %d\n",yytext, ELSE);} //{return ELSE} -"type" {printf("TYPE %s, Token %d\n",yytext, TYPE);} //{return TYPE} -"function" {printf("FUNCTION %s, Token %d\n",yytext, FUNCTION);} //{return FUNCTION} -"return" {printf("RETURN %s, Token %d\n",yytext, RETURN);} //{return RETURN} -"external" {printf("EXTERNAL %s, Token %d\n",yytext, EXTERNAL);} //{return EXTERNAL} -"as" {printf("AS %s, Token %d\n",yytext, AS);} //{return AS} - +"while" {printf("WHILE %s, Token %d\n",yytext, WHILE);} // {return WHILE} +"if" {printf("IF %s, Token %d\n",yytext, IF);} // {return IF} +"then" {printf("THEN %s, Token %d\n",yytext, THEN);} // {return THEN} +"else" {printf("ELSE %s, Token %d\n",yytext, ELSE);} // {return ELSE} +"type" {printf("TYPE %s, Token %d\n",yytext, TYPE);} // {return TYPE} +"function" {printf("FUNCTION %s, Token %d\n",yytext, FUNCTION);} // {return FUNCTION} +"return" {printf("RETURN %s, Token %d\n",yytext, RETURN);} // {return RETURN} +"external" {printf("EXTERNAL %s, Token %d\n",yytext, EXTERNAL);} // {return EXTERNAL} +"as" {printf("AS %s, Token %d\n",yytext, AS);} // {return AS} %% + int main(int argc, char *argv[]){ argc--, argv++; if ( argc > 0 ) diff --git a/tests/test_constants_literals.txt b/tests/test_constants_literals.txt new file mode 100644 index 0000000..fa713c4 --- /dev/null +++ b/tests/test_constants_literals.txt @@ -0,0 +1,23 @@ +This is a test +9combined 7okens +12345 +893247892 +combined'DueToUnknownChar _validtoken __validtoken1 _valid_token2 validToken3_ +true false +null while !wrong if when +else type function +return external as +string _NOte_that_was_not_reserved +([)]{}:;,->"\ ++-*/% +<= +:= +"This is not a valid +String" +"This is a valid String" +!| +.. +(* this is a comment *) +(*Not a comment +$^& +> \ No newline at end of file diff --git a/tests/test_variables.txt b/tests/test_variables.txt new file mode 100644 index 0000000..e69de29 From 1701904c08dde7e41f79622017bd1922794a8c49 Mon Sep 17 00:00:00 2001 From: Meyer Simon Date: Mon, 10 Feb 2025 12:54:08 -0500 Subject: [PATCH 010/105] Fixed some of the spacing in the lexer for debugging t#07 --- lexicalStructure.lex | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lexicalStructure.lex b/lexicalStructure.lex index 7aabad8..5426637 100644 --- a/lexicalStructure.lex +++ b/lexicalStructure.lex @@ -19,15 +19,15 @@ /* KEYWARDS */ -"while" {printf("WHILE %s, Token %d\n",yytext, WHILE);} //{return WHILE} -"if" {printf("IF %s, Token %d\n",yytext, IF);} //{return IF} -"then" {printf("THEN %s, Token %d\n",yytext, THEN);} //{return THEN} -"else" {printf("ELSE %s, Token %d\n",yytext, ELSE);} //{return ELSE} -"type" {printf("TYPE %s, Token %d\n",yytext, TYPE);} //{return TYPE} -"function" {printf("FUNCTION %s, Token %d\n",yytext, FUNCTION);} //{return FUNCTION} -"return" {printf("RETURN %s, Token %d\n",yytext, RETURN);} //{return RETURN} -"external" {printf("EXTERNAL %s, Token %d\n",yytext, EXTERNAL);} //{return EXTERNAL} -"as" {printf("AS %s, Token %d\n",yytext, AS);} //{return AS} +"while" {printf("WHILE %s, Token %d\n",yytext, WHILE);} //{return WHILE} +"if" {printf("IF %s, Token %d\n",yytext, IF);} //{return IF} +"then" {printf("THEN %s, Token %d\n",yytext, THEN);} //{return THEN} +"else" {printf("ELSE %s, Token %d\n",yytext, ELSE);} //{return ELSE} +"type" {printf("TYPE %s, Token %d\n",yytext, TYPE);} //{return TYPE} +"function" {printf("FUNCTION %s, Token %d\n",yytext, FUNCTION);} //{return FUNCTION} +"return" {printf("RETURN %s, Token %d\n",yytext, RETURN);} //{return RETURN} +"external" {printf("EXTERNAL %s, Token %d\n",yytext, EXTERNAL);} //{return EXTERNAL} +"as" {printf("AS %s, Token %d\n",yytext, AS);} //{return AS} %% From f4a86f0de7751949e401cf8246d245a64da3cb85 Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Mon, 10 Feb 2025 13:12:46 -0500 Subject: [PATCH 011/105] finished string and char updates and testing updates task 03 --- lexicalStructure.lex | 7 ++++--- simpleLiteralTest.a | 19 +++++++++++++++++-- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/lexicalStructure.lex b/lexicalStructure.lex index d2b3bcf..f5315a1 100644 --- a/lexicalStructure.lex +++ b/lexicalStructure.lex @@ -6,8 +6,9 @@ %} DIGIT [0-9] -CHAR \\\\n|\\\\t|\\\'|[^'\\\n\t] -STRINGVAL CHAR | " " +CHAR \\n|\\t|\\'|[^'\n\t\\] +SCHAR \\n|\\t|\\\"|[^\"\n\\] + %% /* rules */ {DIGIT}+ {printf( "C_INTEGER: %s (%d)\n", yytext, atoi( yytext ) );} @@ -20,7 +21,7 @@ STRINGVAL CHAR | " " "false" {printf( "C_FALSE: %s (%d)\n", yytext, atoi( yytext ) );} -"{STRINGVAL}+" {printf( "C_STRING: %s (%d)\n", yytext, atoi( yytext ) );} +\"{SCHAR}+\" {printf( "C_STRING: %s (%d)\n", yytext, atoi( yytext ) );} .|\n diff --git a/simpleLiteralTest.a b/simpleLiteralTest.a index e74e4ee..e85644b 100644 --- a/simpleLiteralTest.a +++ b/simpleLiteralTest.a @@ -18,7 +18,22 @@ true '\'' '\t' '\\' - +'n' '\' - +'fdsf' +' +' +' ' ''' +"STRINGwithnotSPaces" +' ' +'\ ' +"J" +"" +" " +\"\" +"{SCHAR}" +"SCHAR" +"[SCHAR]" +"FINAL: I'd think this is a legal \"string\" that contains \n \t several escaped characters, isn't it?" +"I'd think this is a legal \"string\" that contains several \\n \t escaped characters, isn't it?" From a1c7aaadb1942ebf2c60433c9ba3b4431e152e27 Mon Sep 17 00:00:00 2001 From: Annie Date: Mon, 10 Feb 2025 13:22:01 -0500 Subject: [PATCH 012/105] Added code to print to file with -tok input and created header file --- runner.c | 24 ++++++++++++++---------- runner.h | 13 +++++++++++++ 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/runner.c b/runner.c index af078f9..3d467b8 100644 --- a/runner.c +++ b/runner.c @@ -1,20 +1,24 @@ -#define ALPHA_OFFSET 5 -#define TOK_LEN 3 -#define INVALID_ARG "invalid" -#define DIFF_ARG "diff" -#include - -int main(int argc, char* argv); -char *is_tok(int argc, char* argv); +#include "runner.h" int main(int argc, char *argv[]) { char *check_input; - + int token; //check_input can be compared to INVALID_ARG and DIFF_ARG to determine if -tok and holds the generated file name if it is check_input = is_tok(argc, argv); + FILE * output = fopen(check_input, "w"); - return 0; //not sure what to do yet + if (check_input == INVALID_ARG) { + return -1; + } + + while (0 != (token = yylex())) { + if (check_input != DIFF_ARG) { + fprintf(output, "%d %d %3d \"%s\"\n", line_number, column_number, token, yytext); + } + } + + return 0; } char *is_tok(int argc, char *argv[]) { diff --git a/runner.h b/runner.h index e69de29..080d5c1 100644 --- a/runner.h +++ b/runner.h @@ -0,0 +1,13 @@ +#define ALPHA_OFFSET 5 +#define TOK_LEN 3 +#define INVALID_ARG "invalid" +#define DIFF_ARG "diff" +#include +#include +#include "lex.yy.c" + +extern int line_number, column_number; +extern char *yytext; + +int main(int argc, char* argv); +char *is_tok(int argc, char* argv);#define ALPHA_OFFSET 5 From 375743441746a7527f4edd8fbb0d5091a7a87da2 Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Mon, 10 Feb 2025 23:41:37 -0500 Subject: [PATCH 013/105] added comment functionality for lexer, expanded tests, and updated to identify empty strings --- lexicalStructure.lex | 13 ++++++++++--- simpleLiteralTest.a | 11 +++++++++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/lexicalStructure.lex b/lexicalStructure.lex index f5315a1..1e2b52c 100644 --- a/lexicalStructure.lex +++ b/lexicalStructure.lex @@ -7,8 +7,13 @@ DIGIT [0-9] CHAR \\n|\\t|\\'|[^'\n\t\\] -SCHAR \\n|\\t|\\\"|[^\"\n\\] - + /* char can be a newline, tab, an escaped quote, or anything but a single quote, an actual line break, an actual tab, or a backslash by itself (to prevent confusion from escaped quote */ +SCHAR \\n|\\t|\\\"|[^\"\n\\] + /*similar to above, a string Char (SCHAR) is the same as a CHAR except we cannot have double quotes instead of single quotes. Double quotes need to be escaped in Flex unlike single quotes based on documentation */ +STARTCOM \(\* +ENDCOM \*\) +COMMENTCHAR [^\*]|\*[^\)] + /*Making the contents of a comment anything that is either not a * or not a * followed by ) to terminate comments at the first ENDCOM */ %% /* rules */ {DIGIT}+ {printf( "C_INTEGER: %s (%d)\n", yytext, atoi( yytext ) );} @@ -21,7 +26,9 @@ SCHAR \\n|\\t|\\\"|[^\"\n\\] "false" {printf( "C_FALSE: %s (%d)\n", yytext, atoi( yytext ) );} -\"{SCHAR}+\" {printf( "C_STRING: %s (%d)\n", yytext, atoi( yytext ) );} +\"{SCHAR}*\" {printf( "C_STRING: %s (%d)\n", yytext, atoi( yytext ) );} + +{STARTCOM}{COMMENTCHAR}*{ENDCOM} {printf( "COMMENT: %s (%d)\n", yytext, atoi( yytext ) );} .|\n diff --git a/simpleLiteralTest.a b/simpleLiteralTest.a index e85644b..f97cf52 100644 --- a/simpleLiteralTest.a +++ b/simpleLiteralTest.a @@ -1,9 +1,15 @@ -"this is a string" 721398 'g' '/n' -12893 "this is not a string +"this is a string" 721398 'g' '/n' (* should print 3 tokens before this *) +' +' +12893 "this is not a string (*one valid token before this*) +(* spacey comment here +over multiple lines +will it work? *) " ''' '\' false +(**) ''' nullfalse "nulltrue @@ -21,6 +27,7 @@ true 'n' '\' 'fdsf' +(*/jnewjno2893u86^ Lots of random characters /n /t '") *) ' ' ' ' From 9091b65a30d592cb966c076594b6ae4382c769cb Mon Sep 17 00:00:00 2001 From: Scarlett Date: Tue, 11 Feb 2025 14:21:22 -0500 Subject: [PATCH 014/105] Added comments, began work on ID --- Makefile | 8 +++- lexicalStructure.lex | 55 +++++++++++++---------- tests/test_constants_literals.txt | 73 +++++++++++++++++++++---------- tests/test_variables.txt | 10 +++++ 4 files changed, 98 insertions(+), 48 deletions(-) diff --git a/Makefile b/Makefile index 5044506..ec333dc 100644 --- a/Makefile +++ b/Makefile @@ -7,10 +7,16 @@ lexicalStructure: $(FLEX) $(LEX) $(CC) lex.yy.c -o $(EXE) -test: +test1: ./$(EXE) ./tests/test_constants_literals.txt + +test2: ./$(EXE) ./tests/test_keywards.alpha + +test3: ./$(EXE) ./tests/test_types.alpha + +test4: ./$(EXE) ./tests/test_variables.txt clean: diff --git a/lexicalStructure.lex b/lexicalStructure.lex index bf444a4..2a0245c 100644 --- a/lexicalStructure.lex +++ b/lexicalStructure.lex @@ -7,35 +7,42 @@ %} DIGIT [0-9] -CHAR \\\\n|\\\\t|\\\'|[^'\\\n\t] -STRINGVAL CHAR | " " +CHAR \\n|\\t|\\'|[^'\n\t\\] +SCHAR \\n|\\t|\\\"|[^\"\n\\] +COM ([^*]|\*+[^)*])* + +/* INCOMPLETE */ +ID [A-Za-z_][0-9A-Za-z_]* %% -{DIGIT}+ {printf( "C_INTEGER: %s (%d)\n", yytext, atoi( yytext ) );} -"null" {printf( "C_NULL: %s (%d)\n", yytext, atoi( yytext ) );} -'{CHAR}' {printf( "C_CHARACTER: %s (%d)\n", yytext, atoi( yytext ) );} /*using double \ per documentation to show escaped chars*/ -"true" {printf( "C_TRUE: %s (%d)\n", yytext, atoi( yytext ) );} -"false" {printf( "C_FALSE: %s (%d)\n", yytext, atoi( yytext ) );} -"{STRINGVAL}+" {printf( "C_STRING: %s (%d)\n", yytext, atoi( yytext ) );} +"(*"{COM}"*)" {printf("COMMENT: %s, Token: %d\n", yytext, COMMENT );} // {return COMMENT} +"integer" {printf("T_INTEGER %s, Token: %d\n", yytext, T_INTEGER);} // {return T_INTEGER} +"address" {printf("T_ADDRESS %s, Token: %d\n", yytext, T_ADDRESS);} // {return T_ADDRESS} +"Boolean" {printf("T_BOOLEAN %s, Token: %d\n", yytext, T_BOOLEAN);} // {return T_BOOLEAN} +"character" {printf("T_CHARACTER %s, Token: %d\n", yytext, T_CHARACTER);} // {return T_CHARACTER} +"string" {printf("T_STRING %s, Token: %d\n", yytext, T_STRING);} // {return T_STRING} + +"while" {printf("WHILE %s, Token: %d\n", yytext, WHILE);} // {return WHILE} +"if" {printf("IF %s, Token: %d\n", yytext, IF);} // {return IF} +"then" {printf("THEN %s, Token: %d\n", yytext, THEN);} // {return THEN} +"else" {printf("ELSE %s, Token: %d\n", yytext, ELSE);} // {return ELSE} +"type" {printf("TYPE %s, Token: %d\n", yytext, TYPE);} // {return TYPE} +"function" {printf("FUNCTION %s, Token: %d\n", yytext, FUNCTION);} // {return FUNCTION} +"return" {printf("RETURN %s, Token: %d\n", yytext, RETURN);} // {return RETURN} +"external" {printf("EXTERNAL %s, Token: %d\n", yytext, EXTERNAL);} // {return EXTERNAL} +"as" {printf("AS %s, Token: %d\n", yytext, AS);} // {return AS} + +{ID} {printf("ID: %s, Token: %d\n", yytext, ID );} // INCOMPLETE + +{DIGIT}+ {printf("C_INTEGER: %s, Token: %d\n", yytext, atoi( yytext ) );} +"null" {printf("C_NULL: %s, Token: %d\n", yytext, atoi( yytext ) );} +'{CHAR}' {printf("C_CHARACTER: %s, Token: %d\n", yytext, atoi( yytext ) );} +"true" {printf("C_TRUE: %s, Token: %d\n", yytext, atoi( yytext ) );} +"false" {printf("C_FALSE: %s, Token: %d\n", yytext, atoi( yytext ) );} +\"{SCHAR}*\" {printf("C_STRING: %s, Token: %d\n", yytext, atoi( yytext ) );} .|\n -"integer" {printf("T_INTEGER %s, Token %d\n",yytext, T_INTEGER);} // {return T_INTEGER} -"address" {printf("T_ADDRESS %s, Token %d\n",yytext, T_ADDRESS);} // {return T_ADDRESS} -"Boolean" {printf("T_BOOLEAN %s, Token %d\n",yytext, T_BOOLEAN);} // {return T_BOOLEAN} -"character" {printf("T_CHARACTER %s, Token %d\n",yytext, T_CHARACTER);} // {return T_CHARACTER} -"string" {printf("T_STRING %s, Token %d\n",yytext, T_STRING);} // {return T_STRING} - - /* KEYWARDS */ -"while" {printf("WHILE %s, Token %d\n",yytext, WHILE);} // {return WHILE} -"if" {printf("IF %s, Token %d\n",yytext, IF);} // {return IF} -"then" {printf("THEN %s, Token %d\n",yytext, THEN);} // {return THEN} -"else" {printf("ELSE %s, Token %d\n",yytext, ELSE);} // {return ELSE} -"type" {printf("TYPE %s, Token %d\n",yytext, TYPE);} // {return TYPE} -"function" {printf("FUNCTION %s, Token %d\n",yytext, FUNCTION);} // {return FUNCTION} -"return" {printf("RETURN %s, Token %d\n",yytext, RETURN);} // {return RETURN} -"external" {printf("EXTERNAL %s, Token %d\n",yytext, EXTERNAL);} // {return EXTERNAL} -"as" {printf("AS %s, Token %d\n",yytext, AS);} // {return AS} %% diff --git a/tests/test_constants_literals.txt b/tests/test_constants_literals.txt index fa713c4..fa47647 100644 --- a/tests/test_constants_literals.txt +++ b/tests/test_constants_literals.txt @@ -1,23 +1,50 @@ -This is a test -9combined 7okens -12345 -893247892 -combined'DueToUnknownChar _validtoken __validtoken1 _valid_token2 validToken3_ -true false -null while !wrong if when -else type function -return external as -string _NOte_that_was_not_reserved -([)]{}:;,->"\ -+-*/% -<= -:= -"This is not a valid -String" -"This is a valid String" -!| -.. -(* this is a comment *) -(*Not a comment -$^& -> \ No newline at end of file + +''' +'\' +false +''' +nullfalse +"nulltrue +null +'7' +true +'189 +'\t' +'"' +'/' +'\n' +'\'' +'\t' +'\\' +'n' +'\' +'fdsf' +' +' +' ' +''' +"STRINGwithnotSPaces" +' ' +'\ ' + +"J" +"" +" " +\"\" +"this is a string" 721398 'g' '/n' +12893 "this is not a string +"{SCHAR}" +"SCHAR" +"[SCHAR]" +"I'd think this is a legal \"string\" that contains \n \t several escaped characters, isn't it?" +"I'd think this is a legal \"string\" that contains several \\n \\t escaped characters, isn't it?" + +(* hello *) +(* hello *) +(* I'd think this is a legal "string" that contains several \n \t +escaped characters, isn't it? *) +(* \ *) +(* *) +(*{COMMENT}+ *) +(* * *) +(* (hello) *) \ No newline at end of file diff --git a/tests/test_variables.txt b/tests/test_variables.txt index e69de29..26db6c0 100644 --- a/tests/test_variables.txt +++ b/tests/test_variables.txt @@ -0,0 +1,10 @@ +valid1 +Valid2 +_valid3 +_valid_name_4 +VALID +0Invalid +1invalid +"invalid +invalid= +String \ No newline at end of file From e3e55f49f878e4911971c134989a248d2ed4b041 Mon Sep 17 00:00:00 2001 From: Annie Date: Tue, 11 Feb 2025 14:23:28 -0500 Subject: [PATCH 015/105] added function to tokenize operators --- lexicalStructure.lex | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/lexicalStructure.lex b/lexicalStructure.lex index 5426637..66904a8 100644 --- a/lexicalStructure.lex +++ b/lexicalStructure.lex @@ -1,4 +1,4 @@ -/* Lexical Analysis with Flex (2.6.0) We used some of the code from this manual */ +/* Lexical Analysis with Flex (1.6.0) We used some of the code from this manual */ /* so we placed the citation here. */ /* definitions */ %option noyywrap @@ -27,10 +27,25 @@ "function" {printf("FUNCTION %s, Token %d\n",yytext, FUNCTION);} //{return FUNCTION} "return" {printf("RETURN %s, Token %d\n",yytext, RETURN);} //{return RETURN} "external" {printf("EXTERNAL %s, Token %d\n",yytext, EXTERNAL);} //{return EXTERNAL} -"as" {printf("AS %s, Token %d\n",yytext, AS);} //{return AS} +"as" {printf("AS %s, Token %d\n",yytext, AS);} //{return AS}//% + /* OPERATORS */ + +\+ {printf("ADD %s, Token %d\n",yytext, ADD);} //return ADD +\- {printf("SUB_OR_NEG %s, Token %d\n",yytext, SUB_OR_NEG);} //return SUB_OR_NEG +\* {printf("MUL %s, Token %d\n",yytext, MUL);} //return MUL +\/ {printf("DIV %s, Token %d\n",yytext, DIV);} //return DIV +\% {printf("REM %s, Token %d\n",yytext, REM);} //return REM +\< {printf("LESS_THAN %s, Token %d\n",yytext, LESS_THAN);} //return LESS_THAN += {printf("EQUAL_TO %s, Token %d\n",yytext, EQUAL_TO);} //return EQUAL_TO +:= {printf("ASSIGN %s, Token %d\n",yytext, ASSIGN);} //return ASSIGN +! {printf("NOT %s, Token %d\n",yytext, NOT);} //return NOT +& {printf("AND %s, Token %d\n",yytext, AND);} //return AND +\| {printf("OR %s, Token %d\n",yytext, OR);} //return OR +\. {printf("DOT %s, Token %d\n",yytext, DOT);} //return DOT + + -%% int main(int argc, char *argv[]){ argc--, argv++; if ( argc > 0 ) From 488f61e889edaf68e231afe6ef2eabdb4b2e6f6e Mon Sep 17 00:00:00 2001 From: Annie Date: Tue, 11 Feb 2025 15:05:58 -0500 Subject: [PATCH 016/105] added tokenization for reserve and release --- lexicalStructure.lex | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lexicalStructure.lex b/lexicalStructure.lex index 66904a8..bf04b31 100644 --- a/lexicalStructure.lex +++ b/lexicalStructure.lex @@ -43,6 +43,8 @@ & {printf("AND %s, Token %d\n",yytext, AND);} //return AND \| {printf("OR %s, Token %d\n",yytext, OR);} //return OR \. {printf("DOT %s, Token %d\n",yytext, DOT);} //return DOT +"reserve" {printf("RESERVE %s, Token %d\n",yytext, RESERVE);} //return RESERVE +"release" {printf("RELEASE %s, Token %d\n",yytext, RELEASE);} //return RELEASE From 9c67da034853d878db6be4ae0ad9a9cce199b22e Mon Sep 17 00:00:00 2001 From: Scarlett Date: Tue, 11 Feb 2025 15:32:31 -0500 Subject: [PATCH 017/105] Added other punctuation --- Makefile | 3 +++ lexicalStructure | Bin 27128 -> 0 bytes lexicalStructure.lex | 10 +++++++--- test1.txt | 24 ------------------------ tests/test_keywards.alpha | 1 + tests/test_otherpunc.txt | 6 ++++++ 6 files changed, 17 insertions(+), 27 deletions(-) delete mode 100755 lexicalStructure delete mode 100644 test1.txt create mode 100644 tests/test_otherpunc.txt diff --git a/Makefile b/Makefile index ec333dc..57c29a6 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,9 @@ test3: test4: ./$(EXE) ./tests/test_variables.txt +test5: + ./$(EXE) ./tests/test_otherpunc.txt + clean: rm -f *.o rm -f lex.yy.c diff --git a/lexicalStructure b/lexicalStructure deleted file mode 100755 index 8817fe4a700f2d81959706bfad8672a168461b04..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 27128 zcmeHwdw5jUx%Zk08^R?dAfw?vAX=`GAkd&ihs(gATml5k`C2=fBomTjl8KWUO{@{@ zfMw1uimh7eER&lK@EsZP^nO`a+LOqia299Hb$(eMd$q9b=kA`HiLco zo#%VLKeBjc-nD-3Wv%tD>s~vv*yvrp#OZJ_6>``$j8f&p1>%v6k_s6C@vst>hwt%h z9P5vCKaL5$M-XsDIO(*~T#4s^l3pQ2dZA+k%oJ56BuaYOLfat0QIr*kH0fy+m1#Tu z^#mcOsNx&>c?936m`p!BMBs{=^~g7qR|x*(8?E%L^viZxf2Bt->6J*m5~-&slX{9O zf09q=QzGrz=}hn_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Um6d{-s=gyQ;@czh-z8tT ujRj0+II8?={v8NRm0f6x@2>wPXpyb|s(h6!4cFfE#|4DMD4T*U$^IKH7El-f diff --git a/lexicalStructure.lex b/lexicalStructure.lex index 2a0245c..64ce9b2 100644 --- a/lexicalStructure.lex +++ b/lexicalStructure.lex @@ -10,8 +10,6 @@ DIGIT [0-9] CHAR \\n|\\t|\\'|[^'\n\t\\] SCHAR \\n|\\t|\\\"|[^\"\n\\] COM ([^*]|\*+[^)*])* - -/* INCOMPLETE */ ID [A-Za-z_][0-9A-Za-z_]* %% @@ -34,7 +32,10 @@ ID [A-Za-z_][0-9A-Za-z_]* "external" {printf("EXTERNAL %s, Token: %d\n", yytext, EXTERNAL);} // {return EXTERNAL} "as" {printf("AS %s, Token: %d\n", yytext, AS);} // {return AS} -{ID} {printf("ID: %s, Token: %d\n", yytext, ID );} // INCOMPLETE +";" {printf("SEMI_COLON %s, Token: %d\n", yytext, SEMI_COLON);} +":" {printf("COLON %s, Token: %d\n", yytext, COLON);} +"," {printf("COMMA %s, Token: %d\n", yytext, COMMA);} +"->" {printf("ARROW %s, Token: %d\n", yytext, ARROW);} {DIGIT}+ {printf("C_INTEGER: %s, Token: %d\n", yytext, atoi( yytext ) );} "null" {printf("C_NULL: %s, Token: %d\n", yytext, atoi( yytext ) );} @@ -42,6 +43,9 @@ ID [A-Za-z_][0-9A-Za-z_]* "true" {printf("C_TRUE: %s, Token: %d\n", yytext, atoi( yytext ) );} "false" {printf("C_FALSE: %s, Token: %d\n", yytext, atoi( yytext ) );} \"{SCHAR}*\" {printf("C_STRING: %s, Token: %d\n", yytext, atoi( yytext ) );} + +{ID} {printf("ID: %s, Token: %d\n", yytext, ID);} + .|\n %% diff --git a/test1.txt b/test1.txt deleted file mode 100644 index defc56b..0000000 --- a/test1.txt +++ /dev/null @@ -1,24 +0,0 @@ -This is a test -9combined 7okens -12345 -893247892 -combined'DueToUnknownChar _validtoken __validtoken1 _valid_token2 validToken3_ -true false -null while !wrong if when -else type function -return external as -string _NOte_that_was_not_reserved -([)]{}:;,->"\ -+-*/% -<= -:= -"This is not a valid -String" -"This is a valid String" -!| -.. -(* this is a comment *) -(*Not a comment -$^& -> - diff --git a/tests/test_keywards.alpha b/tests/test_keywards.alpha index ff18168..ebd52ee 100644 --- a/tests/test_keywards.alpha +++ b/tests/test_keywards.alpha @@ -27,3 +27,4 @@ exteRnal as As aS +functionaly \ No newline at end of file diff --git a/tests/test_otherpunc.txt b/tests/test_otherpunc.txt new file mode 100644 index 0000000..bd1f2de --- /dev/null +++ b/tests/test_otherpunc.txt @@ -0,0 +1,6 @@ +; +: +, +-> +->> +--> \ No newline at end of file From 8e9ef7a4a5d2fa92c9d0936eab1dd17551bb6f17 Mon Sep 17 00:00:00 2001 From: Annie Date: Tue, 11 Feb 2025 16:01:43 -0500 Subject: [PATCH 018/105] added test for operators and removed extra line from .lex file to fix tokenization --- lexicalStructure.lex | 29 ++++++++++++++--------------- tests/test_operators.alpha | 23 +++++++++++++++++++++++ 2 files changed, 37 insertions(+), 15 deletions(-) create mode 100644 tests/test_operators.alpha diff --git a/lexicalStructure.lex b/lexicalStructure.lex index bf04b31..3b88c9b 100644 --- a/lexicalStructure.lex +++ b/lexicalStructure.lex @@ -9,7 +9,6 @@ %% -.|\n "integer" {printf("T_INTEGER %s, Token %d\n",yytext, T_INTEGER);} //{return T_INTEGER} "address" {printf("T_ADDRESS %s, Token %d\n",yytext, T_ADDRESS);} //{return T_ADDRESS} "Boolean" {printf("T_BOOLEAN %s, Token %d\n",yytext, T_BOOLEAN);} //{return T_BOOLEAN} @@ -27,25 +26,25 @@ "function" {printf("FUNCTION %s, Token %d\n",yytext, FUNCTION);} //{return FUNCTION} "return" {printf("RETURN %s, Token %d\n",yytext, RETURN);} //{return RETURN} "external" {printf("EXTERNAL %s, Token %d\n",yytext, EXTERNAL);} //{return EXTERNAL} -"as" {printf("AS %s, Token %d\n",yytext, AS);} //{return AS}//% +"as" {printf("AS %s, Token %d\n",yytext, AS);} //{return AS}// /* OPERATORS */ -\+ {printf("ADD %s, Token %d\n",yytext, ADD);} //return ADD -\- {printf("SUB_OR_NEG %s, Token %d\n",yytext, SUB_OR_NEG);} //return SUB_OR_NEG -\* {printf("MUL %s, Token %d\n",yytext, MUL);} //return MUL -\/ {printf("DIV %s, Token %d\n",yytext, DIV);} //return DIV -\% {printf("REM %s, Token %d\n",yytext, REM);} //return REM -\< {printf("LESS_THAN %s, Token %d\n",yytext, LESS_THAN);} //return LESS_THAN -= {printf("EQUAL_TO %s, Token %d\n",yytext, EQUAL_TO);} //return EQUAL_TO -:= {printf("ASSIGN %s, Token %d\n",yytext, ASSIGN);} //return ASSIGN -! {printf("NOT %s, Token %d\n",yytext, NOT);} //return NOT -& {printf("AND %s, Token %d\n",yytext, AND);} //return AND -\| {printf("OR %s, Token %d\n",yytext, OR);} //return OR -\. {printf("DOT %s, Token %d\n",yytext, DOT);} //return DOT +"+" {printf("ADD %s, Token %d\n",yytext, ADD);} //return ADD +"-" {printf("SUB_OR_NEG %s, Token %d\n",yytext, SUB_OR_NEG);} //return SUB_OR_NEG +"*" {printf("MUL %s, Token %d\n",yytext, MUL);} //return MUL +"/" {printf("DIV %s, Token %d\n",yytext, DIV);} //return DIV +"%" {printf("REM %s, Token %d\n",yytext, REM);} //return REM +"<" {printf("LESS_THAN %s, Token %d\n",yytext, LESS_THAN);} //return LESS_THAN +"=" {printf("EQUAL_TO %s, Token %d\n",yytext, EQUAL_TO);} //return EQUAL_TO +":=" {printf("ASSIGN %s, Token %d\n",yytext, ASSIGN);} //return ASSIGN +"!" {printf("NOT %s, Token %d\n",yytext, NOT);} //return NOT +"&" {printf("AND %s, Token %d\n",yytext, AND);} //return AND +"|" {printf("OR %s, Token %d\n",yytext, OR);} //return OR +"." {printf("DOT %s, Token %d\n",yytext, DOT);} //return DOT "reserve" {printf("RESERVE %s, Token %d\n",yytext, RESERVE);} //return RESERVE "release" {printf("RELEASE %s, Token %d\n",yytext, RELEASE);} //return RELEASE - +%% int main(int argc, char *argv[]){ diff --git a/tests/test_operators.alpha b/tests/test_operators.alpha new file mode 100644 index 0000000..b985387 --- /dev/null +++ b/tests/test_operators.alpha @@ -0,0 +1,23 @@ ++ +- +* +/ +\ +% +< +> += +:= +=: +: += +! +& +| +. +relEASE +release +RELEASE +reserve +RESERVE +reSERVe \ No newline at end of file From a7fa7bb6695ec1e730331ff3e4f556545a6251ae Mon Sep 17 00:00:00 2001 From: Annie Date: Tue, 11 Feb 2025 16:09:57 -0500 Subject: [PATCH 019/105] removed print statements from .lex file and added test_operators to Makefile --- Makefile | 30 ++++++++++++++++-------------- lexicalStructure.lex | 28 ++++++++++++++-------------- 2 files changed, 30 insertions(+), 28 deletions(-) diff --git a/Makefile b/Makefile index a9544ee..3a7cffc 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,16 @@ -# Basic Makefile example from flex documentation -- provides explicit rules -# Creates "myprogram" from "scan.l" and "myprogram.c" -# -#LEX=flex -#myprogram: scan.o myprogram.o - #$(CC) -o $@ $(LDFLAGS) $^ -#myprogram.o: myprogram.c - #$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $^ -#scan.o: scan.c - #$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $^ -#scan.c: scan.l - #$(LEX) $(LFLAGS) -o $@ $^ -#clean: - #$(RM) *.o scan.c +CC := gcc +FLEX := flex +LEX := lexicalStructure.lex +EXE := lexicalStructure + +lexicalStructure: + $(FLEX) $(LEX) + $(CC) lex.yy.c -o $(EXE) + +test_operators: + ./$(EXE) ./tests/test_operators.alpha + +clean: + rm -f *.o + rm -f lex.yy.c + rm -f $(EXE) diff --git a/lexicalStructure.lex b/lexicalStructure.lex index 3b88c9b..66ea37e 100644 --- a/lexicalStructure.lex +++ b/lexicalStructure.lex @@ -30,20 +30,20 @@ /* OPERATORS */ -"+" {printf("ADD %s, Token %d\n",yytext, ADD);} //return ADD -"-" {printf("SUB_OR_NEG %s, Token %d\n",yytext, SUB_OR_NEG);} //return SUB_OR_NEG -"*" {printf("MUL %s, Token %d\n",yytext, MUL);} //return MUL -"/" {printf("DIV %s, Token %d\n",yytext, DIV);} //return DIV -"%" {printf("REM %s, Token %d\n",yytext, REM);} //return REM -"<" {printf("LESS_THAN %s, Token %d\n",yytext, LESS_THAN);} //return LESS_THAN -"=" {printf("EQUAL_TO %s, Token %d\n",yytext, EQUAL_TO);} //return EQUAL_TO -":=" {printf("ASSIGN %s, Token %d\n",yytext, ASSIGN);} //return ASSIGN -"!" {printf("NOT %s, Token %d\n",yytext, NOT);} //return NOT -"&" {printf("AND %s, Token %d\n",yytext, AND);} //return AND -"|" {printf("OR %s, Token %d\n",yytext, OR);} //return OR -"." {printf("DOT %s, Token %d\n",yytext, DOT);} //return DOT -"reserve" {printf("RESERVE %s, Token %d\n",yytext, RESERVE);} //return RESERVE -"release" {printf("RELEASE %s, Token %d\n",yytext, RELEASE);} //return RELEASE +"+" {return ADD;} +"-" {return SUB_OR_NEG;} +"*" {return MUL;} +"/" {return DIV;} +"%" {return REM;} +"<" {return LESS_THAN;} +"=" {return EQUAL_TO;} +":=" {return ASSIGN;} +"!" {return NOT;} +"&" {return AND;} +"|" {return OR;} +"." {return DOT;} +"reserve" {return RESERVE;} +"release" {return RELEASE;} %% From bfa79fe7bed483ccee7498e13a7c48830dd859a6 Mon Sep 17 00:00:00 2001 From: Meyer Simon Date: Tue, 11 Feb 2025 16:26:30 -0500 Subject: [PATCH 020/105] finished my assignment and added the line number and column number functionality to my file. t#07 --- lex.yy.c | 1870 ------------------------------------------ lexer | Bin 31224 -> 0 bytes lexicalStructure | Bin 27128 -> 0 bytes lexicalStructure.lex | 42 +- 4 files changed, 18 insertions(+), 1894 deletions(-) delete mode 100644 lex.yy.c delete mode 100755 lexer delete mode 100755 lexicalStructure diff --git a/lex.yy.c b/lex.yy.c deleted file mode 100644 index 206d850..0000000 --- a/lex.yy.c +++ /dev/null @@ -1,1870 +0,0 @@ - -#line 3 "lex.yy.c" - -#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 16 -#define YY_END_OF_BUFFER 17 -/* 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[81] = - { 0, - 0, 0,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1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static const YY_CHAR yy_meta[23] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1 - } ; - -static const flex_int16_t yy_base[81] = - { 0, - 0, 0, 88, 89, 73, 17, 76, 12, 66, 17, - 77, 65, 16, 72, 67, 74, 89, 75, 61, 59, - 63, 89, 57, 56, 57, 65, 56, 59, 57, 52, - 51, 59, 58, 59, 56, 43, 50, 47, 52, 46, - 50, 49, 51, 89, 38, 35, 43, 35, 37, 89, - 89, 42, 44, 30, 41, 32, 33, 36, 29, 32, - 89, 27, 22, 19, 32, 21, 16, 89, 89, 89, - 89, 24, 17, 15, 89, 11, 89, 89, 89, 89 - } ; - -static const flex_int16_t yy_def[81] = - { 0, - 80, 1, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 0 - } ; - -static const flex_int16_t yy_nxt[112] = - { 0, - 4, 4, 5, 6, 7, 4, 8, 9, 4, 4, - 10, 4, 4, 4, 4, 11, 12, 13, 4, 14, - 4, 4, 16, 19, 22, 26, 79, 78, 77, 23, - 76, 75, 20, 17, 74, 73, 72, 27, 71, 70, - 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, - 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, - 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, - 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, - 29, 28, 25, 24, 21, 18, 15, 80, 3, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80 - } ; - -static const flex_int16_t yy_chk[112] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 6, 8, 10, 13, 76, 74, 73, 10, - 72, 67, 8, 6, 66, 65, 64, 13, 63, 62, - 60, 59, 58, 57, 56, 55, 54, 53, 52, 49, - 48, 47, 46, 45, 43, 42, 41, 40, 39, 38, - 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, - 27, 26, 25, 24, 23, 21, 20, 19, 18, 16, - 15, 14, 12, 11, 9, 7, 5, 3, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80 - } ; - -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 "lexicalStructure.lex" -/* Lexical Analysis with Flex (2.6.0) We used some of the code from this manual */ -/* so we placed the citation here. */ -/* definitions */ -#line 6 "lexicalStructure.lex" -#include "typedefs.h" -#line 496 "lex.yy.c" -#line 497 "lex.yy.c" - -#define INITIAL 0 - -#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 - - static void yyunput ( int c, char *buf_ptr ); - -#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 \ - 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 10 "lexicalStructure.lex" - - -#line 717 "lex.yy.c" - - 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_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 >= 81 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 89 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - 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: -/* rule 1 can match eol */ -YY_RULE_SETUP -#line 12 "lexicalStructure.lex" - - YY_BREAK -case 2: -YY_RULE_SETUP -#line 13 "lexicalStructure.lex" -{printf("T_INTEGER %s, Token %d\n",yytext, T_INTEGER);} //{return T_INTEGER} - YY_BREAK -case 3: -YY_RULE_SETUP -#line 14 "lexicalStructure.lex" -{printf("T_ADDRESS %s, Token %d\n",yytext, T_ADDRESS);} //{return T_ADDRESS} - YY_BREAK -case 4: -YY_RULE_SETUP -#line 15 "lexicalStructure.lex" -{printf("T_BOOLEAN %s, Token %d\n",yytext, T_BOOLEAN);} //{return T_BOOLEAN} - YY_BREAK -case 5: -YY_RULE_SETUP -#line 16 "lexicalStructure.lex" -{printf("T_CHARACTER %s, Token %d\n",yytext, T_CHARACTER);} //{return T_CHARACTER} - YY_BREAK -case 6: -YY_RULE_SETUP -#line 17 "lexicalStructure.lex" -{printf("T_STRING %s, Token %d\n",yytext, T_STRING);} //{return T_STRING} - YY_BREAK -/* KEYWARDS */ -case 7: -YY_RULE_SETUP -#line 22 "lexicalStructure.lex" -{printf("WHILE %s, Token %d\n",yytext, WHILE);} //{return WHILE} - YY_BREAK -case 8: -YY_RULE_SETUP -#line 23 "lexicalStructure.lex" -{printf("IF %s, Token %d\n",yytext, IF);} //{return IF} - YY_BREAK -case 9: -YY_RULE_SETUP -#line 24 "lexicalStructure.lex" -{printf("THEN %s, Token %d\n",yytext, THEN);} //{return THEN} - YY_BREAK -case 10: -YY_RULE_SETUP -#line 25 "lexicalStructure.lex" -{printf("ELSE %s, Token %d\n",yytext, ELSE);} //{return ELSE} - YY_BREAK -case 11: -YY_RULE_SETUP -#line 26 "lexicalStructure.lex" -{printf("TYPE %s, Token %d\n",yytext, TYPE);} //{return TYPE} - YY_BREAK -case 12: -YY_RULE_SETUP -#line 27 "lexicalStructure.lex" -{printf("FUNCTION %s, Token %d\n",yytext, FUNCTION);} //{return FUNCTION} - YY_BREAK -case 13: -YY_RULE_SETUP -#line 28 "lexicalStructure.lex" -{printf("RETURN %s, Token %d\n",yytext, RETURN);} //{return RETURN} - YY_BREAK -case 14: -YY_RULE_SETUP -#line 29 "lexicalStructure.lex" -{printf("EXTERNAL %s, Token %d\n",yytext, EXTERNAL);} //{return EXTERNAL} - YY_BREAK -case 15: -YY_RULE_SETUP -#line 30 "lexicalStructure.lex" -{printf("AS %s, Token %d\n",yytext, AS);} //{return AS} - YY_BREAK -case 16: -YY_RULE_SETUP -#line 33 "lexicalStructure.lex" -ECHO; - YY_BREAK -#line 856 "lex.yy.c" -case YY_STATE_EOF(INITIAL): - yyterminate(); - - 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_c_buf_p); - 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); - - 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 >= 81 ) - 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 >= 81 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - yy_is_jam = (yy_current_state == 80); - - return yy_is_jam ? 0 : yy_current_state; -} - -#ifndef YY_NO_UNPUT - - static void yyunput (int c, char * yy_bp ) -{ - char *yy_cp; - - yy_cp = (yy_c_buf_p); - - /* undo effects of setting up yytext */ - *yy_cp = (yy_hold_char); - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - int number_to_move = (yy_n_chars) + 2; - char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; -} - -#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); - - 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 33 "lexicalStructure.lex" - -int main(int argc, char *argv[]){ - argc--, argv++; - if ( argc > 0 ) - yyin = fopen( argv[0], "r" ); - else - yyin = stdin; - yylex(); -} - diff --git a/lexer b/lexer deleted file mode 100755 index 26f06a85a656ac0136dac24d6120f67a669e32aa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 31224 zcmeHw3v^V~x&NMo1K|-SU_TJxqo_)^DxmPb*m}avv71G%pMyayFf>S631%4R;DP#pK6aUAs z(X2Ppy*N+E3k88xgi~qBG(+;!K}j!%A}Q!d!Dfo85)vi7?m}xnAyJfNi8SeH6qRW! zy>gtuDXQc~euYAAR7|Ez?1HbTS&w`(@eU!MSeH!COTTQF^;detCcOfwS0MEiWl~R3 zUFq;9V;!84Xvok?-uBh zU;f&lnt6rHue)}z_D`8Tn_62_K6Coi+R7=lHTA*uQ`Q&EoHBEIZlf=E8ZQEs%ZU&5 zsYT05sX1DSr z_EeLr^bkY{!~J2~wdp=BYb^0{@EL*6#8D57JmGz#uBz0N^-uRcxnWjkWaN8o$CXQf z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ru5ahv7+jn7!V%FhB@4g z1f9VueRb}tXn_Q)@++L88zHANU6oenx{9jyvzA|#p#>50snS>H%!;b(2$jFJ{!d8# zdD5Udw^mf0bCW*#%&NZ&Jo1UMZ|qm)zEz#)1Hyx~{l5pUS>Gx33~F(>6dTz*Ytb*1 z8+}C;UgVzGPAmQ%i+-`xSJeD$E!j|dioR&kSJy>~zThOSL{NH)^D-jl`m1vYMb-Th zg}3_eRjIGqpA|}^q#vmUlWeD?iX20P@>lxmd`eOE{!xXu=Knj3e&Njmsc1H?SIogu z9CjAMf%wR2%Q#O~?boj`b#ABLJF6T+ zkfbvlRem-9 n_61LsU1*5^9seX~t}(HQw8~duX}G4+AAPq#47Vs)lI*_$6O3sM diff --git a/lexicalStructure b/lexicalStructure deleted file mode 100755 index 8817fe4a700f2d81959706bfad8672a168461b04..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 27128 zcmeHwdw5jUx%Zk08^R?dAfw?vAX=`GAkd&ihs(gATml5k`C2=fBomTjl8KWUO{@{@ zfMw1uimh7eER&lK@EsZP^nO`a+LOqia299Hb$(eMd$q9b=kA`HiLco zo#%VLKeBjc-nD-3Wv%tD>s~vv*yvrp#OZJ_6>``$j8f&p1>%v6k_s6C@vst>hwt%h z9P5vCKaL5$M-XsDIO(*~T#4s^l3pQ2dZA+k%oJ56BuaYOLfat0QIr*kH0fy+m1#Tu z^#mcOsNx&>c?936m`p!BMBs{=^~g7qR|x*(8?E%L^viZxf2Bt->6J*m5~-&slX{9O zf09q=QzGrz=}hn_C~DWMk$QHzSg0{YDGv&3--}fJJ^7U?y(Pj>l( z^2^^ER5P!U`DJSdd;gT#vn%RqE9TC=qONL2U2Q|Oc}8=|+!=Fc7d3^7X7M6Wx!m|r zpIW+d9W_TAVX8Tun?zdKBi;zfC;2O{-}ub5M=rmA(kH|Ja@KS1m2bUxQ7y?(xk-m) zD3CqX$Xl4TS@7doa4MG@AA5KKKyUWDvfxLu;E!g(Z_k3?ody4H7J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L3T6Gbb@qMw_gd|^)P|x>8N2Yaf91O6{zy2`z-wze#3yt7-2+|9ikn(nTB7upK)fp; zCT|Miaw91kpL)WQH49dF{oa*}>H68l|FCkwie-xcGD+z7cBR$ zTC!xVx6EI*VBvDFpX@aWuSP=B&A`Gz;eNVa)}!uxrHfv_bVaSf#f`A`TV)L%X|}Xb zwegPNg4gMaYi%ux;{I9-ByOm+KqzUT%7XA~a4m>GScO+eC<(5|a_Q%yL(;sHw~s88wCcHGzgITxzWD z4z}5%2E;|f8_1n$>LY;)&`4O&8WrQO zLmOF9Lnsm~+RzX!Y7FDf=rAsG&OjB>THGLCTP2|d3zyBH6^D!01e$7C5nenZ3qd1c z!NL2>Cb}n@i^+r^yl}8CKngO}SQlYMdKN^5UUU48Y(VdilT5dl8eyttO(0qJytWZsQzDkkA^OmdOT~3KsSj|P*k0F z3RK9dIMGY-8Gw({FOm9+%IyG&@?fn0GL2ssTJ-Jz@4+M~r-<4Isx+M^ne$iYS&F)q zprm&FZvy`_&L~y+)j6)B>iHkr7#{594*(sEkJ4A?yo&CW3@Rh}S?R0u-dbSfGNrH1 zjTKer#1P?uY?#B%NYELq(pTrMik3)WRemL>=pEqGnXXE!b6rJM``OE{%CHR)@~P5S z=gf+#=LnU*z5YLz`U|B&b#ASwI_D;R@|j)#QDEc~W#8DZ%6%*KZ*#D>|HELK_1#j> zpf-m~wvo*fHhquW=qsw^RT)%T(OowEQmL<~`JFJ?P&jJ`_ zen}ZndMZu-Ujbn%e|NdyjF9>}l%S+;TY8wxf2Ivr`qOMUm6d{-s=gyQ;@czh-z8tT ujRj0+II8?={v8NRm0f6x@2>wPXpyb|s(h6!4cFfE#|4DMD4T*U$^IKH7El-f diff --git a/lexicalStructure.lex b/lexicalStructure.lex index 7aabad8..2fb6388 100644 --- a/lexicalStructure.lex +++ b/lexicalStructure.lex @@ -5,37 +5,31 @@ %{ #include "typedefs.h" %} - + int line_number = 1, column_number = 1; %% -.|\n -"integer" {printf("T_INTEGER %s, Token %d\n",yytext, T_INTEGER);} //{return T_INTEGER} -"address" {printf("T_ADDRESS %s, Token %d\n",yytext, T_ADDRESS);} //{return T_ADDRESS} -"Boolean" {printf("T_BOOLEAN %s, Token %d\n",yytext, T_BOOLEAN);} //{return T_BOOLEAN} -"character" {printf("T_CHARACTER %s, Token %d\n",yytext, T_CHARACTER);} //{return T_CHARACTER} -"string" {printf("T_STRING %s, Token %d\n",yytext, T_STRING);} //{return T_STRING} +\n line_number++ column_number = 1; +. column_number++; + +"integer" {return T_INTEGER} +"address" {return T_ADDRESS} +"Boolean" {return T_BOOLEAN} +"character" {return T_CHARACTER} +"string" {return T_STRING} /* KEYWARDS */ -"while" {printf("WHILE %s, Token %d\n",yytext, WHILE);} //{return WHILE} -"if" {printf("IF %s, Token %d\n",yytext, IF);} //{return IF} -"then" {printf("THEN %s, Token %d\n",yytext, THEN);} //{return THEN} -"else" {printf("ELSE %s, Token %d\n",yytext, ELSE);} //{return ELSE} -"type" {printf("TYPE %s, Token %d\n",yytext, TYPE);} //{return TYPE} -"function" {printf("FUNCTION %s, Token %d\n",yytext, FUNCTION);} //{return FUNCTION} -"return" {printf("RETURN %s, Token %d\n",yytext, RETURN);} //{return RETURN} -"external" {printf("EXTERNAL %s, Token %d\n",yytext, EXTERNAL);} //{return EXTERNAL} -"as" {printf("AS %s, Token %d\n",yytext, AS);} //{return AS} +"while" {return WHILE} +"if" {return IF} +"then" {return THEN} +"else" {return ELSE} +"type" {return TYPE} +"function" {return FUNCTION} +"return" {return RETURN} +"external" {return EXTERNAL} +"as" {return AS} %% -int main(int argc, char *argv[]){ - argc--, argv++; - if ( argc > 0 ) - yyin = fopen( argv[0], "r" ); - else - yyin = stdin; - yylex(); -} From 5abc36c00c4f47712b104ed610b8fecd19424f57 Mon Sep 17 00:00:00 2001 From: Meyer Simon Date: Tue, 11 Feb 2025 16:30:25 -0500 Subject: [PATCH 021/105] Carl told me that we will be treating string as an ID so I removed it. t#07 --- lexicalStructure.lex | 1 - 1 file changed, 1 deletion(-) diff --git a/lexicalStructure.lex b/lexicalStructure.lex index 2fb6388..f31ebfd 100644 --- a/lexicalStructure.lex +++ b/lexicalStructure.lex @@ -16,7 +16,6 @@ "address" {return T_ADDRESS} "Boolean" {return T_BOOLEAN} "character" {return T_CHARACTER} -"string" {return T_STRING} /* KEYWARDS */ From 466f111c873d9cfada444555849f46017a7f8dd4 Mon Sep 17 00:00:00 2001 From: Scarlett Date: Tue, 11 Feb 2025 17:15:54 -0500 Subject: [PATCH 022/105] Added return statements t#04 --- Makefile | 9 +- lex.yy.c | 1787 +++++++++++++++++ lexicalStructure | Bin 0 -> 22584 bytes lexicalStructure.lex | 42 +- tests/test_comments.alpha | 9 + tests/test_constants_literals.txt | 50 - tests/test_keywards.alpha | 30 - ...est_otherpunc.txt => test_otherpunc.alpha} | 0 tests/test_types.alpha | 10 - ...est_variables.txt => test_variables.alpha} | 0 10 files changed, 1809 insertions(+), 128 deletions(-) create mode 100644 lex.yy.c create mode 100755 lexicalStructure create mode 100644 tests/test_comments.alpha delete mode 100644 tests/test_constants_literals.txt delete mode 100644 tests/test_keywards.alpha rename tests/{test_otherpunc.txt => test_otherpunc.alpha} (100%) delete mode 100644 tests/test_types.alpha rename tests/{test_variables.txt => test_variables.alpha} (100%) diff --git a/Makefile b/Makefile index 57c29a6..cbb491a 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ lexicalStructure: $(CC) lex.yy.c -o $(EXE) test1: - ./$(EXE) ./tests/test_constants_literals.txt + ./$(EXE) ./tests/test_constants_literals.alpha test2: ./$(EXE) ./tests/test_keywards.alpha @@ -17,10 +17,13 @@ test3: ./$(EXE) ./tests/test_types.alpha test4: - ./$(EXE) ./tests/test_variables.txt + ./$(EXE) ./tests/test_variables.alpha test5: - ./$(EXE) ./tests/test_otherpunc.txt + ./$(EXE) ./tests/test_otherpunc.alpha + +test6: + ./$(EXE) ./tests/test_comments.alpha clean: rm -f *.o diff --git a/lex.yy.c b/lex.yy.c new file mode 100644 index 0000000..502a056 --- /dev/null +++ b/lex.yy.c @@ -0,0 +1,1787 @@ + +#line 2 "lex.yy.c" + +#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 7 +#define YY_END_OF_BUFFER 8 +/* 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[19] = + { 0, + 0, 0, 8, 7, 7, 4, 7, 3, 2, 6, + 0, 5, 6, 0, 0, 1, 0, 0 + } ; + +static const YY_CHAR yy_ec[256] = + { 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, 2, + 3, 4, 1, 5, 6, 1, 1, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 8, 9, 1, + 1, 10, 1, 1, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 1, 1, 1, 1, 11, 1, 11, 11, 11, 11, + + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 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, 1, 1, 1 + } ; + +static const YY_CHAR yy_meta[12] = + { 0, + 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, + 2 + } ; + +static const flex_int16_t yy_base[21] = + { 0, + 0, 0, 23, 24, 18, 24, 11, 24, 24, 0, + 16, 24, 0, 15, 9, 24, 11, 24, 16, 15 + } ; + +static const flex_int16_t yy_def[21] = + { 0, + 18, 1, 18, 18, 18, 18, 18, 18, 18, 19, + 20, 18, 19, 20, 20, 18, 20, 0, 18, 18 + } ; + +static const flex_int16_t yy_nxt[36] = + { 0, + 4, 5, 4, 4, 6, 7, 4, 8, 9, 4, + 10, 16, 17, 18, 17, 14, 14, 13, 15, 15, + 12, 11, 18, 3, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18 + } ; + +static const flex_int16_t yy_chk[36] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 15, 15, 17, 17, 20, 20, 19, 14, 11, + 7, 5, 3, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18 + } ; + +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 "lexicalStructure.lex" +/* Lexical Analysis with Flex (2.6.0) We used some of the code from this manual */ +/* so we placed the citation here. */ +/* definitions */ +#line 6 "lexicalStructure.lex" +#include "typedefs.h" +#line 458 "lex.yy.c" +#line 459 "lex.yy.c" + +#define INITIAL 0 + +#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 + + static void yyunput ( int c, char *buf_ptr ); + +#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 \ + 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 12 "lexicalStructure.lex" + + +#line 679 "lex.yy.c" + + 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_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 >= 19 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 24 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + 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: +/* rule 1 can match eol */ +YY_RULE_SETUP +#line 14 "lexicalStructure.lex" +{return COMMENT;} + YY_BREAK +case 2: +YY_RULE_SETUP +#line 16 "lexicalStructure.lex" +{return SEMI_COLON;} + YY_BREAK +case 3: +YY_RULE_SETUP +#line 17 "lexicalStructure.lex" +{return COLON;} + YY_BREAK +case 4: +YY_RULE_SETUP +#line 18 "lexicalStructure.lex" +{return COMMA;} + YY_BREAK +case 5: +YY_RULE_SETUP +#line 19 "lexicalStructure.lex" +{return ARROW;} + YY_BREAK +case 6: +YY_RULE_SETUP +#line 21 "lexicalStructure.lex" +{return ID;} + YY_BREAK +case 7: +YY_RULE_SETUP +#line 23 "lexicalStructure.lex" +ECHO; + YY_BREAK +#line 772 "lex.yy.c" +case YY_STATE_EOF(INITIAL): + yyterminate(); + + 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_c_buf_p); + 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); + + 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 >= 19 ) + 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 >= 19 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_is_jam = (yy_current_state == 18); + + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_UNPUT + + static void yyunput (int c, char * yy_bp ) +{ + char *yy_cp; + + yy_cp = (yy_c_buf_p); + + /* undo effects of setting up yytext */ + *yy_cp = (yy_hold_char); + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + int number_to_move = (yy_n_chars) + 2; + char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; +} + +#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); + + 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 23 "lexicalStructure.lex" + + +int main(int argc, char *argv[]){ + argc--, argv++; + if ( argc > 0 ) + yyin = fopen( argv[0], "r" ); + else + yyin = stdin; + yylex(); +} diff --git a/lexicalStructure b/lexicalStructure new file mode 100755 index 0000000000000000000000000000000000000000..2940a82930eef9200385906d773343955b7af016 GIT binary patch literal 22584 zcmeHP3wTu3oxc-uAs`_kIucZ56x#BP0Re;f2#>+53m7f2_TdggG9jr+CY{V6aT^;u zpp4hJ)Vh`0ZkMXty0&($wrVY_0g;Jrbwg_{RqCcL>WslQ7L?Q?v%lYY+_^I(Yqbi+G zJElrGO*P-iuTt`jJbFmwr>R?yzUjMI>h-P8rF)cL8dd$Z9%1VBE4_ZD=TPN{enquE z=@VX6%3eOL29Kdy{2E5S-X^7&Pgf{;O_>M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ex index 64ce9b2..2886ac5 100644 --- a/lexicalStructure.lex +++ b/lexicalStructure.lex @@ -6,47 +6,19 @@ #include "typedefs.h" %} -DIGIT [0-9] -CHAR \\n|\\t|\\'|[^'\n\t\\] -SCHAR \\n|\\t|\\\"|[^\"\n\\] COM ([^*]|\*+[^)*])* ID [A-Za-z_][0-9A-Za-z_]* %% -"(*"{COM}"*)" {printf("COMMENT: %s, Token: %d\n", yytext, COMMENT );} // {return COMMENT} +"(*"{COM}"*)" {return COMMENT;} -"integer" {printf("T_INTEGER %s, Token: %d\n", yytext, T_INTEGER);} // {return T_INTEGER} -"address" {printf("T_ADDRESS %s, Token: %d\n", yytext, T_ADDRESS);} // {return T_ADDRESS} -"Boolean" {printf("T_BOOLEAN %s, Token: %d\n", yytext, T_BOOLEAN);} // {return T_BOOLEAN} -"character" {printf("T_CHARACTER %s, Token: %d\n", yytext, T_CHARACTER);} // {return T_CHARACTER} -"string" {printf("T_STRING %s, Token: %d\n", yytext, T_STRING);} // {return T_STRING} +";" {return SEMI_COLON;} +":" {return COLON;} +"," {return COMMA;} +"->" {return ARROW;} -"while" {printf("WHILE %s, Token: %d\n", yytext, WHILE);} // {return WHILE} -"if" {printf("IF %s, Token: %d\n", yytext, IF);} // {return IF} -"then" {printf("THEN %s, Token: %d\n", yytext, THEN);} // {return THEN} -"else" {printf("ELSE %s, Token: %d\n", yytext, ELSE);} // {return ELSE} -"type" {printf("TYPE %s, Token: %d\n", yytext, TYPE);} // {return TYPE} -"function" {printf("FUNCTION %s, Token: %d\n", yytext, FUNCTION);} // {return FUNCTION} -"return" {printf("RETURN %s, Token: %d\n", yytext, RETURN);} // {return RETURN} -"external" {printf("EXTERNAL %s, Token: %d\n", yytext, EXTERNAL);} // {return EXTERNAL} -"as" {printf("AS %s, Token: %d\n", yytext, AS);} // {return AS} - -";" {printf("SEMI_COLON %s, Token: %d\n", yytext, SEMI_COLON);} -":" {printf("COLON %s, Token: %d\n", yytext, COLON);} -"," {printf("COMMA %s, Token: %d\n", yytext, COMMA);} -"->" {printf("ARROW %s, Token: %d\n", yytext, ARROW);} - -{DIGIT}+ {printf("C_INTEGER: %s, Token: %d\n", yytext, atoi( yytext ) );} -"null" {printf("C_NULL: %s, Token: %d\n", yytext, atoi( yytext ) );} -'{CHAR}' {printf("C_CHARACTER: %s, Token: %d\n", yytext, atoi( yytext ) );} -"true" {printf("C_TRUE: %s, Token: %d\n", yytext, atoi( yytext ) );} -"false" {printf("C_FALSE: %s, Token: %d\n", yytext, atoi( yytext ) );} -\"{SCHAR}*\" {printf("C_STRING: %s, Token: %d\n", yytext, atoi( yytext ) );} - -{ID} {printf("ID: %s, Token: %d\n", yytext, ID);} - -.|\n +{ID} {return ID;} %% @@ -57,4 +29,4 @@ int main(int argc, char *argv[]){ else yyin = stdin; yylex(); -} +} \ No newline at end of file diff --git a/tests/test_comments.alpha b/tests/test_comments.alpha new file mode 100644 index 0000000..1111428 --- /dev/null +++ b/tests/test_comments.alpha @@ -0,0 +1,9 @@ +(* hello *) +(* hello *) +(* I'd think this is a legal "string" that contains several \n \t +escaped characters, isn't it? *) +(* \ *) +(* *) +(*{COMMENT}+ *) +(* * *) +(* (hello) *) \ No newline at end of file diff --git a/tests/test_constants_literals.txt b/tests/test_constants_literals.txt deleted file mode 100644 index fa47647..0000000 --- a/tests/test_constants_literals.txt +++ /dev/null @@ -1,50 +0,0 @@ - -''' -'\' -false -''' -nullfalse -"nulltrue -null -'7' -true -'189 -'\t' -'"' -'/' -'\n' -'\'' -'\t' -'\\' -'n' -'\' -'fdsf' -' -' -' ' -''' -"STRINGwithnotSPaces" -' ' -'\ ' - -"J" -"" -" " -\"\" -"this is a string" 721398 'g' '/n' -12893 "this is not a string -"{SCHAR}" -"SCHAR" -"[SCHAR]" -"I'd think this is a legal \"string\" that contains \n \t several escaped characters, isn't it?" -"I'd think this is a legal \"string\" that contains several \\n \\t escaped characters, isn't it?" - -(* hello *) -(* hello *) -(* I'd think this is a legal "string" that contains several \n \t -escaped characters, isn't it? *) -(* \ *) -(* *) -(*{COMMENT}+ *) -(* * *) -(* (hello) *) \ No newline at end of file diff --git a/tests/test_keywards.alpha b/tests/test_keywards.alpha deleted file mode 100644 index ebd52ee..0000000 --- a/tests/test_keywards.alpha +++ /dev/null @@ -1,30 +0,0 @@ -while -While -whiLe -if -IF -If -iF -then -Then -theN -else -eLse -elSe -Else -type -Type -tyPe -function -Function -functioN -return -Return -returN -external -External -exteRnal -as -As -aS -functionaly \ No newline at end of file diff --git a/tests/test_otherpunc.txt b/tests/test_otherpunc.alpha similarity index 100% rename from tests/test_otherpunc.txt rename to tests/test_otherpunc.alpha diff --git a/tests/test_types.alpha b/tests/test_types.alpha deleted file mode 100644 index 4fde8cd..0000000 --- a/tests/test_types.alpha +++ /dev/null @@ -1,10 +0,0 @@ -integer -Integer -address -Address -Boolean -boolean -character -Character -string -String diff --git a/tests/test_variables.txt b/tests/test_variables.alpha similarity index 100% rename from tests/test_variables.txt rename to tests/test_variables.alpha From 0e3c0543d7f1d0d7be45877d88a74e844aaf25e8 Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Wed, 12 Feb 2025 00:08:41 -0500 Subject: [PATCH 023/105] moved test files to the test folder --- lex.yy.c | 1820 +++++++++++++++++ lex.yy.c.save | 1812 ++++++++++++++++ testlex | Bin 0 -> 27176 bytes simpleIntTest.txt => tests/simpleIntTest.txt | 0 .../simpleLiteralTest.a | 1 + test1.txt => tests/test1.txt | 0 6 files changed, 3633 insertions(+) create mode 100644 lex.yy.c create mode 100644 lex.yy.c.save create mode 100755 testlex rename simpleIntTest.txt => tests/simpleIntTest.txt (100%) rename simpleLiteralTest.a => tests/simpleLiteralTest.a (98%) rename test1.txt => tests/test1.txt (100%) diff --git a/lex.yy.c b/lex.yy.c new file mode 100644 index 0000000..c66fc4f --- /dev/null +++ b/lex.yy.c @@ -0,0 +1,1820 @@ + +#line 3 "lex.yy.c" + +#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 9 +#define YY_END_OF_BUFFER 10 +/* 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[34] = + { 0, + 0, 0, 10, 8, 8, 8, 8, 1, 8, 8, + 8, 0, 6, 0, 0, 0, 0, 1, 0, 0, + 0, 3, 0, 0, 0, 0, 0, 7, 0, 2, + 4, 5, 0 + } ; + +static const YY_CHAR yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 4, 1, 1, 1, 1, 5, 6, + 7, 8, 1, 1, 1, 1, 1, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 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, 10, 1, 1, 1, 1, 11, 1, 1, 1, + + 12, 13, 1, 1, 1, 1, 1, 14, 1, 15, + 1, 1, 1, 16, 17, 18, 19, 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, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static const YY_CHAR yy_meta[20] = + { 0, + 1, 2, 3, 1, 2, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1 + } ; + +static const flex_int16_t yy_base[37] = + { 0, + 0, 0, 47, 62, 16, 36, 37, 35, 30, 21, + 22, 17, 62, 24, 32, 38, 28, 26, 20, 19, + 13, 62, 23, 23, 12, 11, 12, 62, 11, 62, + 62, 62, 62, 56, 21, 58 + } ; + +static const flex_int16_t yy_def[37] = + { 0, + 33, 1, 33, 33, 34, 35, 33, 33, 33, 33, + 33, 34, 33, 33, 33, 33, 36, 33, 33, 33, + 33, 33, 36, 36, 33, 33, 33, 33, 33, 33, + 33, 33, 0, 33, 33, 33 + } ; + +static const flex_int16_t yy_nxt[82] = + { 0, + 4, 4, 4, 5, 6, 7, 4, 4, 8, 4, + 4, 4, 9, 4, 10, 4, 4, 11, 4, 13, + 13, 15, 32, 31, 30, 14, 14, 12, 29, 28, + 24, 27, 26, 25, 18, 24, 22, 21, 12, 20, + 19, 12, 15, 18, 17, 16, 33, 33, 33, 33, + 33, 33, 15, 33, 33, 15, 12, 12, 23, 23, + 23, 3, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33 + } ; + +static const flex_int16_t yy_chk[82] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, + 12, 35, 29, 27, 26, 5, 12, 14, 25, 24, + 23, 21, 20, 19, 18, 17, 15, 11, 14, 10, + 9, 14, 16, 8, 7, 6, 3, 0, 0, 0, + 0, 0, 16, 0, 0, 16, 34, 34, 36, 36, + 36, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33 + } ; + +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 "lexicalStructure.lex" +#line 2 "lexicalStructure.lex" + /* so we placed the citation here. */ + /* definitions */ +#include "typedefs.h" +#line 474 "lex.yy.c" +#line 11 "lexicalStructure.lex" + /* char can be a newline, tab, an escaped quote, or anything but a single quote, an actual line break, an actual tab, or a backslash by itself (to prevent confusion from escaped quote */ + /*similar to above, a string Char (SCHAR) is the same as a CHAR except we cannot have double quotes instead of single quotes. Double quotes need to be escaped in Flex unlike single quotes based on documentation */ + /*Making the contents of a comment anything that is either not a * or not a * followed by ) to terminate comments at the first ENDCOM */ +#line 479 "lex.yy.c" + +#define INITIAL 0 + +#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 + + static void yyunput ( int c, char *buf_ptr ); + +#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 \ + 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 18 "lexicalStructure.lex" + + /* rules */ +#line 699 "lex.yy.c" + + 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_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 >= 34 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 62 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + 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 20 "lexicalStructure.lex" +{printf( "C_INTEGER: %s (%d)\n", yytext, atoi( yytext ) );} + YY_BREAK +case 2: +YY_RULE_SETUP +#line 22 "lexicalStructure.lex" +{printf( "C_NULL: %s (%d)\n", yytext, atoi( yytext ) );} + YY_BREAK +case 3: +YY_RULE_SETUP +#line 24 "lexicalStructure.lex" +{printf( "C_CHARACTER: %s (%d)\n", yytext, atoi( yytext ) );} /*using double \ per documentation to show escaped chars*/ + YY_BREAK +case 4: +YY_RULE_SETUP +#line 26 "lexicalStructure.lex" +{printf( "C_TRUE: %s (%d)\n", yytext, atoi( yytext ) );} + YY_BREAK +case 5: +YY_RULE_SETUP +#line 28 "lexicalStructure.lex" +{printf( "C_FALSE: %s (%d)\n", yytext, atoi( yytext ) );} + YY_BREAK +case 6: +YY_RULE_SETUP +#line 30 "lexicalStructure.lex" +{printf( "C_STRING: %s (%d)\n", yytext, atoi( yytext ) );} + YY_BREAK +case 7: +/* rule 7 can match eol */ +YY_RULE_SETUP +#line 32 "lexicalStructure.lex" +{printf( "COMMENT: %s (%d)\n", yytext, atoi( yytext ) );} + YY_BREAK +case 8: +/* rule 8 can match eol */ +YY_RULE_SETUP +#line 34 "lexicalStructure.lex" + + YY_BREAK +case 9: +YY_RULE_SETUP +#line 36 "lexicalStructure.lex" +ECHO; + YY_BREAK +#line 803 "lex.yy.c" +case YY_STATE_EOF(INITIAL): + yyterminate(); + + 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_c_buf_p); + 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); + + 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 >= 34 ) + 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 >= 34 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_is_jam = (yy_current_state == 33); + + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_UNPUT + + static void yyunput (int c, char * yy_bp ) +{ + char *yy_cp; + + yy_cp = (yy_c_buf_p); + + /* undo effects of setting up yytext */ + *yy_cp = (yy_hold_char); + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + int number_to_move = (yy_n_chars) + 2; + char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; +} + +#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); + + 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 36 "lexicalStructure.lex" + + /* user code */ + +int main( int argc, char **argv ) +{ + argc--, argv++; /* skip over program name */ + if ( argc > 0 ) + yyin = fopen( argv[0], "r" ); + else + yyin = stdin; + yylex(); +} + diff --git a/lex.yy.c.save b/lex.yy.c.save new file mode 100644 index 0000000..47302f4 --- /dev/null +++ b/lex.yy.c.save @@ -0,0 +1,1812 @@ + +#line 3 "lex.yy.c" + +#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. */ +e#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 8 +#define YY_END_OF_BUFFER 9 +/* 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[38] = + { 0, + 0, 0, 9, 7, 7, 1, 7, 7, 7, 7, + 0, 0, 1, 0, 0, 0, 0, 3, 0, 0, + 0, 0, 0, 0, 2, 4, 0, 5, 0, 0, + 0, 0, 0, 0, 0, 6, 0 + } ; + +static const YY_CHAR yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 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, 4, 1, + 1, 1, 5, 1, 1, 1, 1, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 1, 1, 1, + 1, 1, 1, 1, 7, 1, 1, 1, 1, 1, + 8, 1, 9, 1, 1, 10, 1, 11, 1, 1, + 1, 12, 13, 14, 1, 15, 1, 1, 1, 1, + 1, 16, 1, 1, 1, 1, 17, 1, 1, 1, + + 18, 19, 1, 1, 1, 1, 1, 20, 1, 21, + 1, 1, 1, 22, 23, 24, 25, 1, 1, 1, + 1, 1, 26, 1, 27, 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[28] = + { 0, + 1, 2, 2, 2, 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 flex_int16_t yy_base[40] = + { 0, + 0, 23, 59, 60, 42, 51, 39, 30, 32, 40, + 48, 1, 42, 26, 25, 18, 27, 60, 1, 17, + 19, 20, 25, 18, 60, 60, 26, 60, 23, 25, + 17, 24, 20, 1, 2, 60, 60, 49, 0 + } ; + +static const flex_int16_t yy_def[40] = + { 0, + 38, 38, 37, 37, 39, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 0, 37, 37 + } ; + +static const flex_int16_t yy_nxt[88] = + { 0, + 11, 37, 37, 5, 11, 6, 36, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 19, 37, 7, 37, + 8, 11, 37, 9, 11, 10, 5, 35, 6, 34, + 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, + 23, 7, 22, 8, 21, 20, 9, 13, 10, 4, + 4, 18, 17, 16, 15, 14, 13, 12, 37, 3, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37 + } ; + +static const flex_int16_t yy_chk[88] = + { 0, + 39, 0, 0, 1, 12, 1, 35, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 12, 0, 1, 0, + 1, 19, 0, 1, 19, 1, 2, 34, 2, 33, + 32, 31, 30, 29, 27, 24, 23, 22, 21, 20, + 17, 2, 16, 2, 15, 14, 2, 13, 2, 38, + 38, 11, 10, 9, 8, 7, 6, 5, 3, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37 + } ; + +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 "lexicalStructure.lex" +#line 2 "lexicalStructure.lex" + /* so we placed the citation here. */ + /* definitions */ +#include "typedefs.h" +#line 475 "lex.yy.c" +#line 476 "lex.yy.c" + +#define INITIAL 0 + +#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 + + static void yyunput ( int c, char *buf_ptr ); + +#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 \ + 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 11 "lexicalStructure.lex" + +#line 13 "lexicalStructure.lex" + /* rules */ +#line 697 "lex.yy.c" + + 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_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 >= 38 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 60 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + 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 14 "lexicalStructure.lex" +{printf( "C_INTEGER: %s (%d)\n", yytext, atoi( yytext ) );} + YY_BREAK +case 2: +YY_RULE_SETUP +#line 16 "lexicalStructure.lex" +{printf( "C_NULL: %s (%d)\n", yytext, atoi( yytext ) );} + YY_BREAK +case 3: +YY_RULE_SETUP +#line 18 "lexicalStructure.lex" +{printf( "C_CHARACTER: %s (%d)\n", yytext, atoi( yytext ) );} /*using double \ per documentation to show escaped chars*/ + YY_BREAK +case 4: +YY_RULE_SETUP +#line 20 "lexicalStructure.lex" +{printf( "C_TRUE: %s (%d)\n", yytext, atoi( yytext ) );} + YY_BREAK +case 5: +YY_RULE_SETUP +#line 22 "lexicalStructure.lex" +{printf( "C_FALSE: %s (%d)\n", yytext, atoi( yytext ) );} + YY_BREAK +case 6: +YY_RULE_SETUP +#line 24 "lexicalStructure.lex" +{printf( "C_STRING: %s (%d)\n", yytext, atoi( yytext ) );} + YY_BREAK +case 7: +/* rule 7 can match eol */ +YY_RULE_SETUP +#line 26 "lexicalStructure.lex" + + YY_BREAK +case 8: +YY_RULE_SETUP +#line 28 "lexicalStructure.lex" +ECHO; + YY_BREAK +#line 795 "lex.yy.c" +case YY_STATE_EOF(INITIAL): + yyterminate(); + + 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_c_buf_p); + 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); + + 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 >= 38 ) + 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 >= 38 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_is_jam = (yy_current_state == 37); + + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_UNPUT + + static void yyunput (int c, char * yy_bp ) +{ + char *yy_cp; + + yy_cp = (yy_c_buf_p); + + /* undo effects of setting up yytext */ + *yy_cp = (yy_hold_char); + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + int number_to_move = (yy_n_chars) + 2; + char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; +} + +#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); + + 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 28 "lexicalStructure.lex" + + /* user code */ + +int main( int argc, char **argv ) +{ + argc--, argv++; /* skip over program name */ + if ( argc > 0 ) + yyin = fopen( argv[0], "r" ); + else + yyin = stdin; + yylex(); +} + diff --git a/testlex b/testlex new file mode 100755 index 0000000000000000000000000000000000000000..c99693f57f49713151d8f3eef78ece40f5981779 GIT binary patch literal 27176 zcmeHwdw5jUx%Zlc4dD_Jkdc5~h6oryLZE0t3x>2s_-9FI~?wHgqasI?6hTddd<726rZ@x*{NT4cW8yDoe7-el-` zzVCd`bNJ=Fd2U8)FEoPM3GFl+Tl2KD3BOt|W0n5hs zWHyNnMtTs(1ix4ia78$tVWn9T&jcmCJc{%~CkU7+s!B+d^wNdCVS=M5%N1$T( zkNomq4XT;f$^6o_LzncYqB46nr>?f*%K3BZs%F>KHiVmJH!rwy_LcJsn*xRNcoC>v zE_|p@tz271&CyPnYR-%;BCYHZZ;a%V{JE>{8^3?&k85V+cW>x(?5>+LdfYjZp>mTB z$xtABs>xM)EFvVs{o&ZNJBm-%vUzvoAr7xwBC-j8)E zmq6nDum_MF@)l-o8vJ+~oXX|G#~uy?=+FLVY4G2r!T)y}d~+K7`)TmI(%=(;yYR7x z7Xb8E{#(=F6>0Ei(%@}r@a<{vL>l~)H2CGfUHI5T1VDfF`VsI^Y&>(73k@}2tVS|l zK$h?4ks|q`asey(JCGcWUY$En;NKR6y#Y${#pMD}@+*)e`Pz#F-p)HY;@(xIYrIwd zpnpScQ^+4IU9+q%(BLoiRn+;J*Sn!U(BN$f`GO&@SBUm2*wRwxZ-#hfv(H;y+u*CK z-Q;K0wRQf60IT=a)decS#K^Cdw(5Pg4XnB`SlbY)W*hvWO6Cg%YFTxl(ci%8{q;@$ z5Nirm1;Qa#9rXJV55g7;`h_j9pkG<%_XYjIAgjh#AV>;41*s}zhj>H4i>!U2+CT&I zH`l`0ox$3WpVc<`LZKFh0#($+I%BAukZ>uDg$#y2Ihwh z%RhVCEI~XPw-hKo1PL`+JooSq&;prkl*Gd0Yll)E6QqJ#*HrtJ%XTY}>z2Y@63;5< z*)WBx^l`7iskzPbU6%=``B8%GTdy!$(9P`CR}xW;?zP4+hM}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e=GJFw9o3sC&PRad7HErE__)#n@Y=uvnmf=UFL1U9 zu)?O6`jD>zG!zuHM#cDh&_-6+5D57TH#CF`8-ut%I*5y%Q&2^?7FW&JR!L~d(p9r* z3F6{4zNQ*hh&PSMLeNl9aPY#iiSCT%Vlv?cFX*rHk%Ejh)`eIhpVA8vE!+@5k|Ir* zuM7ELD5NzB(g8j;3;i{66{@L%HI))J#B#*AhKkF#peP&-?Lu?~R)}@59?P3trvIPG zC9r@k0G`c7$jh`+bxtbTTvo-2UW(5Ue3X8={~v*5DH!_#k!1L#qeb8T|0GP6a*C*Z zqe|2HlR1BN{-vl(2})|$zX|wXaki<-ug-rJRp$lR-tb^AzYpkee3X8V^q->iK86C7 zk^HRm)j4e~Fj7(a>bzM|b-oM{9>|6{Y(#?2Zk4_|uT}IaDXhw`}f~ zsNCkASAJE7Hbls$O21fEP*L^Vq4Kxa|52&GR2o$0-HNL7andKB+4c7TBcCYy#y(c= zXQ_XigT4J92h*(Yl6s2rcey45l5J%3q)op>J^(AKasPs(o^)` zZ2IasO3_b@2W(LSrKigCvQ1x|TPUjDvnYAH|6Y~)s{L89l$5mIXc&RJBwLX;5uqw7 zeRZCtDE&=?IoR`m7fiE$`${3L=omcrn1kv+3i}9=k@(1AYn(r;|JTGWuhNQs3f&x& zzIwk@um&K4k`t*^TH#-TK`v7Ht8+f}|I{eQ(ELF`>8W;n8W`2z(D#xQ{=VRPK|2L8 zzLmbBgQ0BJXXR3~L{N2}tPChUl^y|Q!c_jQa={rR^>-;jNnN%y{r?A)e~}GW`to?e z;F2r_GgW;@aKv}9%)djvsGA6wj%-x<)%-gYm@2!_6yI653VMyL|EheIEDhKG^jG?X L#CV&6Ey?~5kEO7# literal 0 HcmV?d00001 diff --git a/simpleIntTest.txt b/tests/simpleIntTest.txt similarity index 100% rename from simpleIntTest.txt rename to tests/simpleIntTest.txt diff --git a/simpleLiteralTest.a b/tests/simpleLiteralTest.a similarity index 98% rename from simpleLiteralTest.a rename to tests/simpleLiteralTest.a index f97cf52..fd54099 100644 --- a/simpleLiteralTest.a +++ b/tests/simpleLiteralTest.a @@ -44,3 +44,4 @@ true "[SCHAR]" "FINAL: I'd think this is a legal \"string\" that contains \n \t several escaped characters, isn't it?" "I'd think this is a legal \"string\" that contains several \\n \t escaped characters, isn't it?" +nullLike diff --git a/test1.txt b/tests/test1.txt similarity index 100% rename from test1.txt rename to tests/test1.txt From 76cc3754c20821add8e722e97dd11542c5fd0be6 Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Wed, 12 Feb 2025 12:41:23 -0500 Subject: [PATCH 024/105] cleaned up repo and code in prep to push to dev --- lex.yy.c | 30 +- lex.yy.c.save | 1812 ----------------- lexicalStructure | Bin 27128 -> 0 bytes lexicalStructure.lex | 2 +- tests/{test1.txt => generalTokenTest.alpha} | 0 ...{simpleIntTest.txt => simpleIntTest.alpha} | 0 ...t.a => simpleLiteralAndCommentsTest.alpha} | 0 ...est_keywards.alpha => test_keywords.alpha} | 0 8 files changed, 17 insertions(+), 1827 deletions(-) delete mode 100644 lex.yy.c.save delete mode 100755 lexicalStructure rename tests/{test1.txt => generalTokenTest.alpha} (100%) rename tests/{simpleIntTest.txt => simpleIntTest.alpha} (100%) rename tests/{simpleLiteralTest.a => simpleLiteralAndCommentsTest.alpha} (100%) rename tests/{test_keywards.alpha => test_keywords.alpha} (100%) diff --git a/lex.yy.c b/lex.yy.c index c66fc4f..f3d9cd1 100644 --- a/lex.yy.c +++ b/lex.yy.c @@ -471,7 +471,7 @@ char *yytext; /* definitions */ #include "typedefs.h" #line 474 "lex.yy.c" -#line 11 "lexicalStructure.lex" +#line 13 "lexicalStructure.lex" /* char can be a newline, tab, an escaped quote, or anything but a single quote, an actual line break, an actual tab, or a backslash by itself (to prevent confusion from escaped quote */ /*similar to above, a string Char (SCHAR) is the same as a CHAR except we cannot have double quotes instead of single quotes. Double quotes need to be escaped in Flex unlike single quotes based on documentation */ /*Making the contents of a comment anything that is either not a * or not a * followed by ) to terminate comments at the first ENDCOM */ @@ -692,10 +692,11 @@ YY_DECL } { -#line 18 "lexicalStructure.lex" +#line 20 "lexicalStructure.lex" + /* rules */ -#line 699 "lex.yy.c" +#line 700 "lex.yy.c" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { @@ -754,52 +755,52 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 20 "lexicalStructure.lex" +#line 23 "lexicalStructure.lex" {printf( "C_INTEGER: %s (%d)\n", yytext, atoi( yytext ) );} YY_BREAK case 2: YY_RULE_SETUP -#line 22 "lexicalStructure.lex" +#line 25 "lexicalStructure.lex" {printf( "C_NULL: %s (%d)\n", yytext, atoi( yytext ) );} YY_BREAK case 3: YY_RULE_SETUP -#line 24 "lexicalStructure.lex" +#line 27 "lexicalStructure.lex" {printf( "C_CHARACTER: %s (%d)\n", yytext, atoi( yytext ) );} /*using double \ per documentation to show escaped chars*/ YY_BREAK case 4: YY_RULE_SETUP -#line 26 "lexicalStructure.lex" +#line 29 "lexicalStructure.lex" {printf( "C_TRUE: %s (%d)\n", yytext, atoi( yytext ) );} YY_BREAK case 5: YY_RULE_SETUP -#line 28 "lexicalStructure.lex" +#line 31 "lexicalStructure.lex" {printf( "C_FALSE: %s (%d)\n", yytext, atoi( yytext ) );} YY_BREAK case 6: YY_RULE_SETUP -#line 30 "lexicalStructure.lex" +#line 33 "lexicalStructure.lex" {printf( "C_STRING: %s (%d)\n", yytext, atoi( yytext ) );} YY_BREAK case 7: /* rule 7 can match eol */ YY_RULE_SETUP -#line 32 "lexicalStructure.lex" +#line 35 "lexicalStructure.lex" {printf( "COMMENT: %s (%d)\n", yytext, atoi( yytext ) );} YY_BREAK case 8: /* rule 8 can match eol */ YY_RULE_SETUP -#line 34 "lexicalStructure.lex" +#line 37 "lexicalStructure.lex" YY_BREAK case 9: YY_RULE_SETUP -#line 36 "lexicalStructure.lex" +#line 39 "lexicalStructure.lex" ECHO; YY_BREAK -#line 803 "lex.yy.c" +#line 804 "lex.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1804,7 +1805,7 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 36 "lexicalStructure.lex" +#line 39 "lexicalStructure.lex" /* user code */ @@ -1816,5 +1817,6 @@ int main( int argc, char **argv ) else yyin = stdin; yylex(); + } diff --git a/lex.yy.c.save b/lex.yy.c.save deleted file mode 100644 index 47302f4..0000000 --- a/lex.yy.c.save +++ /dev/null @@ -1,1812 +0,0 @@ - -#line 3 "lex.yy.c" - -#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. */ -e#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 8 -#define YY_END_OF_BUFFER 9 -/* 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[38] = - { 0, - 0, 0, 9, 7, 7, 1, 7, 7, 7, 7, - 0, 0, 1, 0, 0, 0, 0, 3, 0, 0, - 0, 0, 0, 0, 2, 4, 0, 5, 0, 0, - 0, 0, 0, 0, 0, 6, 0 - } ; - -static const YY_CHAR yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 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, 4, 1, - 1, 1, 5, 1, 1, 1, 1, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 1, 1, 1, - 1, 1, 1, 1, 7, 1, 1, 1, 1, 1, - 8, 1, 9, 1, 1, 10, 1, 11, 1, 1, - 1, 12, 13, 14, 1, 15, 1, 1, 1, 1, - 1, 16, 1, 1, 1, 1, 17, 1, 1, 1, - - 18, 19, 1, 1, 1, 1, 1, 20, 1, 21, - 1, 1, 1, 22, 23, 24, 25, 1, 1, 1, - 1, 1, 26, 1, 27, 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[28] = - { 0, - 1, 2, 2, 2, 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 flex_int16_t yy_base[40] = - { 0, - 0, 23, 59, 60, 42, 51, 39, 30, 32, 40, - 48, 1, 42, 26, 25, 18, 27, 60, 1, 17, - 19, 20, 25, 18, 60, 60, 26, 60, 23, 25, - 17, 24, 20, 1, 2, 60, 60, 49, 0 - } ; - -static const flex_int16_t yy_def[40] = - { 0, - 38, 38, 37, 37, 39, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 0, 37, 37 - } ; - -static const flex_int16_t yy_nxt[88] = - { 0, - 11, 37, 37, 5, 11, 6, 36, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 19, 37, 7, 37, - 8, 11, 37, 9, 11, 10, 5, 35, 6, 34, - 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, - 23, 7, 22, 8, 21, 20, 9, 13, 10, 4, - 4, 18, 17, 16, 15, 14, 13, 12, 37, 3, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37 - } ; - -static const flex_int16_t yy_chk[88] = - { 0, - 39, 0, 0, 1, 12, 1, 35, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 12, 0, 1, 0, - 1, 19, 0, 1, 19, 1, 2, 34, 2, 33, - 32, 31, 30, 29, 27, 24, 23, 22, 21, 20, - 17, 2, 16, 2, 15, 14, 2, 13, 2, 38, - 38, 11, 10, 9, 8, 7, 6, 5, 3, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37 - } ; - -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 "lexicalStructure.lex" -#line 2 "lexicalStructure.lex" - /* so we placed the citation here. */ - /* definitions */ -#include "typedefs.h" -#line 475 "lex.yy.c" -#line 476 "lex.yy.c" - -#define INITIAL 0 - -#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 - - static void yyunput ( int c, char *buf_ptr ); - -#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 \ - 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 11 "lexicalStructure.lex" - -#line 13 "lexicalStructure.lex" - /* rules */ -#line 697 "lex.yy.c" - - 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_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 >= 38 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 60 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - 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 14 "lexicalStructure.lex" -{printf( "C_INTEGER: %s (%d)\n", yytext, atoi( yytext ) );} - YY_BREAK -case 2: -YY_RULE_SETUP -#line 16 "lexicalStructure.lex" -{printf( "C_NULL: %s (%d)\n", yytext, atoi( yytext ) );} - YY_BREAK -case 3: -YY_RULE_SETUP -#line 18 "lexicalStructure.lex" -{printf( "C_CHARACTER: %s (%d)\n", yytext, atoi( yytext ) );} /*using double \ per documentation to show escaped chars*/ - YY_BREAK -case 4: -YY_RULE_SETUP -#line 20 "lexicalStructure.lex" -{printf( "C_TRUE: %s (%d)\n", yytext, atoi( yytext ) );} - YY_BREAK -case 5: -YY_RULE_SETUP -#line 22 "lexicalStructure.lex" -{printf( "C_FALSE: %s (%d)\n", yytext, atoi( yytext ) );} - YY_BREAK -case 6: -YY_RULE_SETUP -#line 24 "lexicalStructure.lex" -{printf( "C_STRING: %s (%d)\n", yytext, atoi( yytext ) );} - YY_BREAK -case 7: -/* rule 7 can match eol */ -YY_RULE_SETUP -#line 26 "lexicalStructure.lex" - - YY_BREAK -case 8: -YY_RULE_SETUP -#line 28 "lexicalStructure.lex" -ECHO; - YY_BREAK -#line 795 "lex.yy.c" -case YY_STATE_EOF(INITIAL): - yyterminate(); - - 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_c_buf_p); - 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); - - 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 >= 38 ) - 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 >= 38 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - yy_is_jam = (yy_current_state == 37); - - return yy_is_jam ? 0 : yy_current_state; -} - -#ifndef YY_NO_UNPUT - - static void yyunput (int c, char * yy_bp ) -{ - char *yy_cp; - - yy_cp = (yy_c_buf_p); - - /* undo effects of setting up yytext */ - *yy_cp = (yy_hold_char); - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - int number_to_move = (yy_n_chars) + 2; - char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; -} - -#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); - - 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 28 "lexicalStructure.lex" - - /* user code */ - -int main( int argc, char **argv ) -{ - argc--, argv++; /* skip over program name */ - if ( argc > 0 ) - yyin = fopen( argv[0], "r" ); - else - yyin = stdin; - yylex(); -} - diff --git a/lexicalStructure b/lexicalStructure deleted file mode 100755 index 8817fe4a700f2d81959706bfad8672a168461b04..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 27128 zcmeHwdw5jUx%Zk08^R?dAfw?vAX=`GAkd&ihs(gATml5k`C2=fBomTjl8KWUO{@{@ zfMw1uimh7eER&lK@EsZP^nO`a+LOqia299Hb$(eMd$q9b=kA`HiLco zo#%VLKeBjc-nD-3Wv%tD>s~vv*yvrp#OZJ_6>``$j8f&p1>%v6k_s6C@vst>hwt%h z9P5vCKaL5$M-XsDIO(*~T#4s^l3pQ2dZA+k%oJ56BuaYOLfat0QIr*kH0fy+m1#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W=qsw^RT)%T(OowEQmL<~`JFJ?P&jJ`_ zen}ZndMZu-Ujbn%e|NdyjF9>}l%S+;TY8wxf2Ivr`qOMUm6d{-s=gyQ;@czh-z8tT ujRj0+II8?={v8NRm0f6x@2>wPXpyb|s(h6!4cFfE#|4DMD4T*U$^IKH7El-f diff --git a/lexicalStructure.lex b/lexicalStructure.lex index 22632ba..baadc20 100644 --- a/lexicalStructure.lex +++ b/lexicalStructure.lex @@ -31,7 +31,7 @@ COMMENTCHAR [^\*]|\*[^\)] \"{SCHAR}*\" {printf( "C_STRING: %s (%d)\n", yytext, atoi( yytext ) );} -{STARTCOM}{COMMENTCHAR}*{ENDCOM} {printf( "COMMENT: %s (%d)\n", yytext, atoi( yytext ) );} +\(\*{COMMENTCHAR}*\*\) {printf( "COMMENT: %s (%d)\n", yytext, atoi( yytext ) );} .|\n diff --git a/tests/test1.txt b/tests/generalTokenTest.alpha similarity index 100% rename from tests/test1.txt rename to tests/generalTokenTest.alpha diff --git a/tests/simpleIntTest.txt b/tests/simpleIntTest.alpha similarity index 100% rename from tests/simpleIntTest.txt rename to tests/simpleIntTest.alpha diff --git a/tests/simpleLiteralTest.a b/tests/simpleLiteralAndCommentsTest.alpha similarity index 100% rename from tests/simpleLiteralTest.a rename to tests/simpleLiteralAndCommentsTest.alpha diff --git a/tests/test_keywards.alpha b/tests/test_keywords.alpha similarity index 100% rename from tests/test_keywards.alpha rename to tests/test_keywords.alpha From 5602481b5270553ceb5485eacc427ba1128bd6c8 Mon Sep 17 00:00:00 2001 From: Scarlett Date: Wed, 12 Feb 2025 12:44:51 -0500 Subject: [PATCH 025/105] Removed binary files #04 --- lex.yy.c | 1787 ---------------------------------------------- lexicalStructure | Bin 22584 -> 0 bytes 2 files changed, 1787 deletions(-) delete mode 100644 lex.yy.c delete mode 100755 lexicalStructure diff --git a/lex.yy.c b/lex.yy.c deleted file mode 100644 index 502a056..0000000 --- a/lex.yy.c +++ /dev/null @@ -1,1787 +0,0 @@ - -#line 2 "lex.yy.c" - -#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 7 -#define YY_END_OF_BUFFER 8 -/* 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[19] = - { 0, - 0, 0, 8, 7, 7, 4, 7, 3, 2, 6, - 0, 5, 6, 0, 0, 1, 0, 0 - } ; - -static const YY_CHAR yy_ec[256] = - { 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, 2, - 3, 4, 1, 5, 6, 1, 1, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 8, 9, 1, - 1, 10, 1, 1, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, - 1, 1, 1, 1, 11, 1, 11, 11, 11, 11, - - 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 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, 1, 1, 1 - } ; - -static const YY_CHAR yy_meta[12] = - { 0, - 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, - 2 - } ; - -static const flex_int16_t yy_base[21] = - { 0, - 0, 0, 23, 24, 18, 24, 11, 24, 24, 0, - 16, 24, 0, 15, 9, 24, 11, 24, 16, 15 - } ; - -static const flex_int16_t yy_def[21] = - { 0, - 18, 1, 18, 18, 18, 18, 18, 18, 18, 19, - 20, 18, 19, 20, 20, 18, 20, 0, 18, 18 - } ; - -static const flex_int16_t yy_nxt[36] = - { 0, - 4, 5, 4, 4, 6, 7, 4, 8, 9, 4, - 10, 16, 17, 18, 17, 14, 14, 13, 15, 15, - 12, 11, 18, 3, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18 - } ; - -static const flex_int16_t yy_chk[36] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 15, 15, 17, 17, 20, 20, 19, 14, 11, - 7, 5, 3, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18 - } ; - -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 "lexicalStructure.lex" -/* Lexical Analysis with Flex (2.6.0) We used some of the code from this manual */ -/* so we placed the citation here. */ -/* definitions */ -#line 6 "lexicalStructure.lex" -#include "typedefs.h" -#line 458 "lex.yy.c" -#line 459 "lex.yy.c" - -#define INITIAL 0 - -#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 - - static void yyunput ( int c, char *buf_ptr ); - -#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 \ - 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 12 "lexicalStructure.lex" - - -#line 679 "lex.yy.c" - - 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_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 >= 19 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 24 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - 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: -/* rule 1 can match eol */ -YY_RULE_SETUP -#line 14 "lexicalStructure.lex" -{return COMMENT;} - YY_BREAK -case 2: -YY_RULE_SETUP -#line 16 "lexicalStructure.lex" -{return SEMI_COLON;} - YY_BREAK -case 3: -YY_RULE_SETUP -#line 17 "lexicalStructure.lex" -{return COLON;} - YY_BREAK -case 4: -YY_RULE_SETUP -#line 18 "lexicalStructure.lex" -{return COMMA;} - YY_BREAK -case 5: -YY_RULE_SETUP -#line 19 "lexicalStructure.lex" -{return ARROW;} - YY_BREAK -case 6: -YY_RULE_SETUP -#line 21 "lexicalStructure.lex" -{return ID;} - YY_BREAK -case 7: -YY_RULE_SETUP -#line 23 "lexicalStructure.lex" -ECHO; - YY_BREAK -#line 772 "lex.yy.c" -case YY_STATE_EOF(INITIAL): - yyterminate(); - - 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_c_buf_p); - 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); - - 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 >= 19 ) - 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 >= 19 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - yy_is_jam = (yy_current_state == 18); - - return yy_is_jam ? 0 : yy_current_state; -} - -#ifndef YY_NO_UNPUT - - static void yyunput (int c, char * yy_bp ) -{ - char *yy_cp; - - yy_cp = (yy_c_buf_p); - - /* undo effects of setting up yytext */ - *yy_cp = (yy_hold_char); - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - int number_to_move = (yy_n_chars) + 2; - char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; -} - -#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); - - 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 23 "lexicalStructure.lex" - - -int main(int argc, char *argv[]){ - argc--, argv++; - if ( argc > 0 ) - yyin = fopen( argv[0], "r" ); - else - yyin = stdin; - yylex(); -} diff --git a/lexicalStructure b/lexicalStructure deleted file mode 100755 index 2940a82930eef9200385906d773343955b7af016..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 22584 zcmeHP3wTu3oxc-uAs`_kIucZ56x#BP0Re;f2#>+53m7f2_TdggG9jr+CY{V6aT^;u zpp4hJ)Vh`0ZkMXty0&($wrVY_0g;Jrbwg_{RqCcL>WslQ7L?Q?v%lYY+_^I(Yqbi+G zJElrGO*P-iuTt`jJbFmwr>R?yzUjMI>h-P8rF)cL8dd$Z9%1VBE4_ZD=TPN{enquE z=@VX6%3eOL29Kdy{2E5S-X^7&Pgf{;O_>M7C*O$H|5x&>QF^@#q@8?vk*b%bI=`!+ zN5A~JK{xZ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500 Subject: [PATCH 026/105] removed unneeded files --- lex.yy.c | 1822 ------------------------------------------------------ testlex | Bin 27176 -> 0 bytes 2 files changed, 1822 deletions(-) delete mode 100644 lex.yy.c delete mode 100755 testlex diff --git a/lex.yy.c b/lex.yy.c deleted file mode 100644 index f3d9cd1..0000000 --- a/lex.yy.c +++ /dev/null @@ -1,1822 +0,0 @@ - -#line 3 "lex.yy.c" - -#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 9 -#define YY_END_OF_BUFFER 10 -/* 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[34] = - { 0, - 0, 0, 10, 8, 8, 8, 8, 1, 8, 8, - 8, 0, 6, 0, 0, 0, 0, 1, 0, 0, - 0, 3, 0, 0, 0, 0, 0, 7, 0, 2, - 4, 5, 0 - } ; - -static const YY_CHAR yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 4, 1, 1, 1, 1, 5, 6, - 7, 8, 1, 1, 1, 1, 1, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 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, 10, 1, 1, 1, 1, 11, 1, 1, 1, - - 12, 13, 1, 1, 1, 1, 1, 14, 1, 15, - 1, 1, 1, 16, 17, 18, 19, 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, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static const YY_CHAR yy_meta[20] = - { 0, - 1, 2, 3, 1, 2, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1 - } ; - -static const flex_int16_t yy_base[37] = - { 0, - 0, 0, 47, 62, 16, 36, 37, 35, 30, 21, - 22, 17, 62, 24, 32, 38, 28, 26, 20, 19, - 13, 62, 23, 23, 12, 11, 12, 62, 11, 62, - 62, 62, 62, 56, 21, 58 - } ; - -static const flex_int16_t yy_def[37] = - { 0, - 33, 1, 33, 33, 34, 35, 33, 33, 33, 33, - 33, 34, 33, 33, 33, 33, 36, 33, 33, 33, - 33, 33, 36, 36, 33, 33, 33, 33, 33, 33, - 33, 33, 0, 33, 33, 33 - } ; - -static const flex_int16_t yy_nxt[82] = - { 0, - 4, 4, 4, 5, 6, 7, 4, 4, 8, 4, - 4, 4, 9, 4, 10, 4, 4, 11, 4, 13, - 13, 15, 32, 31, 30, 14, 14, 12, 29, 28, - 24, 27, 26, 25, 18, 24, 22, 21, 12, 20, - 19, 12, 15, 18, 17, 16, 33, 33, 33, 33, - 33, 33, 15, 33, 33, 15, 12, 12, 23, 23, - 23, 3, 33, 33, 33, 33, 33, 33, 33, 33, - 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, - 33 - } ; - -static const flex_int16_t yy_chk[82] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, - 12, 35, 29, 27, 26, 5, 12, 14, 25, 24, - 23, 21, 20, 19, 18, 17, 15, 11, 14, 10, - 9, 14, 16, 8, 7, 6, 3, 0, 0, 0, - 0, 0, 16, 0, 0, 16, 34, 34, 36, 36, - 36, 33, 33, 33, 33, 33, 33, 33, 33, 33, - 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, - 33 - } ; - -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 "lexicalStructure.lex" -#line 2 "lexicalStructure.lex" - /* so we placed the citation here. */ - /* definitions */ -#include "typedefs.h" -#line 474 "lex.yy.c" -#line 13 "lexicalStructure.lex" - /* char can be a newline, tab, an escaped quote, or anything but a single quote, an actual line break, an actual tab, or a backslash by itself (to prevent confusion from escaped quote */ - /*similar to above, a string Char (SCHAR) is the same as a CHAR except we cannot have double quotes instead of single quotes. Double quotes need to be escaped in Flex unlike single quotes based on documentation */ - /*Making the contents of a comment anything that is either not a * or not a * followed by ) to terminate comments at the first ENDCOM */ -#line 479 "lex.yy.c" - -#define INITIAL 0 - -#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 - - static void yyunput ( int c, char *buf_ptr ); - -#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 \ - 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 20 "lexicalStructure.lex" - - - /* rules */ -#line 700 "lex.yy.c" - - 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_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 >= 34 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 62 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - 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 23 "lexicalStructure.lex" -{printf( "C_INTEGER: %s (%d)\n", yytext, atoi( yytext ) );} - YY_BREAK -case 2: -YY_RULE_SETUP -#line 25 "lexicalStructure.lex" -{printf( "C_NULL: %s (%d)\n", yytext, atoi( yytext ) );} - YY_BREAK -case 3: -YY_RULE_SETUP -#line 27 "lexicalStructure.lex" -{printf( "C_CHARACTER: %s (%d)\n", yytext, atoi( yytext ) );} /*using double \ per documentation to show escaped chars*/ - YY_BREAK -case 4: -YY_RULE_SETUP -#line 29 "lexicalStructure.lex" -{printf( "C_TRUE: %s (%d)\n", yytext, atoi( yytext ) );} - YY_BREAK -case 5: -YY_RULE_SETUP -#line 31 "lexicalStructure.lex" -{printf( "C_FALSE: %s (%d)\n", yytext, atoi( yytext ) );} - YY_BREAK -case 6: -YY_RULE_SETUP -#line 33 "lexicalStructure.lex" -{printf( "C_STRING: %s (%d)\n", yytext, atoi( yytext ) );} - YY_BREAK -case 7: -/* rule 7 can match eol */ -YY_RULE_SETUP -#line 35 "lexicalStructure.lex" -{printf( "COMMENT: %s (%d)\n", yytext, atoi( yytext ) );} - YY_BREAK -case 8: -/* rule 8 can match eol */ -YY_RULE_SETUP -#line 37 "lexicalStructure.lex" - - YY_BREAK -case 9: -YY_RULE_SETUP -#line 39 "lexicalStructure.lex" -ECHO; - YY_BREAK -#line 804 "lex.yy.c" -case YY_STATE_EOF(INITIAL): - yyterminate(); - - 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_c_buf_p); - 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); - - 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 >= 34 ) - 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 >= 34 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - yy_is_jam = (yy_current_state == 33); - - return yy_is_jam ? 0 : yy_current_state; -} - -#ifndef YY_NO_UNPUT - - static void yyunput (int c, char * yy_bp ) -{ - char *yy_cp; - - yy_cp = (yy_c_buf_p); - - /* undo effects of setting up yytext */ - *yy_cp = (yy_hold_char); - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - int number_to_move = (yy_n_chars) + 2; - char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; -} - -#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); - - 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 39 "lexicalStructure.lex" - - /* user code */ - -int main( int argc, char **argv ) -{ - argc--, argv++; /* skip over program name */ - if ( argc > 0 ) - yyin = fopen( argv[0], "r" ); - else - yyin = stdin; - yylex(); - -} - diff --git a/testlex b/testlex deleted file mode 100755 index c99693f57f49713151d8f3eef78ece40f5981779..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 27176 zcmeHwdw5jUx%Zlc4dD_Jkdc5~h6oryLZE0t3x>2s_-9FI~?wHgqasI?6hTddd<726rZ@x*{NT4cW8yDoe7-el-` zzVCd`bNJ=Fd2U8)FEoPM3GFl+Tl2KD3BOt|W0n5hs z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PG zC9r@k0G`c7$jh`+bxtbTTvo-2UW(5Ue3X8={~v*5DH!_#k!1L#qeb8T|0GP6a*C*Z zqe|2HlR1BN{-vl(2})|$zX|wXaki<-ug-rJRp$lR-tb^AzYpkee3X8V^q->iK86C7 zk^HRm)j4e~Fj7(a>bzM|b-oM{9>|6{Y(#?2Zk4_|uT}IaDXhw`}f~ zsNCkASAJE7Hbls$O21fEP*L^Vq4Kxa|52&GR2o$0-HNL7andKB+4c7TBcCYy#y(c= zXQ_XigT4J92h*(Yl6s2rcey45l5J%3q)op>J^(AKasPs(o^)` zZ2IasO3_b@2W(LSrKigCvQ1x|TPUjDvnYAH|6Y~)s{L89l$5mIXc&RJBwLX;5uqw7 zeRZCtDE&=?IoR`m7fiE$`${3L=omcrn1kv+3i}9=k@(1AYn(r;|JTGWuhNQs3f&x& zzIwk@um&K4k`t*^TH#-TK`v7Ht8+f}|I{eQ(ELF`>8W;n8W`2z(D#xQ{=VRPK|2L8 zzLmbBgQ0BJXXR3~L{N2}tPChUl^y|Q!c_jQa={rR^>-;jNnN%y{r?A)e~}GW`to?e z;F2r_GgW;@aKv}9%)djvsGA6wj%-x<)%-gYm@2!_6yI653VMyL|EheIEDhKG^jG?X L#CV&6Ey?~5kEO7# From 4e4d0280ec00f00d7360ef9f4f5a8de90e9e3879 Mon Sep 17 00:00:00 2001 From: Scarlett Date: Wed, 12 Feb 2025 14:21:46 -0500 Subject: [PATCH 027/105] Dev Cleanup --- tests/{generalTokenTest.alpha => test_generalTokenTest.alpha} | 0 tests/{simpleIntTest.alpha => test_simpleIntTest.alpha} | 0 ...mpleLiteralAndCommentsTest.alpha => test_simpleLiterals.alpha} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename tests/{generalTokenTest.alpha => test_generalTokenTest.alpha} (100%) rename tests/{simpleIntTest.alpha => test_simpleIntTest.alpha} (100%) rename tests/{simpleLiteralAndCommentsTest.alpha => test_simpleLiterals.alpha} (100%) diff --git a/tests/generalTokenTest.alpha b/tests/test_generalTokenTest.alpha similarity index 100% rename from tests/generalTokenTest.alpha rename to tests/test_generalTokenTest.alpha diff --git a/tests/simpleIntTest.alpha b/tests/test_simpleIntTest.alpha similarity index 100% rename from tests/simpleIntTest.alpha rename to tests/test_simpleIntTest.alpha diff --git a/tests/simpleLiteralAndCommentsTest.alpha b/tests/test_simpleLiterals.alpha similarity index 100% rename from tests/simpleLiteralAndCommentsTest.alpha rename to tests/test_simpleLiterals.alpha From 0ee652ed06e97f0f564c0afdebab8f84a5a5ce41 Mon Sep 17 00:00:00 2001 From: Scarlett Date: Wed, 12 Feb 2025 14:23:57 -0500 Subject: [PATCH 028/105] Test cases added --- Makefile | 8 +++- lexicalStructure.lex | 100 ++++++++++++++++++++++++------------------- runner.c | 5 +-- runner.h | 7 +-- 4 files changed, 68 insertions(+), 52 deletions(-) diff --git a/Makefile b/Makefile index 3a7cffc..088910d 100644 --- a/Makefile +++ b/Makefile @@ -7,8 +7,14 @@ lexicalStructure: $(FLEX) $(LEX) $(CC) lex.yy.c -o $(EXE) -test_operators: +test: + ./$(EXE) ./tests/test_comments.alpha + ./$(EXE) ./tests/test_generalTokenTest.alpha + ./$(EXE) ./tests/test_keywords.alpha ./$(EXE) ./tests/test_operators.alpha + ./$(EXE) ./tests/test_otherpunc.alpha + ./$(EXE) ./tests/test_simpleIntTest.alpha + ./$(EXE) ./tests/test_simpleLiteral.alpha clean: rm -f *.o diff --git a/lexicalStructure.lex b/lexicalStructure.lex index 14b8616..28bc93e 100644 --- a/lexicalStructure.lex +++ b/lexicalStructure.lex @@ -4,8 +4,10 @@ %option noyywrap %{ -#include "typedefs.h" -int line_number = 1, column_number = 1; + #include + #include "typedefs.h" + int line_number = 1, column_number = 1; + bool DEBUG = true; %} COM ([^*]|\*+[^)*])* @@ -18,55 +20,63 @@ SCHAR \\n|\\t|\\\"|[^\"\n\\] %% -"integer" {return T_INTEGER;} -"address" {return T_ADDRESS;} -"Boolean" {return T_BOOLEAN;} -"character" {return T_CHARACTER;} +"integer" {if(DEBUG) {printf( "T_INTEGER: %s (%d)\n", yytext, T_INTEGER);} else {return T_INTEGER;}} +"address" {if(DEBUG) {printf( "T_ADDRESS: %s (%d)\n", yytext, T_ADDRESS);} else {return T_ADDRESS;}} +"Boolean" {if(DEBUG) {printf( "T_BOOLEAN: %s (%d)\n", yytext, T_BOOLEAN);} else {return T_BOOLEAN;}} +"character" {if(DEBUG) {printf( "T_CHARACTER: %s (%d)\n", yytext, T_CHARACTER);} else {return T_CHARACTER;}} -{DIGIT}+ {return C_INTEGER;} -"null" {return C_NULL;} +"while" {if(DEBUG) {printf( "WHILE: %s (%d)\n", yytext, WHILE);} else {return WHILE;}} +"if" {if(DEBUG) {printf( "IF: %s (%d)\n", yytext, IF);} else {return IF;}} +"then" {if(DEBUG) {printf( "THEN: %s (%d)\n", yytext, THEN);} else {return THEN;}} +"else" {if(DEBUG) {printf( "ELSE: %s (%d)\n", yytext, ELSE);} else {return ELSE;}} +"type" {if(DEBUG) {printf( "TYPE: %s (%d)\n", yytext, TYPE);} else {return TYPE;}} +"function" {if(DEBUG) {printf( "FUNCTION: %s (%d)\n", yytext, FUNCTION);} else {return FUNCTION;}} +"return" {if(DEBUG) {printf( "RETURN: %s (%d)\n", yytext, RETURN);} else {return RETURN;}} +"external" {if(DEBUG) {printf( "EXTERNAL: %s (%d)\n", yytext, EXTERNAL);} else {return EXTERNAL;}} +"as" {if(DEBUG) {printf( "AS: %s (%d)\n", yytext, AS);} else {return AS;}} -"while" {return WHILE;} -"if" {return IF;} -"then" {return THEN;} -"else" {return ELSE;} -"type" {return TYPE;} -"function" {return FUNCTION;} -"return" {return RETURN;} -"external" {return EXTERNAL;} -"as" {return AS;} +"release" {if(DEBUG) {printf( "RELEASE: %s (%d)\n", yytext, RELEASE);} else {return RELEASE;}} +"reserve" {if(DEBUG) {printf( "RESERVE: %s (%d)\n", yytext, RESERVE);} else {return RESERVE;}} -'{CHAR}' {return C_CHARACTER;} -"true" {return C_TRUE;} -"false" {return C_FALSE;} +"+" {if(DEBUG) {printf( "ADD: %s (%d)\n", yytext, ADD);} else {return ADD;}} +"-" {if(DEBUG) {printf( "SUB_OR_NEG: %s (%d)\n", yytext, SUB_OR_NEG);} else {return SUB_OR_NEG;}} +"*" {if(DEBUG) {printf( "MUL: %s (%d)\n", yytext, MUL);} else {return MUL;}} +"/" {if(DEBUG) {printf( "DIV: %s (%d)\n", yytext, DIV);} else {return DIV;}} +"%" {if(DEBUG) {printf( "REM: %s (%d)\n", yytext, REM);} else {return REM;}} +"<" {if(DEBUG) {printf( "LESS_THAN: %s (%d)\n", yytext, LESS_THAN);} else {return LESS_THAN;}} +"=" {if(DEBUG) {printf( "EQUAL_TO: %s (%d)\n", yytext, EQUAL_TO);} else {return EQUAL_TO;}} +":=" {if(DEBUG) {printf( "ASSIGN: %s (%d)\n", yytext, ASSIGN);} else {return ASSIGN;}} +"!" {if(DEBUG) {printf( "NOT: %s (%d)\n", yytext, NOT);} else {return NOT;}} +"&" {if(DEBUG) {printf( "AND: %s (%d)\n", yytext, AND);} else {return AND;}} +"|" {if(DEBUG) {printf( "OR: %s (%d)\n", yytext, OR);} else {return OR;}} +"." {if(DEBUG) {printf( "DOT: %s (%d)\n", yytext, DOT);} else {return DOT;}} -"+" {return ADD;} -"-" {return SUB_OR_NEG;} -"*" {return MUL;} -"/" {return DIV;} -"%" {return REM;} -"<" {return LESS_THAN;} -"=" {return EQUAL_TO;} -":=" {return ASSIGN;} -"!" {return NOT;} -"&" {return AND;} -"|" {return OR;} -"." {return DOT;} +";" {if(DEBUG) {printf( "SEMI_COLON: %s (%d)\n", yytext, SEMI_COLON);} else {return SEMI_COLON;}} +":" {if(DEBUG) {printf( "COLON: %s (%d)\n", yytext, COLON);} else {return COLON;}} +"," {if(DEBUG) {printf( "COMMA: %s (%d)\n", yytext, COMMA);} else {return COMMA;}} +"->" {if(DEBUG) {printf( "ARROW: %s (%d)\n", yytext, ARROW);} else {return ARROW;}} -";" {return SEMI_COLON;} -":" {return COLON;} -"," {return COMMA;} -"->" {return ARROW;} +{DIGIT}+ {if(DEBUG) {printf( "C_INTEGER: %s (%d)\n", yytext, C_INTEGER);} else {return C_INTEGER;}} +'{CHAR}' {if(DEBUG) {printf( "C_CHARACTER: %s (%d)\n", yytext, C_CHARACTER);} else {return C_CHARACTER;}} +\"{SCHAR}*\" {if(DEBUG) {printf( "C_STRING: %s (%d)\n", yytext, C_STRING);} else {return C_STRING;}} +"(*"{COM}"*)" {if(DEBUG) {printf( "COMMENT: %s (%d)\n", yytext, COMMENT);} else {return COMMENT;}} +"true" {if(DEBUG) {printf( "C_TRUE: %s (%d)\n", yytext, C_TRUE);} else {return C_TRUE;}} +"false" {if(DEBUG) {printf( "C_FALSE: %s (%d)\n", yytext, C_FALSE);} else {return C_FALSE;}} +"null" {if(DEBUG) {printf( "C_NULL: %s (%d)\n", yytext, C_NULL);} else {return C_NULL;}} -"reserve" {return RESERVE;} -"release" {return RELEASE;} +{ID} {if(DEBUG) {printf( "ID: %s (%d)\n", yytext, ID);} else {return ID;}} -\"{SCHAR}*\" {return C_STRING;} -"(*"{COM}"*)" {return COMMENT;} +\n {line_number++; column_number = 1;} +. {column_number++;} -{ID} {return ID;} +%% -\n {line_number++; column_number = 1;} -. {column_number++;} - -%% \ No newline at end of file +int main( int argc, char **argv ) +{ + argc--, argv++; + if ( argc > 0 ) + yyin = fopen( argv[0], "r" ); + else + yyin = stdin; + yylex(); +} \ No newline at end of file diff --git a/runner.c b/runner.c index 3d467b8..8910672 100644 --- a/runner.c +++ b/runner.c @@ -1,7 +1,6 @@ #include "runner.h" - -int main(int argc, char *argv[]) { +int main(int argc, char ** argv) { char *check_input; int token; //check_input can be compared to INVALID_ARG and DIFF_ARG to determine if -tok and holds the generated file name if it is @@ -35,4 +34,4 @@ char *is_tok(int argc, char *argv[]) { return FILE_tok; } return DIFF_ARG; -} +} \ No newline at end of file diff --git a/runner.h b/runner.h index 080d5c1..406f0fc 100644 --- a/runner.h +++ b/runner.h @@ -3,11 +3,12 @@ #define INVALID_ARG "invalid" #define DIFF_ARG "diff" #include -#include +#include #include "lex.yy.c" extern int line_number, column_number; extern char *yytext; -int main(int argc, char* argv); -char *is_tok(int argc, char* argv);#define ALPHA_OFFSET 5 +int main(int argc, char *argv[]); +char *is_tok(int argc, char *argv[]); +#define ALPHA_OFFSET 5 From b4945182089be5a04c9f7cf489d8d4af6840d7fc Mon Sep 17 00:00:00 2001 From: Scarlett Date: Wed, 12 Feb 2025 14:26:12 -0500 Subject: [PATCH 029/105] Update to match filename --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 088910d..e34c3a4 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ test: ./$(EXE) ./tests/test_operators.alpha ./$(EXE) ./tests/test_otherpunc.alpha ./$(EXE) ./tests/test_simpleIntTest.alpha - ./$(EXE) ./tests/test_simpleLiteral.alpha + ./$(EXE) ./tests/test_simpleLiterals.alpha clean: rm -f *.o From c13f76f365ccab04a797196b3fd368bf4c1b33ba Mon Sep 17 00:00:00 2001 From: Meyer Simon Date: Wed, 12 Feb 2025 15:22:59 -0500 Subject: [PATCH 030/105] Added tests for grouping t#09 --- lexicalStructure.lex | 4 +-- tests/test_punctuation_grouping.alpha | 35 +++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 tests/test_punctuation_grouping.alpha diff --git a/lexicalStructure.lex b/lexicalStructure.lex index 28bc93e..121eb47 100644 --- a/lexicalStructure.lex +++ b/lexicalStructure.lex @@ -15,7 +15,7 @@ ID [A-Za-z_][0-9A-Za-z_]* DIGIT [0-9] CHAR \\n|\\t|\\'|[^'\n\t\\] /* char can be a newline, tab, an escaped quote, or anything but a single quote, an actual line break, an actual tab, or a backslash by itself (to prevent confusion from escaped quote */ -SCHAR \\n|\\t|\\\"|[^\"\n\\] +SCHAR \\n|\\t|\\\"|[^\"\n\\] /* similar to above, a string Char (SCHAR) is the same as a CHAR except we cannot have double quotes instead of single quotes. Double quotes need to be escaped in Flex unlike single quotes based on documentation */ %% @@ -79,4 +79,4 @@ int main( int argc, char **argv ) else yyin = stdin; yylex(); -} \ No newline at end of file +} diff --git a/tests/test_punctuation_grouping.alpha b/tests/test_punctuation_grouping.alpha new file mode 100644 index 0000000..149cadc --- /dev/null +++ b/tests/test_punctuation_grouping.alpha @@ -0,0 +1,35 @@ +) +a) +)a +)* +*) +( +a( +(a +(* +*( + + +{ +a{ +{a +{* +*{ +} +a} +}a +}* +*} + + + +[ +a[ +[a +[* +*[ +] +a] +]a +]* +*] From 99c62758f644a7c23d0c52de8867a06abea85bff Mon Sep 17 00:00:00 2001 From: Meyer Simon Date: Wed, 12 Feb 2025 16:12:33 -0500 Subject: [PATCH 031/105] Added code to lexer to recognize the groupings/punct's t#09 --- lex.yy.c | 2050 ++++++++++++++++++++++++++++++++++++++++++ lexicalStructure | Bin 0 -> 31336 bytes lexicalStructure.lex | 11 + 3 files changed, 2061 insertions(+) create mode 100644 lex.yy.c create mode 100755 lexicalStructure diff --git a/lex.yy.c b/lex.yy.c new file mode 100644 index 0000000..0b592db --- /dev/null +++ b/lex.yy.c @@ -0,0 +1,2050 @@ + +#line 3 "lex.yy.c" + +#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 42 +#define YY_END_OF_BUFFER 43 +/* 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[131] = + { 0, + 0, 0, 43, 41, 40, 24, 41, 20, 25, 41, + 41, 18, 16, 30, 17, 27, 19, 32, 29, 28, + 21, 22, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 26, 0, 34, 0, 0, 0, 0, + 31, 32, 23, 39, 39, 39, 13, 39, 39, 39, + 39, 39, 6, 39, 39, 39, 39, 39, 39, 39, + 33, 0, 0, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 35, + 0, 39, 39, 39, 8, 39, 39, 39, 39, 38, + 39, 39, 39, 7, 36, 9, 39, 39, 39, 39, + + 39, 37, 39, 39, 39, 39, 39, 5, 39, 39, + 39, 39, 39, 39, 39, 39, 11, 3, 2, 39, + 39, 39, 1, 14, 15, 39, 12, 10, 4, 0 + } ; + +static const YY_CHAR yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 4, 5, 1, 1, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 18, 19, 20, + 21, 22, 1, 1, 23, 24, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 1, 25, 1, 1, 23, 1, 26, 23, 27, 28, + + 29, 30, 31, 32, 33, 23, 23, 34, 23, 35, + 36, 37, 23, 38, 39, 40, 41, 42, 43, 44, + 45, 23, 1, 46, 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, 1 + } ; + +static const YY_CHAR yy_meta[47] = + { 0, + 1, 2, 3, 1, 1, 1, 1, 2, 1, 1, + 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, + 1, 1, 4, 4, 1, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 1 + } ; + +static const flex_int16_t yy_base[135] = + { 0, + 0, 0, 160, 161, 161, 161, 42, 161, 161, 134, + 147, 161, 161, 161, 135, 161, 161, 139, 134, 161, + 161, 161, 0, 118, 20, 121, 16, 23, 21, 111, + 122, 20, 118, 161, 48, 161, 49, 141, 47, 137, + 161, 130, 161, 0, 110, 117, 0, 118, 104, 102, + 107, 105, 0, 99, 104, 23, 108, 95, 98, 101, + 161, 122, 58, 98, 93, 92, 100, 99, 88, 99, + 96, 90, 94, 93, 80, 85, 90, 89, 83, 161, + 60, 87, 86, 88, 0, 75, 83, 71, 79, 0, + 83, 70, 69, 0, 0, 0, 77, 79, 65, 76, + + 67, 0, 63, 66, 53, 46, 51, 0, 50, 44, + 41, 54, 43, 40, 48, 47, 0, 0, 0, 46, + 40, 37, 0, 0, 0, 28, 0, 0, 0, 161, + 89, 93, 57, 97 + } ; + +static const flex_int16_t yy_def[135] = + { 0, + 130, 1, 130, 130, 130, 130, 131, 130, 130, 132, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 130, 131, 130, 130, 130, 130, 134, + 130, 130, 130, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 130, 134, 134, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 130, + 134, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 0, + 130, 130, 130, 130 + } ; + +static const flex_int16_t yy_nxt[208] = + { 0, + 4, 4, 5, 6, 7, 8, 9, 10, 11, 4, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 4, 23, 24, 4, 25, 26, 23, 27, 28, + 23, 23, 29, 23, 30, 23, 23, 31, 23, 32, + 23, 23, 33, 23, 23, 34, 36, 46, 51, 49, + 53, 57, 36, 35, 38, 54, 73, 58, 47, 50, + 44, 74, 75, 52, 59, 129, 37, 80, 81, 130, + 81, 128, 37, 127, 126, 125, 124, 123, 122, 121, + 120, 38, 119, 35, 118, 117, 38, 116, 35, 35, + 35, 115, 35, 38, 114, 113, 38, 62, 62, 62, + + 62, 112, 111, 110, 109, 108, 107, 106, 105, 104, + 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, + 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, + 83, 82, 63, 79, 78, 77, 76, 72, 71, 70, + 69, 68, 67, 66, 65, 64, 42, 63, 61, 60, + 56, 55, 48, 45, 43, 42, 41, 40, 39, 130, + 3, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + + 130, 130, 130, 130, 130, 130, 130 + } ; + +static const flex_int16_t yy_chk[208] = + { 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, 1, 7, 25, 28, 27, + 29, 32, 35, 37, 39, 29, 56, 32, 25, 27, + 133, 56, 56, 28, 32, 126, 7, 63, 63, 81, + 81, 122, 35, 121, 120, 116, 115, 114, 113, 112, + 111, 39, 110, 37, 109, 107, 39, 106, 37, 131, + 131, 105, 131, 132, 104, 103, 132, 134, 134, 134, + + 134, 101, 100, 99, 98, 97, 93, 92, 91, 89, + 88, 87, 86, 84, 83, 82, 79, 78, 77, 76, + 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, + 65, 64, 62, 60, 59, 58, 57, 55, 54, 52, + 51, 50, 49, 48, 46, 45, 42, 40, 38, 33, + 31, 30, 26, 24, 19, 18, 15, 11, 10, 3, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + + 130, 130, 130, 130, 130, 130, 130 + } ; + +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 "lexicalStructure.lex" +/* Lexical Analysis with Flex (1.6.0) We used some of the code from this manual */ +/* so we placed the citation here. */ +/* definitions */ +#line 7 "lexicalStructure.lex" + #include + #include "typedefs.h" + int line_number = 1, column_number = 1; + bool DEBUG = true; +#line 541 "lex.yy.c" +#line 18 "lexicalStructure.lex" + /* char can be a newline, tab, an escaped quote, or anything but a single quote, an actual line break, an actual tab, or a backslash by itself (to prevent confusion from escaped quote */ + /* similar to above, a string Char (SCHAR) is the same as a CHAR except we cannot have double quotes instead of single quotes. Double quotes need to be escaped in Flex unlike single quotes based on documentation */ +#line 545 "lex.yy.c" + +#define INITIAL 0 + +#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 + + static void yyunput ( int c, char *buf_ptr ); + +#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 \ + 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 22 "lexicalStructure.lex" + + +#line 765 "lex.yy.c" + + 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_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 >= 131 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 161 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + 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 24 "lexicalStructure.lex" +{if(DEBUG) {printf( "T_INTEGER: %s (%d)\n", yytext, T_INTEGER);} else {return T_INTEGER;}} + YY_BREAK +case 2: +YY_RULE_SETUP +#line 25 "lexicalStructure.lex" +{if(DEBUG) {printf( "T_ADDRESS: %s (%d)\n", yytext, T_ADDRESS);} else {return T_ADDRESS;}} + YY_BREAK +case 3: +YY_RULE_SETUP +#line 26 "lexicalStructure.lex" +{if(DEBUG) {printf( "T_BOOLEAN: %s (%d)\n", yytext, T_BOOLEAN);} else {return T_BOOLEAN;}} + YY_BREAK +case 4: +YY_RULE_SETUP +#line 27 "lexicalStructure.lex" +{if(DEBUG) {printf( "T_CHARACTER: %s (%d)\n", yytext, T_CHARACTER);} else {return T_CHARACTER;}} + YY_BREAK +case 5: +YY_RULE_SETUP +#line 29 "lexicalStructure.lex" +{if(DEBUG) {printf( "WHILE: %s (%d)\n", yytext, WHILE);} else {return WHILE;}} + YY_BREAK +case 6: +YY_RULE_SETUP +#line 30 "lexicalStructure.lex" +{if(DEBUG) {printf( "IF: %s (%d)\n", yytext, IF);} else {return IF;}} + YY_BREAK +case 7: +YY_RULE_SETUP +#line 31 "lexicalStructure.lex" +{if(DEBUG) {printf( "THEN: %s (%d)\n", yytext, THEN);} else {return THEN;}} + YY_BREAK +case 8: +YY_RULE_SETUP +#line 32 "lexicalStructure.lex" +{if(DEBUG) {printf( "ELSE: %s (%d)\n", yytext, ELSE);} else {return ELSE;}} + YY_BREAK +case 9: +YY_RULE_SETUP +#line 33 "lexicalStructure.lex" +{if(DEBUG) {printf( "TYPE: %s (%d)\n", yytext, TYPE);} else {return TYPE;}} + YY_BREAK +case 10: +YY_RULE_SETUP +#line 34 "lexicalStructure.lex" +{if(DEBUG) {printf( "FUNCTION: %s (%d)\n", yytext, FUNCTION);} else {return FUNCTION;}} + YY_BREAK +case 11: +YY_RULE_SETUP +#line 35 "lexicalStructure.lex" +{if(DEBUG) {printf( "RETURN: %s (%d)\n", yytext, RETURN);} else {return RETURN;}} + YY_BREAK +case 12: +YY_RULE_SETUP +#line 36 "lexicalStructure.lex" +{if(DEBUG) {printf( "EXTERNAL: %s (%d)\n", yytext, EXTERNAL);} else {return EXTERNAL;}} + YY_BREAK +case 13: +YY_RULE_SETUP +#line 37 "lexicalStructure.lex" +{if(DEBUG) {printf( "AS: %s (%d)\n", yytext, AS);} else {return AS;}} + YY_BREAK +case 14: +YY_RULE_SETUP +#line 39 "lexicalStructure.lex" +{if(DEBUG) {printf( "RELEASE: %s (%d)\n", yytext, RELEASE);} else {return RELEASE;}} + YY_BREAK +case 15: +YY_RULE_SETUP +#line 40 "lexicalStructure.lex" +{if(DEBUG) {printf( "RESERVE: %s (%d)\n", yytext, RESERVE);} else {return RESERVE;}} + YY_BREAK +case 16: +YY_RULE_SETUP +#line 42 "lexicalStructure.lex" +{if(DEBUG) {printf( "ADD: %s (%d)\n", yytext, ADD);} else {return ADD;}} + YY_BREAK +case 17: +YY_RULE_SETUP +#line 43 "lexicalStructure.lex" +{if(DEBUG) {printf( "SUB_OR_NEG: %s (%d)\n", yytext, SUB_OR_NEG);} else {return SUB_OR_NEG;}} + YY_BREAK +case 18: +YY_RULE_SETUP +#line 44 "lexicalStructure.lex" +{if(DEBUG) {printf( "MUL: %s (%d)\n", yytext, MUL);} else {return MUL;}} + YY_BREAK +case 19: +YY_RULE_SETUP +#line 45 "lexicalStructure.lex" +{if(DEBUG) {printf( "DIV: %s (%d)\n", yytext, DIV);} else {return DIV;}} + YY_BREAK +case 20: +YY_RULE_SETUP +#line 46 "lexicalStructure.lex" +{if(DEBUG) {printf( "REM: %s (%d)\n", yytext, REM);} else {return REM;}} + YY_BREAK +case 21: +YY_RULE_SETUP +#line 47 "lexicalStructure.lex" +{if(DEBUG) {printf( "LESS_THAN: %s (%d)\n", yytext, LESS_THAN);} else {return LESS_THAN;}} + YY_BREAK +case 22: +YY_RULE_SETUP +#line 48 "lexicalStructure.lex" +{if(DEBUG) {printf( "EQUAL_TO: %s (%d)\n", yytext, EQUAL_TO);} else {return EQUAL_TO;}} + YY_BREAK +case 23: +YY_RULE_SETUP +#line 49 "lexicalStructure.lex" +{if(DEBUG) {printf( "ASSIGN: %s (%d)\n", yytext, ASSIGN);} else {return ASSIGN;}} + YY_BREAK +case 24: +YY_RULE_SETUP +#line 50 "lexicalStructure.lex" +{if(DEBUG) {printf( "NOT: %s (%d)\n", yytext, NOT);} else {return NOT;}} + YY_BREAK +case 25: +YY_RULE_SETUP +#line 51 "lexicalStructure.lex" +{if(DEBUG) {printf( "AND: %s (%d)\n", yytext, AND);} else {return AND;}} + YY_BREAK +case 26: +YY_RULE_SETUP +#line 52 "lexicalStructure.lex" +{if(DEBUG) {printf( "OR: %s (%d)\n", yytext, OR);} else {return OR;}} + YY_BREAK +case 27: +YY_RULE_SETUP +#line 53 "lexicalStructure.lex" +{if(DEBUG) {printf( "DOT: %s (%d)\n", yytext, DOT);} else {return DOT;}} + YY_BREAK +case 28: +YY_RULE_SETUP +#line 55 "lexicalStructure.lex" +{if(DEBUG) {printf( "SEMI_COLON: %s (%d)\n", yytext, SEMI_COLON);} else {return SEMI_COLON;}} + YY_BREAK +case 29: +YY_RULE_SETUP +#line 56 "lexicalStructure.lex" +{if(DEBUG) {printf( "COLON: %s (%d)\n", yytext, COLON);} else {return COLON;}} + YY_BREAK +case 30: +YY_RULE_SETUP +#line 57 "lexicalStructure.lex" +{if(DEBUG) {printf( "COMMA: %s (%d)\n", yytext, COMMA);} else {return COMMA;}} + YY_BREAK +case 31: +YY_RULE_SETUP +#line 58 "lexicalStructure.lex" +{if(DEBUG) {printf( "ARROW: %s (%d)\n", yytext, ARROW);} else {return ARROW;}} + YY_BREAK +case 32: +YY_RULE_SETUP +#line 60 "lexicalStructure.lex" +{if(DEBUG) {printf( "C_INTEGER: %s (%d)\n", yytext, C_INTEGER);} else {return C_INTEGER;}} + YY_BREAK +case 33: +YY_RULE_SETUP +#line 61 "lexicalStructure.lex" +{if(DEBUG) {printf( "C_CHARACTER: %s (%d)\n", yytext, C_CHARACTER);} else {return C_CHARACTER;}} + YY_BREAK +case 34: +YY_RULE_SETUP +#line 62 "lexicalStructure.lex" +{if(DEBUG) {printf( "C_STRING: %s (%d)\n", yytext, C_STRING);} else {return C_STRING;}} + YY_BREAK +case 35: +/* rule 35 can match eol */ +YY_RULE_SETUP +#line 63 "lexicalStructure.lex" +{if(DEBUG) {printf( "COMMENT: %s (%d)\n", yytext, COMMENT);} else {return COMMENT;}} + YY_BREAK +case 36: +YY_RULE_SETUP +#line 64 "lexicalStructure.lex" +{if(DEBUG) {printf( "C_TRUE: %s (%d)\n", yytext, C_TRUE);} else {return C_TRUE;}} + YY_BREAK +case 37: +YY_RULE_SETUP +#line 65 "lexicalStructure.lex" +{if(DEBUG) {printf( "C_FALSE: %s (%d)\n", yytext, C_FALSE);} else {return C_FALSE;}} + YY_BREAK +case 38: +YY_RULE_SETUP +#line 66 "lexicalStructure.lex" +{if(DEBUG) {printf( "C_NULL: %s (%d)\n", yytext, C_NULL);} else {return C_NULL;}} + YY_BREAK +case 39: +YY_RULE_SETUP +#line 68 "lexicalStructure.lex" +{if(DEBUG) {printf( "ID: %s (%d)\n", yytext, ID);} else {return ID;}} + YY_BREAK +case 40: +/* rule 40 can match eol */ +YY_RULE_SETUP +#line 70 "lexicalStructure.lex" +{line_number++; column_number = 1;} + YY_BREAK +case 41: +YY_RULE_SETUP +#line 71 "lexicalStructure.lex" +{column_number++;} + YY_BREAK +case 42: +YY_RULE_SETUP +#line 73 "lexicalStructure.lex" +ECHO; + YY_BREAK +#line 1034 "lex.yy.c" +case YY_STATE_EOF(INITIAL): + yyterminate(); + + 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_c_buf_p); + 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); + + 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 >= 131 ) + 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 >= 131 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_is_jam = (yy_current_state == 130); + + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_UNPUT + + static void yyunput (int c, char * yy_bp ) +{ + char *yy_cp; + + yy_cp = (yy_c_buf_p); + + /* undo effects of setting up yytext */ + *yy_cp = (yy_hold_char); + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + int number_to_move = (yy_n_chars) + 2; + char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; +} + +#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); + + 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 73 "lexicalStructure.lex" + + +int main( int argc, char **argv ) +{ + argc--, argv++; + if ( argc > 0 ) + yyin = fopen( argv[0], "r" ); + else + yyin = stdin; + yylex(); +} + diff --git a/lexicalStructure b/lexicalStructure new file mode 100755 index 0000000000000000000000000000000000000000..a04030b4f589d385d2092a0766c57271c2f1fafc GIT binary patch literal 31336 zcmeHweRx#WwfCMR2LcijkTKy)M!w`T1Oy8zI!PE9GzlRj3RXIqBomUFWI{57L=7SV zWjdl*QE91tp|9S0d(~@weQio?`MIHwUxl@hVWg zTsSGFmKBvTnCT#%>dvIiBCqU`Y?PFf{?UhiSibk@FH=5v^3J{Y2YV)Ju8u#F4%M45 zq(cYUlU3C7mmozt+#im8Y_lUHiFjFDgRyDj?;CeK@K$|wnLlGuZ&VE-DYcT7$jYH^ z5nMU|fBOLZH^Fz|v>zcb`m_JU0Q@Zj@NXP|KX(9r{s4T6|NiO|2j7L$e%uO1fBMu< z{qZvg;8XbZr@wdr{`Usp|8M|)ANVeu_G2L!{grz?_#@aD=4uoOH6Ku1O%yE4X8<|U z&#~#>A^C0_pZR>18~wiO+6I4J?d<_pU0WAu2(o&AU0tveLJY4;UvtRc6!O*kYa3W~ zV^eKIsG6+{geqBeurbiU>I3!7fe>pBRRzN#R^1c`Al(ErtSKPOKm=%IUBKTIXli2B z_y{%;fajo9g_4kN2>MW}KU5oRV1bRbFm_v0Z79HMoBg3s3!}Qw$i9*-D_EYF@0*u> z#e6+EFM9#=EiWzf!DwJzZF4BlR9cu{7iQc%*ri<}`JvxFf!r=SZgF zj`*XAA&+8de=zbC)9P4l;;XruWaTD4*-}T1iO=U-DQGnDsSI^&H1Ty`L%7+*M~CUh zb`xJNUASzgiGPu<&Dd@eKh4D7YvK<#@t-vD(@p$mO?(wwByKnHN0{_GOnmcva>T@! zA;nS0Onj%w&V}R!4_xrT1rJ>C!2cf}_&oj6zk1uwq?X-gvH_rweFre6F6S z1xj!HGCfZh(%$$8Jx>?V-nc{0r}O-0U#s@g1rzO8d3fjPZ;^MFFzz4Z|BUs%IsZpn z{$pGIeOvxFw)~s6{L8ldFKzk%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&?b5M1iQ7!RW zC<~BU?rR9wR|II}QR4unH#}Li#M_=MET6BmFkg~#&{ z?8YX%CaVeWuQFH_;aa@0uC_|Da`TqYrYjOxukkn6uxvc2g(3tEH3K1j0zHS(fVQw3`(Cv1qT z6XOV#mJgAkax})X5fdyMm&JNq?W`B?|3Z%TSFsepJ-s-xuzsgQQMJD+xI$N@iB7^v zTZ;-$_hob_nj^CMr@lUr99m|Z@%HyDPS%kkq1Kg(P5V}6yxKQY)TI<9wc~FBAHOmj zRP|T;#)`^q4tl(bANKnD!KFQ8g;)E^iZ)6C)sg(H@L5RHQHzsYrtoT?T2ZwxO}ccD z4fC-c8QSwzc(u=~sJ;G5Pti@l(;l+Qt9@ieRsY%Ruj;S^3G%7Jt9@-n)qRQGf2#eD zN_?I)sP@SfRr~6MCyd>H`@kcgDEs<)R<3K+_XkknhrR!Q0InJDk~p2(94^IrF+aB9 z-SP%mQKc_RH Date: Wed, 12 Feb 2025 20:48:56 -0500 Subject: [PATCH 032/105] Tested the functionality, seems to work. t#09 --- lex.yy.c | 2050 ------------------------- lexicalStructure | Bin 31336 -> 0 bytes lexicalStructure.lex | 21 +- tests/test_punctuation_grouping.alpha | 7 + 4 files changed, 17 insertions(+), 2061 deletions(-) delete mode 100644 lex.yy.c delete mode 100755 lexicalStructure diff --git a/lex.yy.c b/lex.yy.c deleted file mode 100644 index 0b592db..0000000 --- a/lex.yy.c +++ /dev/null @@ -1,2050 +0,0 @@ - -#line 3 "lex.yy.c" - -#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 42 -#define YY_END_OF_BUFFER 43 -/* 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[131] = - { 0, - 0, 0, 43, 41, 40, 24, 41, 20, 25, 41, - 41, 18, 16, 30, 17, 27, 19, 32, 29, 28, - 21, 22, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 39, 26, 0, 34, 0, 0, 0, 0, - 31, 32, 23, 39, 39, 39, 13, 39, 39, 39, - 39, 39, 6, 39, 39, 39, 39, 39, 39, 39, - 33, 0, 0, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 39, 39, 39, 39, 39, 39, 39, 35, - 0, 39, 39, 39, 8, 39, 39, 39, 39, 38, - 39, 39, 39, 7, 36, 9, 39, 39, 39, 39, - - 39, 37, 39, 39, 39, 39, 39, 5, 39, 39, - 39, 39, 39, 39, 39, 39, 11, 3, 2, 39, - 39, 39, 1, 14, 15, 39, 12, 10, 4, 0 - } ; - -static const YY_CHAR yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 4, 5, 1, 1, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 18, 19, 20, - 21, 22, 1, 1, 23, 24, 23, 23, 23, 23, - 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, - 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, - 1, 25, 1, 1, 23, 1, 26, 23, 27, 28, - - 29, 30, 31, 32, 33, 23, 23, 34, 23, 35, - 36, 37, 23, 38, 39, 40, 41, 42, 43, 44, - 45, 23, 1, 46, 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, 1 - } ; - -static const YY_CHAR yy_meta[47] = - { 0, - 1, 2, 3, 1, 1, 1, 1, 2, 1, 1, - 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, - 1, 1, 4, 4, 1, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 1 - } ; - -static const flex_int16_t yy_base[135] = - { 0, - 0, 0, 160, 161, 161, 161, 42, 161, 161, 134, - 147, 161, 161, 161, 135, 161, 161, 139, 134, 161, - 161, 161, 0, 118, 20, 121, 16, 23, 21, 111, - 122, 20, 118, 161, 48, 161, 49, 141, 47, 137, - 161, 130, 161, 0, 110, 117, 0, 118, 104, 102, - 107, 105, 0, 99, 104, 23, 108, 95, 98, 101, - 161, 122, 58, 98, 93, 92, 100, 99, 88, 99, - 96, 90, 94, 93, 80, 85, 90, 89, 83, 161, - 60, 87, 86, 88, 0, 75, 83, 71, 79, 0, - 83, 70, 69, 0, 0, 0, 77, 79, 65, 76, - - 67, 0, 63, 66, 53, 46, 51, 0, 50, 44, - 41, 54, 43, 40, 48, 47, 0, 0, 0, 46, - 40, 37, 0, 0, 0, 28, 0, 0, 0, 161, - 89, 93, 57, 97 - } ; - -static const flex_int16_t yy_def[135] = - { 0, - 130, 1, 130, 130, 130, 130, 131, 130, 130, 132, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 130, 131, 130, 130, 130, 130, 134, - 130, 130, 130, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 130, 134, 134, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 130, - 134, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 0, - 130, 130, 130, 130 - } ; - -static const flex_int16_t yy_nxt[208] = - { 0, - 4, 4, 5, 6, 7, 8, 9, 10, 11, 4, - 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 4, 23, 24, 4, 25, 26, 23, 27, 28, - 23, 23, 29, 23, 30, 23, 23, 31, 23, 32, - 23, 23, 33, 23, 23, 34, 36, 46, 51, 49, - 53, 57, 36, 35, 38, 54, 73, 58, 47, 50, - 44, 74, 75, 52, 59, 129, 37, 80, 81, 130, - 81, 128, 37, 127, 126, 125, 124, 123, 122, 121, - 120, 38, 119, 35, 118, 117, 38, 116, 35, 35, - 35, 115, 35, 38, 114, 113, 38, 62, 62, 62, - - 62, 112, 111, 110, 109, 108, 107, 106, 105, 104, - 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, - 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, - 83, 82, 63, 79, 78, 77, 76, 72, 71, 70, - 69, 68, 67, 66, 65, 64, 42, 63, 61, 60, - 56, 55, 48, 45, 43, 42, 41, 40, 39, 130, - 3, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - - 130, 130, 130, 130, 130, 130, 130 - } ; - -static const flex_int16_t yy_chk[208] = - { 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, 1, 7, 25, 28, 27, - 29, 32, 35, 37, 39, 29, 56, 32, 25, 27, - 133, 56, 56, 28, 32, 126, 7, 63, 63, 81, - 81, 122, 35, 121, 120, 116, 115, 114, 113, 112, - 111, 39, 110, 37, 109, 107, 39, 106, 37, 131, - 131, 105, 131, 132, 104, 103, 132, 134, 134, 134, - - 134, 101, 100, 99, 98, 97, 93, 92, 91, 89, - 88, 87, 86, 84, 83, 82, 79, 78, 77, 76, - 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, - 65, 64, 62, 60, 59, 58, 57, 55, 54, 52, - 51, 50, 49, 48, 46, 45, 42, 40, 38, 33, - 31, 30, 26, 24, 19, 18, 15, 11, 10, 3, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - - 130, 130, 130, 130, 130, 130, 130 - } ; - -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 "lexicalStructure.lex" -/* Lexical Analysis with Flex (1.6.0) We used some of the code from this manual */ -/* so we placed the citation here. */ -/* definitions */ -#line 7 "lexicalStructure.lex" - #include - #include "typedefs.h" - int line_number = 1, column_number = 1; - bool DEBUG = true; -#line 541 "lex.yy.c" -#line 18 "lexicalStructure.lex" - /* char can be a newline, tab, an escaped quote, or anything but a single quote, an actual line break, an actual tab, or a backslash by itself (to prevent confusion from escaped quote */ - /* similar to above, a string Char (SCHAR) is the same as a CHAR except we cannot have double quotes instead of single quotes. Double quotes need to be escaped in Flex unlike single quotes based on documentation */ -#line 545 "lex.yy.c" - -#define INITIAL 0 - -#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 - - static void yyunput ( int c, char *buf_ptr ); - -#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 \ - 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 22 "lexicalStructure.lex" - - -#line 765 "lex.yy.c" - - 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_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 >= 131 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 161 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - 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 24 "lexicalStructure.lex" -{if(DEBUG) {printf( "T_INTEGER: %s (%d)\n", yytext, T_INTEGER);} else {return T_INTEGER;}} - YY_BREAK -case 2: -YY_RULE_SETUP -#line 25 "lexicalStructure.lex" -{if(DEBUG) {printf( "T_ADDRESS: %s (%d)\n", yytext, T_ADDRESS);} else {return T_ADDRESS;}} - YY_BREAK -case 3: -YY_RULE_SETUP -#line 26 "lexicalStructure.lex" -{if(DEBUG) {printf( "T_BOOLEAN: %s (%d)\n", yytext, T_BOOLEAN);} else {return T_BOOLEAN;}} - YY_BREAK -case 4: -YY_RULE_SETUP -#line 27 "lexicalStructure.lex" -{if(DEBUG) {printf( "T_CHARACTER: %s (%d)\n", yytext, T_CHARACTER);} else {return T_CHARACTER;}} - YY_BREAK -case 5: -YY_RULE_SETUP -#line 29 "lexicalStructure.lex" -{if(DEBUG) {printf( "WHILE: %s (%d)\n", yytext, WHILE);} else {return WHILE;}} - YY_BREAK -case 6: -YY_RULE_SETUP -#line 30 "lexicalStructure.lex" -{if(DEBUG) {printf( "IF: %s (%d)\n", yytext, IF);} else {return IF;}} - YY_BREAK -case 7: -YY_RULE_SETUP -#line 31 "lexicalStructure.lex" -{if(DEBUG) {printf( "THEN: %s (%d)\n", yytext, THEN);} else {return THEN;}} - YY_BREAK -case 8: -YY_RULE_SETUP -#line 32 "lexicalStructure.lex" -{if(DEBUG) {printf( "ELSE: %s (%d)\n", yytext, ELSE);} else {return ELSE;}} - YY_BREAK -case 9: -YY_RULE_SETUP -#line 33 "lexicalStructure.lex" -{if(DEBUG) {printf( "TYPE: %s (%d)\n", yytext, TYPE);} else {return TYPE;}} - YY_BREAK -case 10: -YY_RULE_SETUP -#line 34 "lexicalStructure.lex" -{if(DEBUG) {printf( "FUNCTION: %s (%d)\n", yytext, FUNCTION);} else {return FUNCTION;}} - YY_BREAK -case 11: -YY_RULE_SETUP -#line 35 "lexicalStructure.lex" -{if(DEBUG) {printf( "RETURN: %s (%d)\n", yytext, RETURN);} else {return RETURN;}} - YY_BREAK -case 12: -YY_RULE_SETUP -#line 36 "lexicalStructure.lex" -{if(DEBUG) {printf( "EXTERNAL: %s (%d)\n", yytext, EXTERNAL);} else {return EXTERNAL;}} - YY_BREAK -case 13: -YY_RULE_SETUP -#line 37 "lexicalStructure.lex" -{if(DEBUG) {printf( "AS: %s (%d)\n", yytext, AS);} else {return AS;}} - YY_BREAK -case 14: -YY_RULE_SETUP -#line 39 "lexicalStructure.lex" -{if(DEBUG) {printf( "RELEASE: %s (%d)\n", yytext, RELEASE);} else {return RELEASE;}} - YY_BREAK -case 15: -YY_RULE_SETUP -#line 40 "lexicalStructure.lex" -{if(DEBUG) {printf( "RESERVE: %s (%d)\n", yytext, RESERVE);} else {return RESERVE;}} - YY_BREAK -case 16: -YY_RULE_SETUP -#line 42 "lexicalStructure.lex" -{if(DEBUG) {printf( "ADD: %s (%d)\n", yytext, ADD);} else {return ADD;}} - YY_BREAK -case 17: -YY_RULE_SETUP -#line 43 "lexicalStructure.lex" -{if(DEBUG) {printf( "SUB_OR_NEG: %s (%d)\n", yytext, SUB_OR_NEG);} else {return SUB_OR_NEG;}} - YY_BREAK -case 18: -YY_RULE_SETUP -#line 44 "lexicalStructure.lex" -{if(DEBUG) {printf( "MUL: %s (%d)\n", yytext, MUL);} else {return MUL;}} - YY_BREAK -case 19: -YY_RULE_SETUP -#line 45 "lexicalStructure.lex" -{if(DEBUG) {printf( "DIV: %s (%d)\n", yytext, DIV);} else {return DIV;}} - YY_BREAK -case 20: -YY_RULE_SETUP -#line 46 "lexicalStructure.lex" -{if(DEBUG) {printf( "REM: %s (%d)\n", yytext, REM);} else {return REM;}} - YY_BREAK -case 21: -YY_RULE_SETUP -#line 47 "lexicalStructure.lex" -{if(DEBUG) {printf( "LESS_THAN: %s (%d)\n", yytext, LESS_THAN);} else {return LESS_THAN;}} - YY_BREAK -case 22: -YY_RULE_SETUP -#line 48 "lexicalStructure.lex" -{if(DEBUG) {printf( "EQUAL_TO: %s (%d)\n", yytext, EQUAL_TO);} else {return EQUAL_TO;}} - YY_BREAK -case 23: -YY_RULE_SETUP -#line 49 "lexicalStructure.lex" -{if(DEBUG) {printf( "ASSIGN: %s (%d)\n", yytext, ASSIGN);} else {return ASSIGN;}} - YY_BREAK -case 24: -YY_RULE_SETUP -#line 50 "lexicalStructure.lex" -{if(DEBUG) {printf( "NOT: %s (%d)\n", yytext, NOT);} else {return NOT;}} - YY_BREAK -case 25: -YY_RULE_SETUP -#line 51 "lexicalStructure.lex" -{if(DEBUG) {printf( "AND: %s (%d)\n", yytext, AND);} else {return AND;}} - YY_BREAK -case 26: -YY_RULE_SETUP -#line 52 "lexicalStructure.lex" -{if(DEBUG) {printf( "OR: %s (%d)\n", yytext, OR);} else {return OR;}} - YY_BREAK -case 27: -YY_RULE_SETUP -#line 53 "lexicalStructure.lex" -{if(DEBUG) {printf( "DOT: %s (%d)\n", yytext, DOT);} else {return DOT;}} - YY_BREAK -case 28: -YY_RULE_SETUP -#line 55 "lexicalStructure.lex" -{if(DEBUG) {printf( "SEMI_COLON: %s (%d)\n", yytext, SEMI_COLON);} else {return SEMI_COLON;}} - YY_BREAK -case 29: -YY_RULE_SETUP -#line 56 "lexicalStructure.lex" -{if(DEBUG) {printf( "COLON: %s (%d)\n", yytext, COLON);} else {return COLON;}} - YY_BREAK -case 30: -YY_RULE_SETUP -#line 57 "lexicalStructure.lex" -{if(DEBUG) {printf( "COMMA: %s (%d)\n", yytext, COMMA);} else {return COMMA;}} - YY_BREAK -case 31: -YY_RULE_SETUP -#line 58 "lexicalStructure.lex" -{if(DEBUG) {printf( "ARROW: %s (%d)\n", yytext, ARROW);} else {return ARROW;}} - YY_BREAK -case 32: -YY_RULE_SETUP -#line 60 "lexicalStructure.lex" -{if(DEBUG) {printf( "C_INTEGER: %s (%d)\n", yytext, C_INTEGER);} else {return C_INTEGER;}} - YY_BREAK -case 33: -YY_RULE_SETUP -#line 61 "lexicalStructure.lex" -{if(DEBUG) {printf( "C_CHARACTER: %s (%d)\n", yytext, C_CHARACTER);} else {return C_CHARACTER;}} - YY_BREAK -case 34: -YY_RULE_SETUP -#line 62 "lexicalStructure.lex" -{if(DEBUG) {printf( "C_STRING: %s (%d)\n", yytext, C_STRING);} else {return C_STRING;}} - YY_BREAK -case 35: -/* rule 35 can match eol */ -YY_RULE_SETUP -#line 63 "lexicalStructure.lex" -{if(DEBUG) {printf( "COMMENT: %s (%d)\n", yytext, COMMENT);} else {return COMMENT;}} - YY_BREAK -case 36: -YY_RULE_SETUP -#line 64 "lexicalStructure.lex" -{if(DEBUG) {printf( "C_TRUE: %s (%d)\n", yytext, C_TRUE);} else {return C_TRUE;}} - YY_BREAK -case 37: -YY_RULE_SETUP -#line 65 "lexicalStructure.lex" -{if(DEBUG) {printf( "C_FALSE: %s (%d)\n", yytext, C_FALSE);} else {return C_FALSE;}} - YY_BREAK -case 38: -YY_RULE_SETUP -#line 66 "lexicalStructure.lex" -{if(DEBUG) {printf( "C_NULL: %s (%d)\n", yytext, C_NULL);} else {return C_NULL;}} - YY_BREAK -case 39: -YY_RULE_SETUP -#line 68 "lexicalStructure.lex" -{if(DEBUG) {printf( "ID: %s (%d)\n", yytext, ID);} else {return ID;}} - YY_BREAK -case 40: -/* rule 40 can match eol */ -YY_RULE_SETUP -#line 70 "lexicalStructure.lex" -{line_number++; column_number = 1;} - YY_BREAK -case 41: -YY_RULE_SETUP -#line 71 "lexicalStructure.lex" -{column_number++;} - YY_BREAK -case 42: -YY_RULE_SETUP -#line 73 "lexicalStructure.lex" -ECHO; - YY_BREAK -#line 1034 "lex.yy.c" -case YY_STATE_EOF(INITIAL): - yyterminate(); - - 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_c_buf_p); - 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); - - 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 >= 131 ) - 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 >= 131 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - yy_is_jam = (yy_current_state == 130); - - return yy_is_jam ? 0 : yy_current_state; -} - -#ifndef YY_NO_UNPUT - - static void yyunput (int c, char * yy_bp ) -{ - char *yy_cp; - - yy_cp = (yy_c_buf_p); - - /* undo effects of setting up yytext */ - *yy_cp = (yy_hold_char); - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - int number_to_move = (yy_n_chars) + 2; - char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; -} - -#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); - - 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 73 "lexicalStructure.lex" - - -int main( int argc, char **argv ) -{ - argc--, argv++; - if ( argc > 0 ) - yyin = fopen( argv[0], "r" ); - else - yyin = stdin; - yylex(); -} - diff --git a/lexicalStructure b/lexicalStructure deleted file mode 100755 index a04030b4f589d385d2092a0766c57271c2f1fafc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 31336 zcmeHweRx#WwfCMR2LcijkTKy)M!w`T1Oy8zI!PE9GzlRj3RXIqBomUFWI{57L=7SV zWjdl*QE91tp|9S0d(~@weQio?`MIHwUxl@hVWg zTsSGFmKBvTnCT#%>dvIiBCqU`Y?PFf{?UhiSibk@FH=5v^3J{Y2YV)Ju8u#F4%M45 zq(cYUlU3C7mmozt+#im8Y_lUHiFjFDgRyDj?;CeK@K$|wnLlGuZ&VE-DYcT7$jYH^ z5nMU|fBOLZH^Fz|v>zcb`m_JU0Q@Zj@NXP|KX(9r{s4T6|NiO|2j7L$e%uO1fBMu< z{qZvg;8XbZr@wdr{`Usp|8M|)ANVeu_G2L!{grz?_#@aD=4uoOH6Ku1O%yE4X8<|U z&#~#>A^C0_pZR>18~wiO+6I4J?d<_pU0WAu2(o&AU0tveLJY4;UvtRc6!O*kYa3W~ zV^eKIsG6+{geqBeurbiU>I3!7fe>pBRRzN#R^1c`Al(ErtSKPOKm=%IUBKTIXli2B z_y{%;fajo9g_4kN2>MW}KU5oRV1bRbFm_v0Z79HMoBg3s3!}Qw$i9*-D_EYF@0*u> z#e6+EFM9#=EiWzf!DwJzZF4BlR9cu{7iQc%*ri<}`JvxFf!r=SZgF zj`*XAA&+8de=zbC)9P4l;;XruWaTD4*-}T1iO=U-DQGnDsSI^&H1Ty`L%7+*M~CUh zb`xJNUASzgiGPu<&Dd@eKh4D7YvK<#@t-vD(@p$mO?(wwByKnHN0{_GOnmcva>T@! zA;n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yUw@T_!{6^?;rIeo zc)$lW!FzxBfRL{QvM7mqRs|};>!2CJ6DZs(;+;Y8ndLbWi13CldN&dEB*qC|^g}@L z_Mv|4N_)y0e=ku>3*J-&zbZSXCrIE@soC%jaEyTuc!!KuzYuu1>*BnH1jdn6v7*#;0V&?b5M1iQ7!RW zC<~BU?rR9wR|II}QR4unH#}Li#M_=MET6BmFkg~#&{ z?8YX%CaVeWuQFH_;aa@0uC_|Da`TqYrYjOxukkn6uxvc2g(3tEH3K1j0zHS(fVQw3`(Cv1qT z6XOV#mJgAkax})X5fdyMm&JNq?W`B?|3Z%TSFsepJ-s-xuzsgQQMJD+xI$N@iB7^v zTZ;-$_hob_nj^CMr@lUr99m|Z@%HyDPS%kkq1Kg(P5V}6yxKQY)TI<9wc~FBAHOmj zRP|T;#)`^q4tl(bANKnD!KFQ8g;)E^iZ)6C)sg(H@L5RHQHzsYrtoT?T2ZwxO}ccD z4fC-c8QSwzc(u=~sJ;G5Pti@l(;l+Qt9@ieRsY%Ruj;S^3G%7Jt9@-n)qRQGf2#eD zN_?I)sP@SfRr~6MCyd>H`@kcgDEs<)R<3K+_XkknhrR!Q0InJDk~p2(94^IrF+aB9 z-SP%mQKc_RH Date: Wed, 12 Feb 2025 23:47:12 -0500 Subject: [PATCH 033/105] Added option to generate header file for yy.lex.c, fixed errors in runner.c, and updated Makefile --- Makefile | 25 ++++++++++++++++---- lexicalStructure.lex | 4 +++- runner.c | 55 ++++++++++++++++++++++++++++++-------------- runner.h | 24 ++++++++++++++----- 4 files changed, 80 insertions(+), 28 deletions(-) diff --git a/Makefile b/Makefile index 3a7cffc..906c76c 100644 --- a/Makefile +++ b/Makefile @@ -2,15 +2,32 @@ CC := gcc FLEX := flex LEX := lexicalStructure.lex EXE := lexicalStructure +CFLAGS := -std=c99 -Wall +CPPFLAGS := -lexicalStructure: - $(FLEX) $(LEX) - $(CC) lex.yy.c -o $(EXE) +runner: flex.o runner.o + $(CC) -o runner runner.o flex.o -test_operators: +runner.o: runner.c runner.h flex.h + $(CC) $(CFLAGS) -o runner.o -c runner.c + +flex.o: lex.yy.c typedefs.h + $(CC) $(CFLAGS) -o flex.o -c lex.yy.c + +lex.yy.c: lexicalStructure.lex + $(FLEX) -o lex.yy.c $(LEX) + +test: + ./$(EXE) ./tests/test_comments.alpha + ./$(EXE) ./tests/test_generalTokenTest.alpha + ./$(EXE) ./tests/test_keywords.alpha ./$(EXE) ./tests/test_operators.alpha + ./$(EXE) ./tests/test_otherpunc.alpha + ./$(EXE) ./tests/test_simpleIntTest.alpha + ./$(EXE) ./tests/test_simpleLiterals.alpha clean: rm -f *.o rm -f lex.yy.c rm -f $(EXE) + rm -f flex.h diff --git a/lexicalStructure.lex b/lexicalStructure.lex index 14b8616..332b9ac 100644 --- a/lexicalStructure.lex +++ b/lexicalStructure.lex @@ -3,6 +3,7 @@ /* definitions */ %option noyywrap +%option header-file="flex.h" %{ #include "typedefs.h" int line_number = 1, column_number = 1; @@ -69,4 +70,5 @@ SCHAR \\n|\\t|\\\"|[^\"\n\\] \n {line_number++; column_number = 1;} . {column_number++;} -%% \ No newline at end of file +%% + diff --git a/runner.c b/runner.c index 3d467b8..8e9474c 100644 --- a/runner.c +++ b/runner.c @@ -1,38 +1,59 @@ #include "runner.h" - int main(int argc, char *argv[]) { char *check_input; int token; - //check_input can be compared to INVALID_ARG and DIFF_ARG to determine if -tok and holds the generated file name if it is - check_input = is_tok(argc, argv); - FILE * output = fopen(check_input, "w"); + FILE *output; - if (check_input == INVALID_ARG) { - return -1; + if (argc == 1 || argc > 3 || (argc == 2 && is_alpha_file(argv[1], strlen(argv[1])) != 0)) { + fprintf(stderr, "invalid input with 1, >3, or non .alpha arg \n"); + return -1; //no alpha file or too many args + } else if (argc == 2) { + arg = NO_ARG; //no argument but valid input + yyin = fopen(argv[1], "r"); + } else { + check_input = is_tok(argc, argv); + if (strcmp(CHECK_OTHER, check_input) == 0 || strcmp(INVALID_ARG, check_input) == 0) { + fprintf(stderr, "check_other or invalid_arg \n"); + return -1; //invalid argument (need to update as we add more valid arguments) + } + output = fopen(check_input, "w"); + arg = TOK_ARG; //it is a -tok arg with a valid alpha file at argv[2] + yyin = fopen(argv[2], "r"); } - - while (0 != (token = yylex())) { - if (check_input != DIFF_ARG) { + token = yylex(); + fprintf(stderr, "made it here"); + while (token != 0) { + if (arg == TOK_ARG) { fprintf(output, "%d %d %3d \"%s\"\n", line_number, column_number, token, yytext); - } + } + token = yylex(); + fprintf(stderr, "made it past yylex"); } + fprintf(stderr, "returned 0\n"); return 0; } char *is_tok(int argc, char *argv[]) { - if (argc == 3 && strcmp("-tok", argv[1])) { + if (argc == 3 && strcmp("-tok", argv[1]) == 0) { char *input_prog = argv[2]; - int file_len = strlen(input); + int file_len = strlen(input_prog); //check that input program is a .alpha file - if (strcmp(".alpha", input_prog[file_len - ALPHA_OFFSET]) != 0) { + if (is_alpha_file(input_prog, file_len) != 0) { return INVALID_ARG; } - char *FILE_tok[file_len - ALPHA_OFFSET + TOK_LEN]; - strncpy(input, FILE_tok, file_len - ALPHA_OFFSET); //copy name of prog before .alpha - strcpy(".tok", FILE_tok[file_len - ALPHA_OFFSET]); //add .tok to end of file name + char* FILE_tok = calloc(sizeof(char), file_len - ALPHA_OFFSET + TOK_LEN); + strncpy(FILE_tok, input_prog, file_len - ALPHA_OFFSET); //copy name of prog before .alpha + strcpy(FILE_tok + sizeof(char) * (file_len - ALPHA_OFFSET), ".tok"); //add .tok to end of file name return FILE_tok; } - return DIFF_ARG; + return CHECK_OTHER; } + +int is_alpha_file(char *file, int file_len) { + if (strcmp(".alpha", file + sizeof(char) * (file_len - ALPHA_OFFSET)) != 0) { + return -1; //not alpha file + } + return 0; //is alpha file +} diff --git a/runner.h b/runner.h index 080d5c1..be45c9a 100644 --- a/runner.h +++ b/runner.h @@ -1,13 +1,25 @@ -#define ALPHA_OFFSET 5 +#define ALPHA_OFFSET 6 #define TOK_LEN 3 + +//returns for is_tok #define INVALID_ARG "invalid" -#define DIFF_ARG "diff" +#define CHECK_OTHER "diff" + +//argument type in main +#define NO_ARG 0 +#define DIFF_ARG 1 +#define TOK_ARG 2 + #include -#include -#include "lex.yy.c" +#include +#include +#include "flex.h" extern int line_number, column_number; extern char *yytext; +extern FILE *yyin; +int arg; -int main(int argc, char* argv); -char *is_tok(int argc, char* argv);#define ALPHA_OFFSET 5 +int main(int argc, char* argv[]); +char *is_tok(int argc, char* argv[]); +int is_alpha_file(char *file, int file_len); From 228f66a385c578ff206a5cb59db51864c5dfa569 Mon Sep 17 00:00:00 2001 From: Annie Date: Thu, 13 Feb 2025 01:44:19 -0500 Subject: [PATCH 034/105] Resolved issue of including path to .alpha file and tested with multiple directories --- runner.c | 20 ++++++++++++++------ tests/testPath/testPath.alpha | 23 +++++++++++++++++++++++ tests/test_operators.alpha~ | 17 +++++++++++++++++ 3 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 tests/testPath/testPath.alpha create mode 100644 tests/test_operators.alpha~ diff --git a/runner.c b/runner.c index 8e9474c..d2e0890 100644 --- a/runner.c +++ b/runner.c @@ -21,17 +21,12 @@ int main(int argc, char *argv[]) { arg = TOK_ARG; //it is a -tok arg with a valid alpha file at argv[2] yyin = fopen(argv[2], "r"); } - token = yylex(); - fprintf(stderr, "made it here"); - while (token != 0) { + while (0 != (token = yylex())) { if (arg == TOK_ARG) { fprintf(output, "%d %d %3d \"%s\"\n", line_number, column_number, token, yytext); } - token = yylex(); - fprintf(stderr, "made it past yylex"); } - fprintf(stderr, "returned 0\n"); return 0; } @@ -43,6 +38,19 @@ char *is_tok(int argc, char *argv[]) { if (is_alpha_file(input_prog, file_len) != 0) { return INVALID_ARG; } + + int ignore_path = 0; + int count_since_slash = 0; + for (int i = 0; i < file_len; i++) { + count_since_slash++; + if (input_prog[i] == '/') { + ignore_path += count_since_slash; + count_since_slash = 0; + } + } + + file_len -= ignore_path; + input_prog += ignore_path; char* FILE_tok = calloc(sizeof(char), file_len - ALPHA_OFFSET + TOK_LEN); strncpy(FILE_tok, input_prog, file_len - ALPHA_OFFSET); //copy name of prog before .alpha strcpy(FILE_tok + sizeof(char) * (file_len - ALPHA_OFFSET), ".tok"); //add .tok to end of file name diff --git a/tests/testPath/testPath.alpha b/tests/testPath/testPath.alpha new file mode 100644 index 0000000..fa713c4 --- /dev/null +++ b/tests/testPath/testPath.alpha @@ -0,0 +1,23 @@ +This is a test +9combined 7okens +12345 +893247892 +combined'DueToUnknownChar _validtoken __validtoken1 _valid_token2 validToken3_ +true false +null while !wrong if when +else type function +return external as +string _NOte_that_was_not_reserved +([)]{}:;,->"\ ++-*/% +<= +:= +"This is not a valid +String" +"This is a valid String" +!| +.. +(* this is a comment *) +(*Not a comment +$^& +> \ No newline at end of file diff --git a/tests/test_operators.alpha~ b/tests/test_operators.alpha~ new file mode 100644 index 0000000..84d3edd --- /dev/null +++ b/tests/test_operators.alpha~ @@ -0,0 +1,17 @@ ++ +- +* +/ +\ +% +< +> += +:= +=: +: += +! +& +| +. From f64a4633f7da195a7ca139cf8e56e82be3859d5d Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Thu, 13 Feb 2025 18:51:31 -0500 Subject: [PATCH 035/105] tweaked the lexer to always have DEBUG of 0 and updated .tok file logic in runner --- Makefile | 11 +- Makefile.save | 43 + flex.h | 477 +++++++++ flex.o | Bin 0 -> 34384 bytes lex.yy.c | 2041 +++++++++++++++++++++++++++++++++++++ lexicalStructure.lex | 4 +- runner | Bin 0 -> 31688 bytes runner.c | 31 +- runner.o | Bin 0 -> 4216 bytes test_comments.tok | 9 + test_generalTokenTest.tok | 61 ++ test_keywords.tok | 29 + test_operators.tok | 22 + test_otherpunc.tok | 7 + test_simpleIntTest.tok | 3 + test_simpleLiterals.tok | 62 ++ 16 files changed, 2783 insertions(+), 17 deletions(-) create mode 100644 Makefile.save create mode 100644 flex.h create mode 100644 flex.o create mode 100644 lex.yy.c create mode 100755 runner create mode 100644 runner.o create mode 100644 test_comments.tok create mode 100644 test_generalTokenTest.tok create mode 100644 test_keywords.tok create mode 100644 test_operators.tok create mode 100644 test_otherpunc.tok create mode 100644 test_simpleIntTest.tok create mode 100644 test_simpleLiterals.tok diff --git a/Makefile b/Makefile index ff000b2..1c78b93 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ CC := gcc FLEX := flex LEX := lexicalStructure.lex -EXE := lexicalStructure +EXE := runner CFLAGS := -std=c99 -Wall CPPFLAGS := @@ -25,9 +25,16 @@ test: ./$(EXE) ./tests/test_otherpunc.alpha ./$(EXE) ./tests/test_simpleIntTest.alpha ./$(EXE) ./tests/test_simpleLiterals.alpha - + ./$(EXE) -tok ./tests/test_comments.alpha + ./$(EXE) -tok ./tests/test_generalTokenTest.alpha + ./$(EXE) -tok ./tests/test_keywords.alpha + ./$(EXE) -tok ./tests/test_operators.alpha + ./$(EXE) -tok ./tests/test_otherpunc.alpha + ./$(EXE) -tok ./tests/test_simpleIntTest.alpha + ./$(EXE) -tok ./tests/test_simpleLiterals.alpha clean: rm -f *.o rm -f lex.yy.c rm -f $(EXE) rm -f flex.h + rm -f *.tok diff --git a/Makefile.save b/Makefile.save new file mode 100644 index 0000000..668af54 --- /dev/null +++ b/Makefile.save @@ -0,0 +1,43 @@ +CC := gcc +FLEX := flex +LEX := lexicalStructure.lex +EXE := runner +CFLAGS := -std=c99 -Wall +CPPFLAGS := + +runner: flex.o runner.o + $(CC) -o runner runner.o flex.o + +debug: CFLAGS += -DDEBUG=true +debug: clean runner + +runner.o: runner.c runner.h flex.h + $(CC) $(CFLAGS) -o runner.o -c runner.c + +flex.o: lex.yy.c typedefs.h + $(CC) $(CFLAGS) -o flex.o -c lex.yy.c + +lex.yy.c: lexicalStructure.lex + $(FLEX) -o lex.yy.c $(LEX) + +test: + ./$(EXE) ./tests/test_comments.alpha + ./$(EXE) ./tests/test_generalTokenTest.alpha + ./$(EXE) ./tests/test_keywords.alpha + ./$(EXE) ./tests/test_operators.alpha + ./$(EXE) ./tests/test_otherpunc.alpha + ./$(EXE) ./tests/test_simpleIntTest.alpha + ./$(EXE) ./tests/test_simpleLiterals.alpha + ./$(EXE) -tok ./tests/test_comments.alpha + ./$(EXE) -tok ./tests/test_generalTokenTest.alpha + ./$(EXE) -tok ./tests/test_keywords.alpha + ./$(EXE) -tok ./tests/test_operators.alpha + ./$(EXE) -tok ./tests/test_otherpunc.alpha + ./$(EXE) -tok ./tests/test_simpleIntTest.alpha + ./$(EXE) -tok ./tests/test_simpleLiterals.alpha +clean: + rm -f *.o + rm -f lex.yy.c + rm -f $(EXE) + rm -f flex.h + rm -f *.tok diff --git a/flex.h b/flex.h new file mode 100644 index 0000000..c017827 --- /dev/null +++ b/flex.h @@ -0,0 +1,477 @@ +#ifndef yyHEADER_H +#define yyHEADER_H 1 +#define yyIN_HEADER 1 + +#line 6 "flex.h" + +#line 8 "flex.h" + +#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 + +/* 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 + +#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; + +#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; + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +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 ); + +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 * ); + +/* Begin user sect3 */ + +#define yywrap() (/*CONSTCOND*/1) +#define YY_SKIP_YYWRAP + +extern int yylineno; + +extern char *yytext; +#ifdef yytext_ptr +#undef yytext_ptr +#endif +#define yytext_ptr yytext + +#ifdef YY_HEADER_EXPORT_START_CONDITIONS +#define INITIAL 0 + +#endif + +#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 + +/* 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 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 + +#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 + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* 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 */ + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + +#undef YY_NEW_FILE +#undef YY_FLUSH_BUFFER +#undef yy_set_bol +#undef yy_new_buffer +#undef yy_set_interactive +#undef YY_DO_BEFORE_ACTION + +#ifdef YY_DECL_IS_OURS +#undef YY_DECL_IS_OURS +#undef YY_DECL +#endif + +#ifndef yy_create_buffer_ALREADY_DEFINED +#undef yy_create_buffer +#endif +#ifndef yy_delete_buffer_ALREADY_DEFINED +#undef yy_delete_buffer +#endif +#ifndef yy_scan_buffer_ALREADY_DEFINED +#undef yy_scan_buffer +#endif +#ifndef yy_scan_string_ALREADY_DEFINED +#undef yy_scan_string +#endif +#ifndef yy_scan_bytes_ALREADY_DEFINED +#undef yy_scan_bytes +#endif +#ifndef yy_init_buffer_ALREADY_DEFINED +#undef yy_init_buffer +#endif +#ifndef yy_flush_buffer_ALREADY_DEFINED +#undef yy_flush_buffer +#endif +#ifndef yy_load_buffer_state_ALREADY_DEFINED +#undef yy_load_buffer_state +#endif +#ifndef yy_switch_to_buffer_ALREADY_DEFINED +#undef yy_switch_to_buffer +#endif +#ifndef yypush_buffer_state_ALREADY_DEFINED +#undef yypush_buffer_state +#endif +#ifndef yypop_buffer_state_ALREADY_DEFINED +#undef yypop_buffer_state +#endif +#ifndef yyensure_buffer_stack_ALREADY_DEFINED +#undef yyensure_buffer_stack +#endif +#ifndef yylex_ALREADY_DEFINED +#undef yylex +#endif +#ifndef yyrestart_ALREADY_DEFINED +#undef yyrestart +#endif +#ifndef yylex_init_ALREADY_DEFINED +#undef yylex_init +#endif +#ifndef yylex_init_extra_ALREADY_DEFINED +#undef yylex_init_extra +#endif +#ifndef yylex_destroy_ALREADY_DEFINED +#undef yylex_destroy +#endif +#ifndef yyget_debug_ALREADY_DEFINED +#undef yyget_debug +#endif +#ifndef yyset_debug_ALREADY_DEFINED +#undef yyset_debug +#endif +#ifndef yyget_extra_ALREADY_DEFINED +#undef yyget_extra +#endif +#ifndef yyset_extra_ALREADY_DEFINED +#undef yyset_extra +#endif +#ifndef yyget_in_ALREADY_DEFINED +#undef yyget_in +#endif +#ifndef yyset_in_ALREADY_DEFINED +#undef yyset_in +#endif +#ifndef yyget_out_ALREADY_DEFINED +#undef yyget_out +#endif +#ifndef yyset_out_ALREADY_DEFINED +#undef yyset_out +#endif +#ifndef yyget_leng_ALREADY_DEFINED +#undef yyget_leng +#endif +#ifndef yyget_text_ALREADY_DEFINED +#undef yyget_text +#endif +#ifndef yyget_lineno_ALREADY_DEFINED +#undef yyget_lineno +#endif +#ifndef yyset_lineno_ALREADY_DEFINED +#undef yyset_lineno +#endif +#ifndef yyget_column_ALREADY_DEFINED +#undef yyget_column +#endif +#ifndef yyset_column_ALREADY_DEFINED +#undef yyset_column +#endif +#ifndef yywrap_ALREADY_DEFINED +#undef yywrap +#endif +#ifndef yyget_lval_ALREADY_DEFINED +#undef yyget_lval +#endif +#ifndef yyset_lval_ALREADY_DEFINED +#undef yyset_lval +#endif +#ifndef yyget_lloc_ALREADY_DEFINED +#undef yyget_lloc +#endif +#ifndef yyset_lloc_ALREADY_DEFINED +#undef yyset_lloc +#endif +#ifndef yyalloc_ALREADY_DEFINED +#undef yyalloc +#endif +#ifndef yyrealloc_ALREADY_DEFINED +#undef yyrealloc +#endif +#ifndef yyfree_ALREADY_DEFINED +#undef yyfree +#endif +#ifndef yytext_ALREADY_DEFINED +#undef yytext +#endif +#ifndef yyleng_ALREADY_DEFINED +#undef yyleng +#endif +#ifndef yyin_ALREADY_DEFINED +#undef yyin +#endif +#ifndef yyout_ALREADY_DEFINED +#undef yyout +#endif +#ifndef yy_flex_debug_ALREADY_DEFINED +#undef yy_flex_debug +#endif +#ifndef yylineno_ALREADY_DEFINED +#undef yylineno +#endif +#ifndef yytables_fload_ALREADY_DEFINED +#undef yytables_fload +#endif +#ifndef yytables_destroy_ALREADY_DEFINED +#undef yytables_destroy +#endif +#ifndef yyTABLES_NAME_ALREADY_DEFINED +#undef yyTABLES_NAME +#endif + +#line 74 "lexicalStructure.lex" + + +#line 476 "flex.h" +#undef yyIN_HEADER +#endif /* yyHEADER_H */ diff --git a/flex.o b/flex.o new file mode 100644 index 0000000000000000000000000000000000000000..f8acaf4d65edcb38fda1c8c1d0b8b8eb3e684a64 GIT binary patch literal 34384 zcmd6w3w%}8mH&4hKtLn`(V&2ar$j>pMFl|(kOP+zAcn*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W7yaJ{}1UN+gtzu literal 0 HcmV?d00001 diff --git a/lex.yy.c b/lex.yy.c new file mode 100644 index 0000000..69aedb9 --- /dev/null +++ b/lex.yy.c @@ -0,0 +1,2041 @@ +#line 2 "lex.yy.c" + +#line 4 "lex.yy.c" + +#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 42 +#define YY_END_OF_BUFFER 43 +/* 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[131] = + { 0, + 0, 0, 43, 41, 40, 24, 41, 20, 25, 41, + 41, 18, 16, 30, 17, 27, 19, 32, 29, 28, + 21, 22, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 26, 0, 34, 0, 0, 0, 0, + 31, 32, 23, 39, 39, 39, 13, 39, 39, 39, + 39, 39, 6, 39, 39, 39, 39, 39, 39, 39, + 33, 0, 0, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 35, + 0, 39, 39, 39, 8, 39, 39, 39, 39, 38, + 39, 39, 39, 7, 36, 9, 39, 39, 39, 39, + + 39, 37, 39, 39, 39, 39, 39, 5, 39, 39, + 39, 39, 39, 39, 39, 39, 11, 3, 2, 39, + 39, 39, 1, 14, 15, 39, 12, 10, 4, 0 + } ; + +static const YY_CHAR yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 4, 5, 1, 1, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 18, 19, 20, + 21, 22, 1, 1, 23, 24, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 1, 25, 1, 1, 23, 1, 26, 23, 27, 28, + + 29, 30, 31, 32, 33, 23, 23, 34, 23, 35, + 36, 37, 23, 38, 39, 40, 41, 42, 43, 44, + 45, 23, 1, 46, 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, 1 + } ; + +static const YY_CHAR yy_meta[47] = + { 0, + 1, 2, 3, 1, 1, 1, 1, 2, 1, 1, + 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, + 1, 1, 4, 4, 1, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 1 + } ; + +static const flex_int16_t yy_base[135] = + { 0, + 0, 0, 160, 161, 161, 161, 42, 161, 161, 134, + 147, 161, 161, 161, 135, 161, 161, 139, 134, 161, + 161, 161, 0, 118, 20, 121, 16, 23, 21, 111, + 122, 20, 118, 161, 48, 161, 49, 141, 47, 137, + 161, 130, 161, 0, 110, 117, 0, 118, 104, 102, + 107, 105, 0, 99, 104, 23, 108, 95, 98, 101, + 161, 122, 58, 98, 93, 92, 100, 99, 88, 99, + 96, 90, 94, 93, 80, 85, 90, 89, 83, 161, + 60, 87, 86, 88, 0, 75, 83, 71, 79, 0, + 83, 70, 69, 0, 0, 0, 77, 79, 65, 76, + + 67, 0, 63, 66, 53, 46, 51, 0, 50, 44, + 41, 54, 43, 40, 48, 47, 0, 0, 0, 46, + 40, 37, 0, 0, 0, 28, 0, 0, 0, 161, + 89, 93, 57, 97 + } ; + +static const flex_int16_t yy_def[135] = + { 0, + 130, 1, 130, 130, 130, 130, 131, 130, 130, 132, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 130, 131, 130, 130, 130, 130, 134, + 130, 130, 130, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 130, 134, 134, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 130, + 134, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 0, + 130, 130, 130, 130 + } ; + +static const flex_int16_t yy_nxt[208] = + { 0, + 4, 4, 5, 6, 7, 8, 9, 10, 11, 4, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 4, 23, 24, 4, 25, 26, 23, 27, 28, + 23, 23, 29, 23, 30, 23, 23, 31, 23, 32, + 23, 23, 33, 23, 23, 34, 36, 46, 51, 49, + 53, 57, 36, 35, 38, 54, 73, 58, 47, 50, + 44, 74, 75, 52, 59, 129, 37, 80, 81, 130, + 81, 128, 37, 127, 126, 125, 124, 123, 122, 121, + 120, 38, 119, 35, 118, 117, 38, 116, 35, 35, + 35, 115, 35, 38, 114, 113, 38, 62, 62, 62, + + 62, 112, 111, 110, 109, 108, 107, 106, 105, 104, + 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, + 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, + 83, 82, 63, 79, 78, 77, 76, 72, 71, 70, + 69, 68, 67, 66, 65, 64, 42, 63, 61, 60, + 56, 55, 48, 45, 43, 42, 41, 40, 39, 130, + 3, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + + 130, 130, 130, 130, 130, 130, 130 + } ; + +static const flex_int16_t yy_chk[208] = + { 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, 1, 7, 25, 28, 27, + 29, 32, 35, 37, 39, 29, 56, 32, 25, 27, + 133, 56, 56, 28, 32, 126, 7, 63, 63, 81, + 81, 122, 35, 121, 120, 116, 115, 114, 113, 112, + 111, 39, 110, 37, 109, 107, 39, 106, 37, 131, + 131, 105, 131, 132, 104, 103, 132, 134, 134, 134, + + 134, 101, 100, 99, 98, 97, 93, 92, 91, 89, + 88, 87, 86, 84, 83, 82, 79, 78, 77, 76, + 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, + 65, 64, 62, 60, 59, 58, 57, 55, 54, 52, + 51, 50, 49, 48, 46, 45, 42, 40, 38, 33, + 31, 30, 26, 24, 19, 18, 15, 11, 10, 3, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + + 130, 130, 130, 130, 130, 130, 130 + } ; + +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 "lexicalStructure.lex" +/* Lexical Analysis with Flex (1.6.0) We used some of the code from this manual */ +/* so we placed the citation here. */ +/* definitions */ +#line 8 "lexicalStructure.lex" + #include + #include "typedefs.h" + int line_number = 1, column_number = 1; + bool DEBUG = false; +#line 542 "lex.yy.c" +#line 19 "lexicalStructure.lex" + /* char can be a newline, tab, an escaped quote, or anything but a single quote, an actual line break, an actual tab, or a backslash by itself (to prevent confusion from escaped quote */ + /* similar to above, a string Char (SCHAR) is the same as a CHAR except we cannot have double quotes instead of single quotes. Double quotes need to be escaped in Flex unlike single quotes based on documentation */ +#line 546 "lex.yy.c" + +#define INITIAL 0 + +#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 + + static void yyunput ( int c, char *buf_ptr ); + +#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 \ + 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 23 "lexicalStructure.lex" + + +#line 766 "lex.yy.c" + + 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_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 >= 131 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 161 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + 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 25 "lexicalStructure.lex" +{if(DEBUG) {printf( "T_INTEGER: %s (%d)\n", yytext, T_INTEGER);} else {return T_INTEGER;}} + YY_BREAK +case 2: +YY_RULE_SETUP +#line 26 "lexicalStructure.lex" +{if(DEBUG) {printf( "T_ADDRESS: %s (%d)\n", yytext, T_ADDRESS);} else {return T_ADDRESS;}} + YY_BREAK +case 3: +YY_RULE_SETUP +#line 27 "lexicalStructure.lex" +{if(DEBUG) {printf( "T_BOOLEAN: %s (%d)\n", yytext, T_BOOLEAN);} else {return T_BOOLEAN;}} + YY_BREAK +case 4: +YY_RULE_SETUP +#line 28 "lexicalStructure.lex" +{if(DEBUG) {printf( "T_CHARACTER: %s (%d)\n", yytext, T_CHARACTER);} else {return T_CHARACTER;}} + YY_BREAK +case 5: +YY_RULE_SETUP +#line 30 "lexicalStructure.lex" +{if(DEBUG) {printf( "WHILE: %s (%d)\n", yytext, WHILE);} else {return WHILE;}} + YY_BREAK +case 6: +YY_RULE_SETUP +#line 31 "lexicalStructure.lex" +{if(DEBUG) {printf( "IF: %s (%d)\n", yytext, IF);} else {return IF;}} + YY_BREAK +case 7: +YY_RULE_SETUP +#line 32 "lexicalStructure.lex" +{if(DEBUG) {printf( "THEN: %s (%d)\n", yytext, THEN);} else {return THEN;}} + YY_BREAK +case 8: +YY_RULE_SETUP +#line 33 "lexicalStructure.lex" +{if(DEBUG) {printf( "ELSE: %s (%d)\n", yytext, ELSE);} else {return ELSE;}} + YY_BREAK +case 9: +YY_RULE_SETUP +#line 34 "lexicalStructure.lex" +{if(DEBUG) {printf( "TYPE: %s (%d)\n", yytext, TYPE);} else {return TYPE;}} + YY_BREAK +case 10: +YY_RULE_SETUP +#line 35 "lexicalStructure.lex" +{if(DEBUG) {printf( "FUNCTION: %s (%d)\n", yytext, FUNCTION);} else {return FUNCTION;}} + YY_BREAK +case 11: +YY_RULE_SETUP +#line 36 "lexicalStructure.lex" +{if(DEBUG) {printf( "RETURN: %s (%d)\n", yytext, RETURN);} else {return RETURN;}} + YY_BREAK +case 12: +YY_RULE_SETUP +#line 37 "lexicalStructure.lex" +{if(DEBUG) {printf( "EXTERNAL: %s (%d)\n", yytext, EXTERNAL);} else {return EXTERNAL;}} + YY_BREAK +case 13: +YY_RULE_SETUP +#line 38 "lexicalStructure.lex" +{if(DEBUG) {printf( "AS: %s (%d)\n", yytext, AS);} else {return AS;}} + YY_BREAK +case 14: +YY_RULE_SETUP +#line 40 "lexicalStructure.lex" +{if(DEBUG) {printf( "RELEASE: %s (%d)\n", yytext, RELEASE);} else {return RELEASE;}} + YY_BREAK +case 15: +YY_RULE_SETUP +#line 41 "lexicalStructure.lex" +{if(DEBUG) {printf( "RESERVE: %s (%d)\n", yytext, RESERVE);} else {return RESERVE;}} + YY_BREAK +case 16: +YY_RULE_SETUP +#line 43 "lexicalStructure.lex" +{if(DEBUG) {printf( "ADD: %s (%d)\n", yytext, ADD);} else {return ADD;}} + YY_BREAK +case 17: +YY_RULE_SETUP +#line 44 "lexicalStructure.lex" +{if(DEBUG) {printf( "SUB_OR_NEG: %s (%d)\n", yytext, SUB_OR_NEG);} else {return SUB_OR_NEG;}} + YY_BREAK +case 18: +YY_RULE_SETUP +#line 45 "lexicalStructure.lex" +{if(DEBUG) {printf( "MUL: %s (%d)\n", yytext, MUL);} else {return MUL;}} + YY_BREAK +case 19: +YY_RULE_SETUP +#line 46 "lexicalStructure.lex" +{if(DEBUG) {printf( "DIV: %s (%d)\n", yytext, DIV);} else {return DIV;}} + YY_BREAK +case 20: +YY_RULE_SETUP +#line 47 "lexicalStructure.lex" +{if(DEBUG) {printf( "REM: %s (%d)\n", yytext, REM);} else {return REM;}} + YY_BREAK +case 21: +YY_RULE_SETUP +#line 48 "lexicalStructure.lex" +{if(DEBUG) {printf( "LESS_THAN: %s (%d)\n", yytext, LESS_THAN);} else {return LESS_THAN;}} + YY_BREAK +case 22: +YY_RULE_SETUP +#line 49 "lexicalStructure.lex" +{if(DEBUG) {printf( "EQUAL_TO: %s (%d)\n", yytext, EQUAL_TO);} else {return EQUAL_TO;}} + YY_BREAK +case 23: +YY_RULE_SETUP +#line 50 "lexicalStructure.lex" +{if(DEBUG) {printf( "ASSIGN: %s (%d)\n", yytext, ASSIGN);} else {return ASSIGN;}} + YY_BREAK +case 24: +YY_RULE_SETUP +#line 51 "lexicalStructure.lex" +{if(DEBUG) {printf( "NOT: %s (%d)\n", yytext, NOT);} else {return NOT;}} + YY_BREAK +case 25: +YY_RULE_SETUP +#line 52 "lexicalStructure.lex" +{if(DEBUG) {printf( "AND: %s (%d)\n", yytext, AND);} else {return AND;}} + YY_BREAK +case 26: +YY_RULE_SETUP +#line 53 "lexicalStructure.lex" +{if(DEBUG) {printf( "OR: %s (%d)\n", yytext, OR);} else {return OR;}} + YY_BREAK +case 27: +YY_RULE_SETUP +#line 54 "lexicalStructure.lex" +{if(DEBUG) {printf( "DOT: %s (%d)\n", yytext, DOT);} else {return DOT;}} + YY_BREAK +case 28: +YY_RULE_SETUP +#line 56 "lexicalStructure.lex" +{if(DEBUG) {printf( "SEMI_COLON: %s (%d)\n", yytext, SEMI_COLON);} else {return SEMI_COLON;}} + YY_BREAK +case 29: +YY_RULE_SETUP +#line 57 "lexicalStructure.lex" +{if(DEBUG) {printf( "COLON: %s (%d)\n", yytext, COLON);} else {return COLON;}} + YY_BREAK +case 30: +YY_RULE_SETUP +#line 58 "lexicalStructure.lex" +{if(DEBUG) {printf( "COMMA: %s (%d)\n", yytext, COMMA);} else {return COMMA;}} + YY_BREAK +case 31: +YY_RULE_SETUP +#line 59 "lexicalStructure.lex" +{if(DEBUG) {printf( "ARROW: %s (%d)\n", yytext, ARROW);} else {return ARROW;}} + YY_BREAK +case 32: +YY_RULE_SETUP +#line 61 "lexicalStructure.lex" +{if(DEBUG) {printf( "C_INTEGER: %s (%d)\n", yytext, C_INTEGER);} else {return C_INTEGER;}} + YY_BREAK +case 33: +YY_RULE_SETUP +#line 62 "lexicalStructure.lex" +{if(DEBUG) {printf( "C_CHARACTER: %s (%d)\n", yytext, C_CHARACTER);} else {return C_CHARACTER;}} + YY_BREAK +case 34: +YY_RULE_SETUP +#line 63 "lexicalStructure.lex" +{if(DEBUG) {printf( "C_STRING: %s (%d)\n", yytext, C_STRING);} else {return C_STRING;}} + YY_BREAK +case 35: +/* rule 35 can match eol */ +YY_RULE_SETUP +#line 64 "lexicalStructure.lex" +{if(DEBUG) {printf( "COMMENT: %s (%d)\n", yytext, COMMENT);} else {return COMMENT;}} + YY_BREAK +case 36: +YY_RULE_SETUP +#line 65 "lexicalStructure.lex" +{if(DEBUG) {printf( "C_TRUE: %s (%d)\n", yytext, C_TRUE);} else {return C_TRUE;}} + YY_BREAK +case 37: +YY_RULE_SETUP +#line 66 "lexicalStructure.lex" +{if(DEBUG) {printf( "C_FALSE: %s (%d)\n", yytext, C_FALSE);} else {return C_FALSE;}} + YY_BREAK +case 38: +YY_RULE_SETUP +#line 67 "lexicalStructure.lex" +{if(DEBUG) {printf( "C_NULL: %s (%d)\n", yytext, C_NULL);} else {return C_NULL;}} + YY_BREAK +case 39: +YY_RULE_SETUP +#line 69 "lexicalStructure.lex" +{if(DEBUG) {printf( "ID: %s (%d)\n", yytext, ID);} else {return ID;}} + YY_BREAK +case 40: +/* rule 40 can match eol */ +YY_RULE_SETUP +#line 71 "lexicalStructure.lex" +{line_number++; column_number = 1;} + YY_BREAK +case 41: +YY_RULE_SETUP +#line 72 "lexicalStructure.lex" +{column_number++;} + YY_BREAK +case 42: +YY_RULE_SETUP +#line 74 "lexicalStructure.lex" +ECHO; + YY_BREAK +#line 1035 "lex.yy.c" +case YY_STATE_EOF(INITIAL): + yyterminate(); + + 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_c_buf_p); + 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); + + 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 >= 131 ) + 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 >= 131 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_is_jam = (yy_current_state == 130); + + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_UNPUT + + static void yyunput (int c, char * yy_bp ) +{ + char *yy_cp; + + yy_cp = (yy_c_buf_p); + + /* undo effects of setting up yytext */ + *yy_cp = (yy_hold_char); + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + int number_to_move = (yy_n_chars) + 2; + char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; +} + +#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); + + 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 74 "lexicalStructure.lex" + + diff --git a/lexicalStructure.lex b/lexicalStructure.lex index eed6e7d..a79ebfd 100644 --- a/lexicalStructure.lex +++ b/lexicalStructure.lex @@ -8,7 +8,7 @@ #include #include "typedefs.h" int line_number = 1, column_number = 1; - bool DEBUG = true; + bool DEBUG = false; %} COM ([^*]|\*+[^)*])* @@ -70,4 +70,4 @@ SCHAR \\n|\\t|\\\"|[^\"\n\\] \n {line_number++; column_number = 1;} . {column_number++;} -%% \ No newline at end of file +%% diff --git a/runner b/runner new file mode 100755 index 0000000000000000000000000000000000000000..620f79ca8f59f14b034d2ad92795a58beb68cd82 GIT binary patch literal 31688 zcmeHw3wTu3)%Ko*BjK8Wj0yJ<2of$aTm=P8fPq002q6(vV3;Hml9FU%GJ}K~L;{v^ zprWGCixt}bpMKs-Ex!V_He6&-sfLOcE7sVeoe}&R1Fflw^Sx_d&YW{h{J-aW{{G+d z{0|4tti9J-@7imxeLH8*$((zfxpNb2Hl~h5Hk0w()q;~P1xbFT!B{q%%6j2*C>z4A z0=o;&Y$>+VGY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yAL7k8M2nzdd-jA8)0`*L!P3t zkpS=?Rtb}PA*`QTJ3h+39lkRLM-JQZ_Y#hEIX;S z#^fZiiH7S#MwwEDAkUugM5bKyOU{_%m&R>Z6bp{c<6OlpI9`s3MSDWzGR1Ng&RsW? zcSR;$ES58vI+@BOMJ&Xy{0;9}7mfeI7m;MYhIeZ?&I5ugg?qsKBLGQ&qtqC80g|A8 z@1Vx`y8ubRhprhed+QT`B<$zWa4J4mJ-E0V?B}$?!M{_(XB7@U{^el)yu#W4HZ{MZ zdhqf6WB%_7Xa10y-%x#&zY-4s3HW+`?$>bS=Sh%A_+G$|o}Zl&KIeU}!ok<`uwUat z$N5ZaIM(HS7GwNWHNKwD;~EbCoS%0z9B&ij(;D8Z;qPlW-VNq|rs0V5AT`KW3dfr3 zs4@R*4PUR}=QTfi{1;>JpEW;tL)rhY8eiY<%^3bL4xEJRBp*)2ZiT~#URQ@ST)%e} z4cG78afPEpez*=l()joma{S+FxbFWa4aa|Y%)hST_i8wQXc52eXETBzffTVP5K{Wpz5VF^bd=iA9j4R;?i^MdXr=WPj-GR=cY@xisb)w z2AQLzkXv1nYT~H8u}+mAPsJu0A*aa}5)RIwct}n`NrJloTf9k-4Phr9q8@l;8SzCF zQ2glnICuDr(oZWuEw8M@SX&bsppM~FKYQre9^Y+UIDW?Pj>3MB0oC`bg}E+S&GB>p z3@Lcb9Q3b516Rr@_W_V5`!dxFFURev92qDeG=c+=b2pHlIAnk|M=`+op2 CgEuw+ literal 0 HcmV?d00001 diff --git a/test_comments.tok b/test_comments.tok new file mode 100644 index 0000000..2fb6907 --- /dev/null +++ b/test_comments.tok @@ -0,0 +1,9 @@ +1 1 700 "(* hello *)" +2 1 700 "(* hello *)" +3 1 700 "(* I'd think this is a legal "string" that contains several \n \t +escaped characters, isn't it? *)" +4 1 700 "(* \ *)" +5 1 700 "(* *)" +6 1 700 "(*{COMMENT}+ *)" +7 1 700 "(* * *)" +8 1 700 "(* (hello) *)" diff --git a/test_generalTokenTest.tok b/test_generalTokenTest.tok new file mode 100644 index 0000000..69b1571 --- /dev/null +++ b/test_generalTokenTest.tok @@ -0,0 +1,61 @@ +1 1 101 "This" +1 2 101 "is" +1 3 101 "a" +1 4 101 "test" +2 1 301 "9" +2 1 101 "combined" +2 2 301 "7" +2 2 101 "okens" +3 1 301 "12345" +4 1 301 "893247892" +5 1 101 "combined" +5 2 101 "DueToUnknownChar" +5 3 101 "_validtoken" +5 4 101 "__validtoken1" +5 5 101 "_valid_token2" +5 6 101 "validToken3_" +6 1 305 "true" +6 2 306 "false" +7 1 302 "null" +7 2 401 "while" +7 3 609 "!" +7 3 101 "wrong" +7 4 402 "if" +7 5 101 "when" +8 1 404 "else" +8 2 405 "type" +8 3 406 "function" +9 1 407 "return" +9 3 408 "external" +9 11 409 "as" +10 1 101 "string" +10 2 101 "_NOte_that_was_not_reserved" +11 7 508 ":" +11 7 507 ";" +11 7 509 "," +11 7 510 "->" +12 1 601 "+" +12 1 602 "-" +12 1 603 "*" +12 1 604 "/" +12 1 605 "%" +13 1 606 "<" +13 1 607 "=" +14 1 608 ":=" +15 2 101 "This" +15 3 101 "is" +15 4 101 "not" +15 5 101 "a" +15 6 101 "valid" +16 1 101 "String" +17 1 304 ""This is a valid String"" +18 1 609 "!" +18 1 611 "|" +19 1 612 "." +19 1 612 "." +20 1 700 "(* this is a comment *)" +21 2 603 "*" +21 2 101 "Not" +21 3 101 "a" +21 4 101 "comment" +22 3 610 "&" diff --git a/test_keywords.tok b/test_keywords.tok new file mode 100644 index 0000000..9e70321 --- /dev/null +++ b/test_keywords.tok @@ -0,0 +1,29 @@ +1 1 401 "while" +2 1 101 "While" +3 1 101 "whiLe" +4 1 402 "if" +5 1 101 "IF" +6 1 101 "If" +7 1 101 "iF" +8 1 403 "then" +9 1 101 "Then" +10 1 101 "theN" +11 1 404 "else" +12 1 101 "eLse" +13 1 101 "elSe" +14 1 101 "Else" +15 1 405 "type" +16 1 101 "Type" +17 1 101 "tyPe" +18 1 406 "function" +19 1 101 "Function" +20 1 101 "functioN" +21 1 407 "return" +22 1 101 "Return" +23 1 101 "returN" +24 1 408 "external" +25 1 101 "External" +26 1 101 "exteRnal" +27 1 409 "as" +28 1 101 "As" +29 1 101 "aS" diff --git a/test_operators.tok b/test_operators.tok new file mode 100644 index 0000000..9ca0302 --- /dev/null +++ b/test_operators.tok @@ -0,0 +1,22 @@ +1 1 601 "+" +2 1 602 "-" +3 1 603 "*" +4 1 604 "/" +6 1 605 "%" +7 1 606 "<" +9 1 607 "=" +10 1 608 ":=" +11 1 607 "=" +11 1 508 ":" +12 1 508 ":" +13 1 607 "=" +14 1 609 "!" +15 1 610 "&" +16 1 611 "|" +17 1 612 "." +18 1 101 "relEASE" +19 1 614 "release" +20 1 101 "RELEASE" +21 1 613 "reserve" +22 1 101 "RESERVE" +23 1 101 "reSERVe" diff --git a/test_otherpunc.tok b/test_otherpunc.tok new file mode 100644 index 0000000..005f61c --- /dev/null +++ b/test_otherpunc.tok @@ -0,0 +1,7 @@ +1 1 507 ";" +2 1 508 ":" +3 1 509 "," +4 1 510 "->" +5 1 510 "->" +6 1 602 "-" +6 1 510 "->" diff --git a/test_simpleIntTest.tok b/test_simpleIntTest.tok new file mode 100644 index 0000000..2bdbdd3 --- /dev/null +++ b/test_simpleIntTest.tok @@ -0,0 +1,3 @@ +1 1 301 "45" +2 1 301 "123" +3 1 301 "8392" diff --git a/test_simpleLiterals.tok b/test_simpleLiterals.tok new file mode 100644 index 0000000..51f07e1 --- /dev/null +++ b/test_simpleLiterals.tok @@ -0,0 +1,62 @@ +1 1 304 ""this is a string"" +1 2 301 "721398" +1 3 303 "'g'" +1 5 604 "/" +1 5 101 "n" +1 7 700 "(* should print 3 tokens before this *)" +4 1 301 "12893" +4 3 101 "this" +4 4 101 "is" +4 5 101 "not" +4 6 101 "a" +4 7 101 "string" +4 8 700 "(*one valid token before this*)" +5 1 700 "(* spacey comment here +over multiple lines +will it work? *)" +9 1 306 "false" +10 1 700 "(**)" +12 1 101 "nullfalse" +13 2 101 "nulltrue" +14 1 302 "null" +15 1 303 "'7'" +16 1 305 "true" +17 2 301 "189" +18 1 303 "'\t'" +19 1 303 "'"'" +20 1 303 "'/'" +21 1 303 "'\n'" +22 1 303 "'\''" +23 1 303 "'\t'" +25 1 303 "'n'" +27 2 101 "fdsf" +28 1 700 "(*/jnewjno2893u86^ Lots of random characters /n /t '") *)" +33 1 304 ""STRINGwithnotSPaces"" +34 1 303 "' '" +36 1 304 ""J"" +37 1 304 """" +38 1 304 "" "" +40 1 304 ""{SCHAR}"" +41 1 304 ""SCHAR"" +42 1 304 ""[SCHAR]"" +43 1 304 ""FINAL: I'd think this is a legal \"string\" that contains \n \t several escaped characters, isn't it?"" +44 2 101 "I" +44 3 101 "d" +44 4 101 "think" +44 5 101 "this" +44 6 101 "is" +44 7 101 "a" +44 8 101 "legal" +44 11 101 "string" +44 14 101 "that" +44 15 101 "contains" +44 16 101 "several" +44 19 101 "n" +44 21 101 "t" +44 22 101 "escaped" +44 23 101 "characters" +44 23 509 "," +44 24 101 "isn" +44 25 101 "t" +44 26 101 "it" +45 1 101 "nullLike" From 3596a5e21ff982ecc3b8f6badee8c1e01f4e7e5f Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Thu, 13 Feb 2025 18:53:26 -0500 Subject: [PATCH 036/105] deleted make created files --- flex.h | 477 --------- flex.o | Bin 34384 -> 0 bytes lex.yy.c | 2041 ------------------------------------- runner | Bin 31688 -> 0 bytes runner.o | Bin 4216 -> 0 bytes test_comments.tok | 9 - test_generalTokenTest.tok | 61 -- test_keywords.tok | 29 - test_operators.tok | 22 - test_otherpunc.tok | 7 - test_simpleIntTest.tok | 3 - test_simpleLiterals.tok | 62 -- 12 files changed, 2711 deletions(-) delete mode 100644 flex.h delete mode 100644 flex.o delete mode 100644 lex.yy.c delete mode 100755 runner delete mode 100644 runner.o delete mode 100644 test_comments.tok delete mode 100644 test_generalTokenTest.tok delete mode 100644 test_keywords.tok delete mode 100644 test_operators.tok delete mode 100644 test_otherpunc.tok delete mode 100644 test_simpleIntTest.tok delete mode 100644 test_simpleLiterals.tok diff --git a/flex.h b/flex.h deleted file mode 100644 index c017827..0000000 --- a/flex.h +++ /dev/null @@ -1,477 +0,0 @@ -#ifndef yyHEADER_H -#define yyHEADER_H 1 -#define yyIN_HEADER 1 - -#line 6 "flex.h" - -#line 8 "flex.h" - -#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 - -/* 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 - -#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; - -#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; - - }; -#endif /* !YY_STRUCT_YY_BUFFER_STATE */ - -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 ); - -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 * ); - -/* Begin user sect3 */ - -#define yywrap() (/*CONSTCOND*/1) -#define YY_SKIP_YYWRAP - -extern int yylineno; - -extern char *yytext; -#ifdef yytext_ptr -#undef yytext_ptr -#endif -#define yytext_ptr yytext - -#ifdef YY_HEADER_EXPORT_START_CONDITIONS -#define INITIAL 0 - -#endif - -#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 - -/* 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 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 - -#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 - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* 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 */ - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - -#undef YY_NEW_FILE -#undef YY_FLUSH_BUFFER -#undef yy_set_bol -#undef yy_new_buffer -#undef yy_set_interactive -#undef YY_DO_BEFORE_ACTION - -#ifdef YY_DECL_IS_OURS -#undef YY_DECL_IS_OURS -#undef YY_DECL -#endif - -#ifndef yy_create_buffer_ALREADY_DEFINED -#undef yy_create_buffer -#endif -#ifndef yy_delete_buffer_ALREADY_DEFINED -#undef yy_delete_buffer -#endif -#ifndef yy_scan_buffer_ALREADY_DEFINED -#undef yy_scan_buffer -#endif -#ifndef yy_scan_string_ALREADY_DEFINED -#undef yy_scan_string -#endif -#ifndef yy_scan_bytes_ALREADY_DEFINED -#undef yy_scan_bytes -#endif -#ifndef yy_init_buffer_ALREADY_DEFINED -#undef yy_init_buffer -#endif -#ifndef yy_flush_buffer_ALREADY_DEFINED -#undef yy_flush_buffer -#endif -#ifndef yy_load_buffer_state_ALREADY_DEFINED -#undef yy_load_buffer_state -#endif -#ifndef yy_switch_to_buffer_ALREADY_DEFINED -#undef yy_switch_to_buffer -#endif -#ifndef yypush_buffer_state_ALREADY_DEFINED -#undef yypush_buffer_state -#endif -#ifndef yypop_buffer_state_ALREADY_DEFINED -#undef yypop_buffer_state -#endif -#ifndef yyensure_buffer_stack_ALREADY_DEFINED -#undef yyensure_buffer_stack -#endif -#ifndef yylex_ALREADY_DEFINED -#undef yylex -#endif -#ifndef yyrestart_ALREADY_DEFINED -#undef yyrestart -#endif -#ifndef yylex_init_ALREADY_DEFINED -#undef yylex_init -#endif -#ifndef yylex_init_extra_ALREADY_DEFINED -#undef yylex_init_extra -#endif -#ifndef yylex_destroy_ALREADY_DEFINED -#undef yylex_destroy -#endif -#ifndef yyget_debug_ALREADY_DEFINED -#undef yyget_debug -#endif -#ifndef yyset_debug_ALREADY_DEFINED -#undef yyset_debug -#endif -#ifndef yyget_extra_ALREADY_DEFINED -#undef yyget_extra -#endif -#ifndef yyset_extra_ALREADY_DEFINED -#undef yyset_extra -#endif -#ifndef yyget_in_ALREADY_DEFINED -#undef yyget_in -#endif -#ifndef yyset_in_ALREADY_DEFINED -#undef yyset_in -#endif -#ifndef yyget_out_ALREADY_DEFINED -#undef yyget_out -#endif -#ifndef yyset_out_ALREADY_DEFINED -#undef yyset_out -#endif -#ifndef yyget_leng_ALREADY_DEFINED -#undef yyget_leng -#endif -#ifndef yyget_text_ALREADY_DEFINED -#undef yyget_text -#endif -#ifndef yyget_lineno_ALREADY_DEFINED -#undef yyget_lineno -#endif -#ifndef yyset_lineno_ALREADY_DEFINED -#undef yyset_lineno -#endif -#ifndef yyget_column_ALREADY_DEFINED -#undef yyget_column -#endif -#ifndef yyset_column_ALREADY_DEFINED -#undef yyset_column -#endif -#ifndef yywrap_ALREADY_DEFINED -#undef yywrap -#endif -#ifndef yyget_lval_ALREADY_DEFINED -#undef yyget_lval -#endif -#ifndef yyset_lval_ALREADY_DEFINED -#undef yyset_lval -#endif -#ifndef yyget_lloc_ALREADY_DEFINED -#undef yyget_lloc -#endif -#ifndef yyset_lloc_ALREADY_DEFINED -#undef yyset_lloc -#endif -#ifndef yyalloc_ALREADY_DEFINED -#undef yyalloc -#endif -#ifndef yyrealloc_ALREADY_DEFINED -#undef yyrealloc -#endif -#ifndef yyfree_ALREADY_DEFINED -#undef yyfree -#endif -#ifndef yytext_ALREADY_DEFINED -#undef yytext -#endif -#ifndef yyleng_ALREADY_DEFINED -#undef yyleng -#endif -#ifndef yyin_ALREADY_DEFINED -#undef yyin -#endif -#ifndef yyout_ALREADY_DEFINED -#undef yyout -#endif -#ifndef yy_flex_debug_ALREADY_DEFINED -#undef yy_flex_debug -#endif -#ifndef yylineno_ALREADY_DEFINED -#undef yylineno -#endif -#ifndef yytables_fload_ALREADY_DEFINED -#undef yytables_fload -#endif -#ifndef yytables_destroy_ALREADY_DEFINED -#undef yytables_destroy -#endif -#ifndef yyTABLES_NAME_ALREADY_DEFINED -#undef yyTABLES_NAME -#endif - -#line 74 "lexicalStructure.lex" - - -#line 476 "flex.h" -#undef yyIN_HEADER -#endif /* yyHEADER_H */ diff --git a/flex.o b/flex.o deleted file mode 100644 index f8acaf4d65edcb38fda1c8c1d0b8b8eb3e684a64..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 34384 zcmd6w3w%}8mH&4hKtLn`(V&2ar$j>pMFl|(kOP+zAcn*z8uGX?(L88!FA{5f5KwL- zmbN}?b!6&P)J~^kt#w*Q0y-u>{)kimQ)_997Ta9I%*4XfSgHB1wa;4TuDdwrGW~p} zpZRY-_nvdUd#&Hzd+mMp+2`cm%N z`KO9d?4z}z&cpM&hGEXu?(D74!M4X9p&0Y%s00hSFtoKhI)?XS)`O2yL1l*3)P6Vi|o?CMG;$&cW;# zNZvWPEhp6F91O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a+vxQ ze~C@oM7Z75@%#{=62}1z(4VPg3?XhP(QCiq{dJt~h@ldY0mSWM80oK7B5Bj^Z~F zpQre<#OEuH{|PImMT*bPa(R*B&BTip{|Dmob7&YJ`(xO!Em8J!N4ol@iu31k%N6I( zi(akxQPNqb_=Pmi)+@e|c&*|;CSI>NkJm=U`Ez(16vzKv8dF5^pVILr#gEbPZHiw? z*Y`UWzn%CN#dj0mruYZM?^XOW;yV=Q&pF+%IA6!}Z0p>ykNwN3n0ENQ;NNSgSDb%m zW1HgqI~%(c=iklfRh)k}qfc@EJp}x{4@_Ji{yhZy-y{gmzXwvH?D_X18Wrc?Nw`;W z{=JUxDbBx>@Rs8Iy9b9ApPYxahTkip;Bx)#m;8ViD1PZwYi>#u=ifbORGfd`;9kY~ zcT09D&c9b6zsH9r{Cfp`%AS9(AdBX8%*Gf0UIG4xshF7a?-hg;=ie)+SDb&ZV4LFn zdj-1`=ie*nRh)mXpigoBeHHorHLNTDj=?Oto^buIr|WA-asHiMP1Li@Gs!dm#5K~q@W)@BMVZEbN$O-oZ#xH)19n_D8`LioY9+4gtm z==jFwXyJy|mJQ)n_!heB7_P6ZYprSu+u;8Xyybxg4qduDd5T4}_X@>@GiaFeA^dKt zyVff5h`TdD6Uh@7y2m(8p>LLZ2)|kCCX`1`-A5EO&vtiddP{I`&)q424Qgut9P;0w z?74i#_%|3VAIE`AdF0QZ|Kz+p-k~jiMhS;T5gqep$F1((d>S{{4qRez`P}}?fMNN( zj)z^F+UUj;+b0v+V&d&`v2Qcz?Qi(TRYD)ztALGwmu~+PR5~)UfS88{_);W7yaJ{}1UN+gtzu diff --git a/lex.yy.c b/lex.yy.c deleted file mode 100644 index 69aedb9..0000000 --- a/lex.yy.c +++ /dev/null @@ -1,2041 +0,0 @@ -#line 2 "lex.yy.c" - -#line 4 "lex.yy.c" - -#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 42 -#define YY_END_OF_BUFFER 43 -/* 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[131] = - { 0, - 0, 0, 43, 41, 40, 24, 41, 20, 25, 41, - 41, 18, 16, 30, 17, 27, 19, 32, 29, 28, - 21, 22, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 39, 26, 0, 34, 0, 0, 0, 0, - 31, 32, 23, 39, 39, 39, 13, 39, 39, 39, - 39, 39, 6, 39, 39, 39, 39, 39, 39, 39, - 33, 0, 0, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 39, 39, 39, 39, 39, 39, 39, 35, - 0, 39, 39, 39, 8, 39, 39, 39, 39, 38, - 39, 39, 39, 7, 36, 9, 39, 39, 39, 39, - - 39, 37, 39, 39, 39, 39, 39, 5, 39, 39, - 39, 39, 39, 39, 39, 39, 11, 3, 2, 39, - 39, 39, 1, 14, 15, 39, 12, 10, 4, 0 - } ; - -static const YY_CHAR yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 4, 5, 1, 1, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 18, 19, 20, - 21, 22, 1, 1, 23, 24, 23, 23, 23, 23, - 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, - 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, - 1, 25, 1, 1, 23, 1, 26, 23, 27, 28, - - 29, 30, 31, 32, 33, 23, 23, 34, 23, 35, - 36, 37, 23, 38, 39, 40, 41, 42, 43, 44, - 45, 23, 1, 46, 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, 1 - } ; - -static const YY_CHAR yy_meta[47] = - { 0, - 1, 2, 3, 1, 1, 1, 1, 2, 1, 1, - 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, - 1, 1, 4, 4, 1, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 1 - } ; - -static const flex_int16_t yy_base[135] = - { 0, - 0, 0, 160, 161, 161, 161, 42, 161, 161, 134, - 147, 161, 161, 161, 135, 161, 161, 139, 134, 161, - 161, 161, 0, 118, 20, 121, 16, 23, 21, 111, - 122, 20, 118, 161, 48, 161, 49, 141, 47, 137, - 161, 130, 161, 0, 110, 117, 0, 118, 104, 102, - 107, 105, 0, 99, 104, 23, 108, 95, 98, 101, - 161, 122, 58, 98, 93, 92, 100, 99, 88, 99, - 96, 90, 94, 93, 80, 85, 90, 89, 83, 161, - 60, 87, 86, 88, 0, 75, 83, 71, 79, 0, - 83, 70, 69, 0, 0, 0, 77, 79, 65, 76, - - 67, 0, 63, 66, 53, 46, 51, 0, 50, 44, - 41, 54, 43, 40, 48, 47, 0, 0, 0, 46, - 40, 37, 0, 0, 0, 28, 0, 0, 0, 161, - 89, 93, 57, 97 - } ; - -static const flex_int16_t yy_def[135] = - { 0, - 130, 1, 130, 130, 130, 130, 131, 130, 130, 132, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 130, 131, 130, 130, 130, 130, 134, - 130, 130, 130, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 130, 134, 134, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 130, - 134, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 0, - 130, 130, 130, 130 - } ; - -static const flex_int16_t yy_nxt[208] = - { 0, - 4, 4, 5, 6, 7, 8, 9, 10, 11, 4, - 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 4, 23, 24, 4, 25, 26, 23, 27, 28, - 23, 23, 29, 23, 30, 23, 23, 31, 23, 32, - 23, 23, 33, 23, 23, 34, 36, 46, 51, 49, - 53, 57, 36, 35, 38, 54, 73, 58, 47, 50, - 44, 74, 75, 52, 59, 129, 37, 80, 81, 130, - 81, 128, 37, 127, 126, 125, 124, 123, 122, 121, - 120, 38, 119, 35, 118, 117, 38, 116, 35, 35, - 35, 115, 35, 38, 114, 113, 38, 62, 62, 62, - - 62, 112, 111, 110, 109, 108, 107, 106, 105, 104, - 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, - 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, - 83, 82, 63, 79, 78, 77, 76, 72, 71, 70, - 69, 68, 67, 66, 65, 64, 42, 63, 61, 60, - 56, 55, 48, 45, 43, 42, 41, 40, 39, 130, - 3, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - - 130, 130, 130, 130, 130, 130, 130 - } ; - -static const flex_int16_t yy_chk[208] = - { 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, 1, 7, 25, 28, 27, - 29, 32, 35, 37, 39, 29, 56, 32, 25, 27, - 133, 56, 56, 28, 32, 126, 7, 63, 63, 81, - 81, 122, 35, 121, 120, 116, 115, 114, 113, 112, - 111, 39, 110, 37, 109, 107, 39, 106, 37, 131, - 131, 105, 131, 132, 104, 103, 132, 134, 134, 134, - - 134, 101, 100, 99, 98, 97, 93, 92, 91, 89, - 88, 87, 86, 84, 83, 82, 79, 78, 77, 76, - 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, - 65, 64, 62, 60, 59, 58, 57, 55, 54, 52, - 51, 50, 49, 48, 46, 45, 42, 40, 38, 33, - 31, 30, 26, 24, 19, 18, 15, 11, 10, 3, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - - 130, 130, 130, 130, 130, 130, 130 - } ; - -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 "lexicalStructure.lex" -/* Lexical Analysis with Flex (1.6.0) We used some of the code from this manual */ -/* so we placed the citation here. */ -/* definitions */ -#line 8 "lexicalStructure.lex" - #include - #include "typedefs.h" - int line_number = 1, column_number = 1; - bool DEBUG = false; -#line 542 "lex.yy.c" -#line 19 "lexicalStructure.lex" - /* char can be a newline, tab, an escaped quote, or anything but a single quote, an actual line break, an actual tab, or a backslash by itself (to prevent confusion from escaped quote */ - /* similar to above, a string Char (SCHAR) is the same as a CHAR except we cannot have double quotes instead of single quotes. Double quotes need to be escaped in Flex unlike single quotes based on documentation */ -#line 546 "lex.yy.c" - -#define INITIAL 0 - -#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 - - static void yyunput ( int c, char *buf_ptr ); - -#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 \ - 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 23 "lexicalStructure.lex" - - -#line 766 "lex.yy.c" - - 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_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 >= 131 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 161 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - 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 25 "lexicalStructure.lex" -{if(DEBUG) {printf( "T_INTEGER: %s (%d)\n", yytext, T_INTEGER);} else {return T_INTEGER;}} - YY_BREAK -case 2: -YY_RULE_SETUP -#line 26 "lexicalStructure.lex" -{if(DEBUG) {printf( "T_ADDRESS: %s (%d)\n", yytext, T_ADDRESS);} else {return T_ADDRESS;}} - YY_BREAK -case 3: -YY_RULE_SETUP -#line 27 "lexicalStructure.lex" -{if(DEBUG) {printf( "T_BOOLEAN: %s (%d)\n", yytext, T_BOOLEAN);} else {return T_BOOLEAN;}} - YY_BREAK -case 4: -YY_RULE_SETUP -#line 28 "lexicalStructure.lex" -{if(DEBUG) {printf( "T_CHARACTER: %s (%d)\n", yytext, T_CHARACTER);} else {return T_CHARACTER;}} - YY_BREAK -case 5: -YY_RULE_SETUP -#line 30 "lexicalStructure.lex" -{if(DEBUG) {printf( "WHILE: %s (%d)\n", yytext, WHILE);} else {return WHILE;}} - YY_BREAK -case 6: -YY_RULE_SETUP -#line 31 "lexicalStructure.lex" -{if(DEBUG) {printf( "IF: %s (%d)\n", yytext, IF);} else {return IF;}} - YY_BREAK -case 7: -YY_RULE_SETUP -#line 32 "lexicalStructure.lex" -{if(DEBUG) {printf( "THEN: %s (%d)\n", yytext, THEN);} else {return THEN;}} - YY_BREAK -case 8: -YY_RULE_SETUP -#line 33 "lexicalStructure.lex" -{if(DEBUG) {printf( "ELSE: %s (%d)\n", yytext, ELSE);} else {return ELSE;}} - YY_BREAK -case 9: -YY_RULE_SETUP -#line 34 "lexicalStructure.lex" -{if(DEBUG) {printf( "TYPE: %s (%d)\n", yytext, TYPE);} else {return TYPE;}} - YY_BREAK -case 10: -YY_RULE_SETUP -#line 35 "lexicalStructure.lex" -{if(DEBUG) {printf( "FUNCTION: %s (%d)\n", yytext, FUNCTION);} else {return FUNCTION;}} - YY_BREAK -case 11: -YY_RULE_SETUP -#line 36 "lexicalStructure.lex" -{if(DEBUG) {printf( "RETURN: %s (%d)\n", yytext, RETURN);} else {return RETURN;}} - YY_BREAK -case 12: -YY_RULE_SETUP -#line 37 "lexicalStructure.lex" -{if(DEBUG) {printf( "EXTERNAL: %s (%d)\n", yytext, EXTERNAL);} else {return EXTERNAL;}} - YY_BREAK -case 13: -YY_RULE_SETUP -#line 38 "lexicalStructure.lex" -{if(DEBUG) {printf( "AS: %s (%d)\n", yytext, AS);} else {return AS;}} - YY_BREAK -case 14: -YY_RULE_SETUP -#line 40 "lexicalStructure.lex" -{if(DEBUG) {printf( "RELEASE: %s (%d)\n", yytext, RELEASE);} else {return RELEASE;}} - YY_BREAK -case 15: -YY_RULE_SETUP -#line 41 "lexicalStructure.lex" -{if(DEBUG) {printf( "RESERVE: %s (%d)\n", yytext, RESERVE);} else {return RESERVE;}} - YY_BREAK -case 16: -YY_RULE_SETUP -#line 43 "lexicalStructure.lex" -{if(DEBUG) {printf( "ADD: %s (%d)\n", yytext, ADD);} else {return ADD;}} - YY_BREAK -case 17: -YY_RULE_SETUP -#line 44 "lexicalStructure.lex" -{if(DEBUG) {printf( "SUB_OR_NEG: %s (%d)\n", yytext, SUB_OR_NEG);} else {return SUB_OR_NEG;}} - YY_BREAK -case 18: -YY_RULE_SETUP -#line 45 "lexicalStructure.lex" -{if(DEBUG) {printf( "MUL: %s (%d)\n", yytext, MUL);} else {return MUL;}} - YY_BREAK -case 19: -YY_RULE_SETUP -#line 46 "lexicalStructure.lex" -{if(DEBUG) {printf( "DIV: %s (%d)\n", yytext, DIV);} else {return DIV;}} - YY_BREAK -case 20: -YY_RULE_SETUP -#line 47 "lexicalStructure.lex" -{if(DEBUG) {printf( "REM: %s (%d)\n", yytext, REM);} else {return REM;}} - YY_BREAK -case 21: -YY_RULE_SETUP -#line 48 "lexicalStructure.lex" -{if(DEBUG) {printf( "LESS_THAN: %s (%d)\n", yytext, LESS_THAN);} else {return LESS_THAN;}} - YY_BREAK -case 22: -YY_RULE_SETUP -#line 49 "lexicalStructure.lex" -{if(DEBUG) {printf( "EQUAL_TO: %s (%d)\n", yytext, EQUAL_TO);} else {return EQUAL_TO;}} - YY_BREAK -case 23: -YY_RULE_SETUP -#line 50 "lexicalStructure.lex" -{if(DEBUG) {printf( "ASSIGN: %s (%d)\n", yytext, ASSIGN);} else {return ASSIGN;}} - YY_BREAK -case 24: -YY_RULE_SETUP -#line 51 "lexicalStructure.lex" -{if(DEBUG) {printf( "NOT: %s (%d)\n", yytext, NOT);} else {return NOT;}} - YY_BREAK -case 25: -YY_RULE_SETUP -#line 52 "lexicalStructure.lex" -{if(DEBUG) {printf( "AND: %s (%d)\n", yytext, AND);} else {return AND;}} - YY_BREAK -case 26: -YY_RULE_SETUP -#line 53 "lexicalStructure.lex" -{if(DEBUG) {printf( "OR: %s (%d)\n", yytext, OR);} else {return OR;}} - YY_BREAK -case 27: -YY_RULE_SETUP -#line 54 "lexicalStructure.lex" -{if(DEBUG) {printf( "DOT: %s (%d)\n", yytext, DOT);} else {return DOT;}} - YY_BREAK -case 28: -YY_RULE_SETUP -#line 56 "lexicalStructure.lex" -{if(DEBUG) {printf( "SEMI_COLON: %s (%d)\n", yytext, SEMI_COLON);} else {return SEMI_COLON;}} - YY_BREAK -case 29: -YY_RULE_SETUP -#line 57 "lexicalStructure.lex" -{if(DEBUG) {printf( "COLON: %s (%d)\n", yytext, COLON);} else {return COLON;}} - YY_BREAK -case 30: -YY_RULE_SETUP -#line 58 "lexicalStructure.lex" -{if(DEBUG) {printf( "COMMA: %s (%d)\n", yytext, COMMA);} else {return COMMA;}} - YY_BREAK -case 31: -YY_RULE_SETUP -#line 59 "lexicalStructure.lex" -{if(DEBUG) {printf( "ARROW: %s (%d)\n", yytext, ARROW);} else {return ARROW;}} - YY_BREAK -case 32: -YY_RULE_SETUP -#line 61 "lexicalStructure.lex" -{if(DEBUG) {printf( "C_INTEGER: %s (%d)\n", yytext, C_INTEGER);} else {return C_INTEGER;}} - YY_BREAK -case 33: -YY_RULE_SETUP -#line 62 "lexicalStructure.lex" -{if(DEBUG) {printf( "C_CHARACTER: %s (%d)\n", yytext, C_CHARACTER);} else {return C_CHARACTER;}} - YY_BREAK -case 34: -YY_RULE_SETUP -#line 63 "lexicalStructure.lex" -{if(DEBUG) {printf( "C_STRING: %s (%d)\n", yytext, C_STRING);} else {return C_STRING;}} - YY_BREAK -case 35: -/* rule 35 can match eol */ -YY_RULE_SETUP -#line 64 "lexicalStructure.lex" -{if(DEBUG) {printf( "COMMENT: %s (%d)\n", yytext, COMMENT);} else {return COMMENT;}} - YY_BREAK -case 36: -YY_RULE_SETUP -#line 65 "lexicalStructure.lex" -{if(DEBUG) {printf( "C_TRUE: %s (%d)\n", yytext, C_TRUE);} else {return C_TRUE;}} - YY_BREAK -case 37: -YY_RULE_SETUP -#line 66 "lexicalStructure.lex" -{if(DEBUG) {printf( "C_FALSE: %s (%d)\n", yytext, C_FALSE);} else {return C_FALSE;}} - YY_BREAK -case 38: -YY_RULE_SETUP -#line 67 "lexicalStructure.lex" -{if(DEBUG) {printf( "C_NULL: %s (%d)\n", yytext, C_NULL);} else {return C_NULL;}} - YY_BREAK -case 39: -YY_RULE_SETUP -#line 69 "lexicalStructure.lex" -{if(DEBUG) {printf( "ID: %s (%d)\n", yytext, ID);} else {return ID;}} - YY_BREAK -case 40: -/* rule 40 can match eol */ -YY_RULE_SETUP -#line 71 "lexicalStructure.lex" -{line_number++; column_number = 1;} - YY_BREAK -case 41: -YY_RULE_SETUP -#line 72 "lexicalStructure.lex" -{column_number++;} - YY_BREAK -case 42: -YY_RULE_SETUP -#line 74 "lexicalStructure.lex" -ECHO; - YY_BREAK -#line 1035 "lex.yy.c" -case YY_STATE_EOF(INITIAL): - yyterminate(); - - 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_c_buf_p); - 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); - - 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 >= 131 ) - 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 >= 131 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - yy_is_jam = (yy_current_state == 130); - - return yy_is_jam ? 0 : yy_current_state; -} - -#ifndef YY_NO_UNPUT - - static void yyunput (int c, char * yy_bp ) -{ - char *yy_cp; - - yy_cp = (yy_c_buf_p); - - /* undo effects of setting up yytext */ - *yy_cp = (yy_hold_char); - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - int number_to_move = (yy_n_chars) + 2; - char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; -} - -#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); - - 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 74 "lexicalStructure.lex" - - diff --git a/runner b/runner deleted file mode 100755 index 620f79ca8f59f14b034d2ad92795a58beb68cd82..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 31688 zcmeHw3wTu3)%Ko*BjK8Wj0yJ<2of$aTm=P8fPq002q6(vV3;Hml9FU%GJ}K~L;{v^ zprWGCixt}bpMKs-Ex!V_He6&-sfLOcE7sVeoe}&R1Fflw^Sx_d&YW{h{J-aW{{G+d z{0|4tti9J-@7imxeLH8*$((zfxpNb2Hl~h5Hk0w()q;~P1xbFT!B{q%%6j2*C>z4A z0=o;&Y$>+VGYLYVXp+=R1SMP=B|4yk1e+bz)@WOtA}dl z0$E;X?a(Uwr=qfWc70_<@svr|SC)>etf&sG8@F!ilyOrgW!CvJCvX?YF9%NQQ}Y%U zF_>v0o@&m7jUun?k&LiL04kq(cCZ7RaWFlnbsCkLr6-^#EooUGmGbjbi)6) zPWYvr@Y}$5;Itn1gV9mBuXV!T(+U5UPWY9b@TYdd-`xp+aVPwvo$zUVbyTk#I^p+5 zLpmU{9`}OLksazE9r05;;n#J-pVJBd#ZLGyb;2LqiT^iuqQ4CMK5PJU)F6RF%|kH5 zhH;Mh53vWiM?wU1SKDl2^@5Mo%Dxa<6$ zTEDx>Q&G+8{Iw-jHLR?rwxZf!##Vd%C9KR>_8C6&H9FRSua)p`BUEA<8ZtgP1S zB}{cmO+8T7dTVQ089scq1f(2vYfH+(g?1_Y0I%BThEE=Ug|C`< z*H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^3bL4xEJRBp*)2ZiT~#URQ@ST)%e} z4cG78afPEpez*=l()joma{S+FxbFWa4aa|Y%)hST_i8wQXc52eXETBzffTVP5K{Wpz5VF^bd=iA9j4R;?i^MdXr=WPj-GR=cY@xisb)w z2AQLzkXv1nYT~H8u}+mAPsJu0A*aa}5)RIwct}n`NrJloTf9k-4Phr9q8@l;8SzCF zQ2glnICuDr(oZWuEw8M@SX&bsppM~FKYQre9^Y+UIDW?Pj>3MB0oC`bg}E+S&GB>p z3@Lcb9Q3b516Rr@_W_V5`!dxFFURev92qDeG=c+=b2pHlIAnk|M=`+op2 CgEuw+ diff --git a/test_comments.tok b/test_comments.tok deleted file mode 100644 index 2fb6907..0000000 --- a/test_comments.tok +++ /dev/null @@ -1,9 +0,0 @@ -1 1 700 "(* hello *)" -2 1 700 "(* hello *)" -3 1 700 "(* I'd think this is a legal "string" that contains several \n \t -escaped characters, isn't it? *)" -4 1 700 "(* \ *)" -5 1 700 "(* *)" -6 1 700 "(*{COMMENT}+ *)" -7 1 700 "(* * *)" -8 1 700 "(* (hello) *)" diff --git a/test_generalTokenTest.tok b/test_generalTokenTest.tok deleted file mode 100644 index 69b1571..0000000 --- a/test_generalTokenTest.tok +++ /dev/null @@ -1,61 +0,0 @@ -1 1 101 "This" -1 2 101 "is" -1 3 101 "a" -1 4 101 "test" -2 1 301 "9" -2 1 101 "combined" -2 2 301 "7" -2 2 101 "okens" -3 1 301 "12345" -4 1 301 "893247892" -5 1 101 "combined" -5 2 101 "DueToUnknownChar" -5 3 101 "_validtoken" -5 4 101 "__validtoken1" -5 5 101 "_valid_token2" -5 6 101 "validToken3_" -6 1 305 "true" -6 2 306 "false" -7 1 302 "null" -7 2 401 "while" -7 3 609 "!" -7 3 101 "wrong" -7 4 402 "if" -7 5 101 "when" -8 1 404 "else" -8 2 405 "type" -8 3 406 "function" -9 1 407 "return" -9 3 408 "external" -9 11 409 "as" -10 1 101 "string" -10 2 101 "_NOte_that_was_not_reserved" -11 7 508 ":" -11 7 507 ";" -11 7 509 "," -11 7 510 "->" -12 1 601 "+" -12 1 602 "-" -12 1 603 "*" -12 1 604 "/" -12 1 605 "%" -13 1 606 "<" -13 1 607 "=" -14 1 608 ":=" -15 2 101 "This" -15 3 101 "is" -15 4 101 "not" -15 5 101 "a" -15 6 101 "valid" -16 1 101 "String" -17 1 304 ""This is a valid String"" -18 1 609 "!" -18 1 611 "|" -19 1 612 "." -19 1 612 "." -20 1 700 "(* this is a comment *)" -21 2 603 "*" -21 2 101 "Not" -21 3 101 "a" -21 4 101 "comment" -22 3 610 "&" diff --git a/test_keywords.tok b/test_keywords.tok deleted file mode 100644 index 9e70321..0000000 --- a/test_keywords.tok +++ /dev/null @@ -1,29 +0,0 @@ -1 1 401 "while" -2 1 101 "While" -3 1 101 "whiLe" -4 1 402 "if" -5 1 101 "IF" -6 1 101 "If" -7 1 101 "iF" -8 1 403 "then" -9 1 101 "Then" -10 1 101 "theN" -11 1 404 "else" -12 1 101 "eLse" -13 1 101 "elSe" -14 1 101 "Else" -15 1 405 "type" -16 1 101 "Type" -17 1 101 "tyPe" -18 1 406 "function" -19 1 101 "Function" -20 1 101 "functioN" -21 1 407 "return" -22 1 101 "Return" -23 1 101 "returN" -24 1 408 "external" -25 1 101 "External" -26 1 101 "exteRnal" -27 1 409 "as" -28 1 101 "As" -29 1 101 "aS" diff --git a/test_operators.tok b/test_operators.tok deleted file mode 100644 index 9ca0302..0000000 --- a/test_operators.tok +++ /dev/null @@ -1,22 +0,0 @@ -1 1 601 "+" -2 1 602 "-" -3 1 603 "*" -4 1 604 "/" -6 1 605 "%" -7 1 606 "<" -9 1 607 "=" -10 1 608 ":=" -11 1 607 "=" -11 1 508 ":" -12 1 508 ":" -13 1 607 "=" -14 1 609 "!" -15 1 610 "&" -16 1 611 "|" -17 1 612 "." -18 1 101 "relEASE" -19 1 614 "release" -20 1 101 "RELEASE" -21 1 613 "reserve" -22 1 101 "RESERVE" -23 1 101 "reSERVe" diff --git a/test_otherpunc.tok b/test_otherpunc.tok deleted file mode 100644 index 005f61c..0000000 --- a/test_otherpunc.tok +++ /dev/null @@ -1,7 +0,0 @@ -1 1 507 ";" -2 1 508 ":" -3 1 509 "," -4 1 510 "->" -5 1 510 "->" -6 1 602 "-" -6 1 510 "->" diff --git a/test_simpleIntTest.tok b/test_simpleIntTest.tok deleted file mode 100644 index 2bdbdd3..0000000 --- a/test_simpleIntTest.tok +++ /dev/null @@ -1,3 +0,0 @@ -1 1 301 "45" -2 1 301 "123" -3 1 301 "8392" diff --git a/test_simpleLiterals.tok b/test_simpleLiterals.tok deleted file mode 100644 index 51f07e1..0000000 --- a/test_simpleLiterals.tok +++ /dev/null @@ -1,62 +0,0 @@ -1 1 304 ""this is a string"" -1 2 301 "721398" -1 3 303 "'g'" -1 5 604 "/" -1 5 101 "n" -1 7 700 "(* should print 3 tokens before this *)" -4 1 301 "12893" -4 3 101 "this" -4 4 101 "is" -4 5 101 "not" -4 6 101 "a" -4 7 101 "string" -4 8 700 "(*one valid token before this*)" -5 1 700 "(* spacey comment here -over multiple lines -will it work? *)" -9 1 306 "false" -10 1 700 "(**)" -12 1 101 "nullfalse" -13 2 101 "nulltrue" -14 1 302 "null" -15 1 303 "'7'" -16 1 305 "true" -17 2 301 "189" -18 1 303 "'\t'" -19 1 303 "'"'" -20 1 303 "'/'" -21 1 303 "'\n'" -22 1 303 "'\''" -23 1 303 "'\t'" -25 1 303 "'n'" -27 2 101 "fdsf" -28 1 700 "(*/jnewjno2893u86^ Lots of random characters /n /t '") *)" -33 1 304 ""STRINGwithnotSPaces"" -34 1 303 "' '" -36 1 304 ""J"" -37 1 304 """" -38 1 304 "" "" -40 1 304 ""{SCHAR}"" -41 1 304 ""SCHAR"" -42 1 304 ""[SCHAR]"" -43 1 304 ""FINAL: I'd think this is a legal \"string\" that contains \n \t several escaped characters, isn't it?"" -44 2 101 "I" -44 3 101 "d" -44 4 101 "think" -44 5 101 "this" -44 6 101 "is" -44 7 101 "a" -44 8 101 "legal" -44 11 101 "string" -44 14 101 "that" -44 15 101 "contains" -44 16 101 "several" -44 19 101 "n" -44 21 101 "t" -44 22 101 "escaped" -44 23 101 "characters" -44 23 509 "," -44 24 101 "isn" -44 25 101 "t" -44 26 101 "it" -45 1 101 "nullLike" From 90407da44c7e5e3a456292f4f73b9d228dcfcc39 Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Thu, 13 Feb 2025 19:00:43 -0500 Subject: [PATCH 037/105] ran make file to display all .tok files --- Makefile | 5 +- flex.h | 477 +++++++++ flex.o | Bin 0 -> 27880 bytes lex.yy.c | 2043 +++++++++++++++++++++++++++++++++++++ lexicalStructure.lex | 4 +- runner | Bin 0 -> 31632 bytes runner.o | Bin 0 -> 4216 bytes test_comments.tok | 9 + test_generalTokenTest.tok | 61 ++ test_keywords.tok | 29 + test_operators.tok | 22 + test_otherpunc.tok | 7 + test_simpleIntTest.tok | 3 + test_simpleLiterals.tok | 62 ++ 14 files changed, 2720 insertions(+), 2 deletions(-) create mode 100644 flex.h create mode 100644 flex.o create mode 100644 lex.yy.c create mode 100755 runner create mode 100644 runner.o create mode 100644 test_comments.tok create mode 100644 test_generalTokenTest.tok create mode 100644 test_keywords.tok create mode 100644 test_operators.tok create mode 100644 test_otherpunc.tok create mode 100644 test_simpleIntTest.tok create mode 100644 test_simpleLiterals.tok diff --git a/Makefile b/Makefile index 1c78b93..81376c3 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,10 @@ flex.o: lex.yy.c typedefs.h lex.yy.c: lexicalStructure.lex $(FLEX) -o lex.yy.c $(LEX) - + +debug: CFLAGS += -DDEBUG=1 +debug: clean runner + test: ./$(EXE) ./tests/test_comments.alpha ./$(EXE) ./tests/test_generalTokenTest.alpha diff --git a/flex.h b/flex.h new file mode 100644 index 0000000..c528013 --- /dev/null +++ b/flex.h @@ -0,0 +1,477 @@ +#ifndef yyHEADER_H +#define yyHEADER_H 1 +#define yyIN_HEADER 1 + +#line 6 "flex.h" + +#line 8 "flex.h" + +#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 + +/* 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 + +#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; + +#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; + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +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 ); + +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 * ); + +/* Begin user sect3 */ + +#define yywrap() (/*CONSTCOND*/1) +#define YY_SKIP_YYWRAP + +extern int yylineno; + +extern char *yytext; +#ifdef yytext_ptr +#undef yytext_ptr +#endif +#define yytext_ptr yytext + +#ifdef YY_HEADER_EXPORT_START_CONDITIONS +#define INITIAL 0 + +#endif + +#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 + +/* 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 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 + +#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 + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* 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 */ + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + +#undef YY_NEW_FILE +#undef YY_FLUSH_BUFFER +#undef yy_set_bol +#undef yy_new_buffer +#undef yy_set_interactive +#undef YY_DO_BEFORE_ACTION + +#ifdef YY_DECL_IS_OURS +#undef YY_DECL_IS_OURS +#undef YY_DECL +#endif + +#ifndef yy_create_buffer_ALREADY_DEFINED +#undef yy_create_buffer +#endif +#ifndef yy_delete_buffer_ALREADY_DEFINED +#undef yy_delete_buffer +#endif +#ifndef yy_scan_buffer_ALREADY_DEFINED +#undef yy_scan_buffer +#endif +#ifndef yy_scan_string_ALREADY_DEFINED +#undef yy_scan_string +#endif +#ifndef yy_scan_bytes_ALREADY_DEFINED +#undef yy_scan_bytes +#endif +#ifndef yy_init_buffer_ALREADY_DEFINED +#undef yy_init_buffer +#endif +#ifndef yy_flush_buffer_ALREADY_DEFINED +#undef yy_flush_buffer +#endif +#ifndef yy_load_buffer_state_ALREADY_DEFINED +#undef yy_load_buffer_state +#endif +#ifndef yy_switch_to_buffer_ALREADY_DEFINED +#undef yy_switch_to_buffer +#endif +#ifndef yypush_buffer_state_ALREADY_DEFINED +#undef yypush_buffer_state +#endif +#ifndef yypop_buffer_state_ALREADY_DEFINED +#undef yypop_buffer_state +#endif +#ifndef yyensure_buffer_stack_ALREADY_DEFINED +#undef yyensure_buffer_stack +#endif +#ifndef yylex_ALREADY_DEFINED +#undef yylex +#endif +#ifndef yyrestart_ALREADY_DEFINED +#undef yyrestart +#endif +#ifndef yylex_init_ALREADY_DEFINED +#undef yylex_init +#endif +#ifndef yylex_init_extra_ALREADY_DEFINED +#undef yylex_init_extra +#endif +#ifndef yylex_destroy_ALREADY_DEFINED +#undef yylex_destroy +#endif +#ifndef yyget_debug_ALREADY_DEFINED +#undef yyget_debug +#endif +#ifndef yyset_debug_ALREADY_DEFINED +#undef yyset_debug +#endif +#ifndef yyget_extra_ALREADY_DEFINED +#undef yyget_extra +#endif +#ifndef yyset_extra_ALREADY_DEFINED +#undef yyset_extra +#endif +#ifndef yyget_in_ALREADY_DEFINED +#undef yyget_in +#endif +#ifndef yyset_in_ALREADY_DEFINED +#undef yyset_in +#endif +#ifndef yyget_out_ALREADY_DEFINED +#undef yyget_out +#endif +#ifndef yyset_out_ALREADY_DEFINED +#undef yyset_out +#endif +#ifndef yyget_leng_ALREADY_DEFINED +#undef yyget_leng +#endif +#ifndef yyget_text_ALREADY_DEFINED +#undef yyget_text +#endif +#ifndef yyget_lineno_ALREADY_DEFINED +#undef yyget_lineno +#endif +#ifndef yyset_lineno_ALREADY_DEFINED +#undef yyset_lineno +#endif +#ifndef yyget_column_ALREADY_DEFINED +#undef yyget_column +#endif +#ifndef yyset_column_ALREADY_DEFINED +#undef yyset_column +#endif +#ifndef yywrap_ALREADY_DEFINED +#undef yywrap +#endif +#ifndef yyget_lval_ALREADY_DEFINED +#undef yyget_lval +#endif +#ifndef yyset_lval_ALREADY_DEFINED +#undef yyset_lval +#endif +#ifndef yyget_lloc_ALREADY_DEFINED +#undef yyget_lloc +#endif +#ifndef yyset_lloc_ALREADY_DEFINED +#undef yyset_lloc +#endif +#ifndef yyalloc_ALREADY_DEFINED +#undef yyalloc +#endif +#ifndef yyrealloc_ALREADY_DEFINED +#undef yyrealloc +#endif +#ifndef yyfree_ALREADY_DEFINED +#undef yyfree +#endif +#ifndef yytext_ALREADY_DEFINED +#undef yytext +#endif +#ifndef yyleng_ALREADY_DEFINED +#undef yyleng +#endif +#ifndef yyin_ALREADY_DEFINED +#undef yyin +#endif +#ifndef yyout_ALREADY_DEFINED +#undef yyout +#endif +#ifndef yy_flex_debug_ALREADY_DEFINED +#undef yy_flex_debug +#endif +#ifndef yylineno_ALREADY_DEFINED +#undef yylineno +#endif +#ifndef yytables_fload_ALREADY_DEFINED +#undef yytables_fload +#endif +#ifndef yytables_destroy_ALREADY_DEFINED +#undef yytables_destroy +#endif +#ifndef yyTABLES_NAME_ALREADY_DEFINED +#undef yyTABLES_NAME +#endif + +#line 76 "lexicalStructure.lex" + + +#line 476 "flex.h" +#undef yyIN_HEADER +#endif /* yyHEADER_H */ diff --git a/flex.o b/flex.o new file mode 100644 index 0000000000000000000000000000000000000000..c0c6827f98437382a2536fac1e48819a8616fb92 GIT binary patch literal 27880 zcmd6v4|tT-mGJK*0U{y^iY7?Vk$;AN5fCj1(kU`JRjTn%T-{_wPx3&!|8vOIruxtI?PrfZG?UyukOF!r~RV3dz_n!04 znZvwbpJ)5*UY?ovzQ23!x#ymH?tSn3W?nXiS6o{V2pCQQv(#kIm>N^rlFf%~He^c7 zSaYo8qK|7L>0jI$NgY|38G$8RdP=su2*+M~hRT>HM`u~Y!N``L^RhM4 z;r^1BNqx9~TWKT{?vJFyhn&gjFtmdbrsU5y zT~R^PmY&27P{7?oWwvneihSZbp@9dx`Zj}Q4~#E)IsEo#X`|#PeJBbp(5>%W6z)qt zp0A{9r=pE{C84a@0jFl9vg6{=Q+O`;L$_m6?AT7 zR`^iXUEu0%6dK|F*KnLX7eY(3OCD-0f*=dO1AgCP$J6;fQ&ix&4uWIp@F6v-PNy_) zVCL}f@b1?^$-p$wx%&;wO~l-rm>Y+=w=g#fb6XG0c4fa|4)r6m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M}32wJ%kKD;h{B;@fr@&sK+&Z6IMX!&Wx(M~DfF1YO1 zdLO=7arW~r#TP(3n4VFb<@<=EoeSZ^{W|EwKNftRkUyJ#e}Z}z30_H@$A#@#;KLUy z&US7R`mYlD9};}A;7D%l;RwR z-&LI3{ej}Ff1l#4|82!t&%27Vo?j{+vQ`>%RB_gG!iN`@yNc|8)<40APxaxm6z6v5 zE6)0FP@LDp2E|!VhY!DBan}E+;;d(v4}V5+*3(102;B5J`0#w}Rr0L=r;4+lk9_!V zeE7#cJV3w0@6lecmuQ=;pO&tAjrSL<{M?UGp9~2zd+qYK@z)ezLHvN=*kAtr!$HBZzs!dONBenw zE27`=qMs!{TXFO?rm4h>ATO^Avy?pRpRYLU2@5?}gD#He6-u7<+~LD(6=(fP#aT}m zakPJ-Xt!I*^Z33X<&fX4^ZO)66zBIz@I4+(Y(KyEHCu6hp9J5h zk@EaLNvq=g-pE%K=l8pwRh-`gk-w8f5q=M(U&-@(AjPzPU@?C9J&;Pp`8^O`r&*rg z18G+B{2s_Q#rZvuXBFr7K=v!n?}79y&hMcW(|lrk`27%G&zSRjN)aW`?_V`5&hIIi zs*cXKL|r``6LEKJ=3G45T32O%^j_5n{~d#=s_*D9RhGuv9cgH9Ym3GbrYhE+h*rUi z?Q`t=`EdGOeQeDY}p0vLI*Zh|k{8rVyR;p|Z~97Lvi(4_tb=eeVBKVAwwI z3n6RMM>E_J`zI61V&da 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 42 +#define YY_END_OF_BUFFER 43 +/* 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[131] = + { 0, + 0, 0, 43, 41, 40, 24, 41, 20, 25, 41, + 41, 18, 16, 30, 17, 27, 19, 32, 29, 28, + 21, 22, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 26, 0, 34, 0, 0, 0, 0, + 31, 32, 23, 39, 39, 39, 13, 39, 39, 39, + 39, 39, 6, 39, 39, 39, 39, 39, 39, 39, + 33, 0, 0, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 35, + 0, 39, 39, 39, 8, 39, 39, 39, 39, 38, + 39, 39, 39, 7, 36, 9, 39, 39, 39, 39, + + 39, 37, 39, 39, 39, 39, 39, 5, 39, 39, + 39, 39, 39, 39, 39, 39, 11, 3, 2, 39, + 39, 39, 1, 14, 15, 39, 12, 10, 4, 0 + } ; + +static const YY_CHAR yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 4, 5, 1, 1, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 18, 19, 20, + 21, 22, 1, 1, 23, 24, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 1, 25, 1, 1, 23, 1, 26, 23, 27, 28, + + 29, 30, 31, 32, 33, 23, 23, 34, 23, 35, + 36, 37, 23, 38, 39, 40, 41, 42, 43, 44, + 45, 23, 1, 46, 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, 1 + } ; + +static const YY_CHAR yy_meta[47] = + { 0, + 1, 2, 3, 1, 1, 1, 1, 2, 1, 1, + 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, + 1, 1, 4, 4, 1, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 1 + } ; + +static const flex_int16_t yy_base[135] = + { 0, + 0, 0, 160, 161, 161, 161, 42, 161, 161, 134, + 147, 161, 161, 161, 135, 161, 161, 139, 134, 161, + 161, 161, 0, 118, 20, 121, 16, 23, 21, 111, + 122, 20, 118, 161, 48, 161, 49, 141, 47, 137, + 161, 130, 161, 0, 110, 117, 0, 118, 104, 102, + 107, 105, 0, 99, 104, 23, 108, 95, 98, 101, + 161, 122, 58, 98, 93, 92, 100, 99, 88, 99, + 96, 90, 94, 93, 80, 85, 90, 89, 83, 161, + 60, 87, 86, 88, 0, 75, 83, 71, 79, 0, + 83, 70, 69, 0, 0, 0, 77, 79, 65, 76, + + 67, 0, 63, 66, 53, 46, 51, 0, 50, 44, + 41, 54, 43, 40, 48, 47, 0, 0, 0, 46, + 40, 37, 0, 0, 0, 28, 0, 0, 0, 161, + 89, 93, 57, 97 + } ; + +static const flex_int16_t yy_def[135] = + { 0, + 130, 1, 130, 130, 130, 130, 131, 130, 130, 132, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 130, 131, 130, 130, 130, 130, 134, + 130, 130, 130, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 130, 134, 134, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 130, + 134, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 0, + 130, 130, 130, 130 + } ; + +static const flex_int16_t yy_nxt[208] = + { 0, + 4, 4, 5, 6, 7, 8, 9, 10, 11, 4, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 4, 23, 24, 4, 25, 26, 23, 27, 28, + 23, 23, 29, 23, 30, 23, 23, 31, 23, 32, + 23, 23, 33, 23, 23, 34, 36, 46, 51, 49, + 53, 57, 36, 35, 38, 54, 73, 58, 47, 50, + 44, 74, 75, 52, 59, 129, 37, 80, 81, 130, + 81, 128, 37, 127, 126, 125, 124, 123, 122, 121, + 120, 38, 119, 35, 118, 117, 38, 116, 35, 35, + 35, 115, 35, 38, 114, 113, 38, 62, 62, 62, + + 62, 112, 111, 110, 109, 108, 107, 106, 105, 104, + 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, + 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, + 83, 82, 63, 79, 78, 77, 76, 72, 71, 70, + 69, 68, 67, 66, 65, 64, 42, 63, 61, 60, + 56, 55, 48, 45, 43, 42, 41, 40, 39, 130, + 3, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + + 130, 130, 130, 130, 130, 130, 130 + } ; + +static const flex_int16_t yy_chk[208] = + { 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, 1, 7, 25, 28, 27, + 29, 32, 35, 37, 39, 29, 56, 32, 25, 27, + 133, 56, 56, 28, 32, 126, 7, 63, 63, 81, + 81, 122, 35, 121, 120, 116, 115, 114, 113, 112, + 111, 39, 110, 37, 109, 107, 39, 106, 37, 131, + 131, 105, 131, 132, 104, 103, 132, 134, 134, 134, + + 134, 101, 100, 99, 98, 97, 93, 92, 91, 89, + 88, 87, 86, 84, 83, 82, 79, 78, 77, 76, + 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, + 65, 64, 62, 60, 59, 58, 57, 55, 54, 52, + 51, 50, 49, 48, 46, 45, 42, 40, 38, 33, + 31, 30, 26, 24, 19, 18, 15, 11, 10, 3, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + + 130, 130, 130, 130, 130, 130, 130 + } ; + +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 "lexicalStructure.lex" +/* Lexical Analysis with Flex (1.6.0) We used some of the code from this manual */ +/* so we placed the citation here. */ +/* definitions */ +#line 8 "lexicalStructure.lex" + #include + #include "typedefs.h" + int line_number = 1, column_number = 1; + #ifndef DEBUG + #define DEBUG 0 + #endif +#line 544 "lex.yy.c" +#line 21 "lexicalStructure.lex" + /* char can be a newline, tab, an escaped quote, or anything but a single quote, an actual line break, an actual tab, or a backslash by itself (to prevent confusion from escaped quote */ + /* similar to above, a string Char (SCHAR) is the same as a CHAR except we cannot have double quotes instead of single quotes. Double quotes need to be escaped in Flex unlike single quotes based on documentation */ +#line 548 "lex.yy.c" + +#define INITIAL 0 + +#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 + + static void yyunput ( int c, char *buf_ptr ); + +#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 \ + 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 25 "lexicalStructure.lex" + + +#line 768 "lex.yy.c" + + 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_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 >= 131 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 161 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + 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 27 "lexicalStructure.lex" +{if(DEBUG) {printf( "T_INTEGER: %s (%d)\n", yytext, T_INTEGER);} else {return T_INTEGER;}} + YY_BREAK +case 2: +YY_RULE_SETUP +#line 28 "lexicalStructure.lex" +{if(DEBUG) {printf( "T_ADDRESS: %s (%d)\n", yytext, T_ADDRESS);} else {return T_ADDRESS;}} + YY_BREAK +case 3: +YY_RULE_SETUP +#line 29 "lexicalStructure.lex" +{if(DEBUG) {printf( "T_BOOLEAN: %s (%d)\n", yytext, T_BOOLEAN);} else {return T_BOOLEAN;}} + YY_BREAK +case 4: +YY_RULE_SETUP +#line 30 "lexicalStructure.lex" +{if(DEBUG) {printf( "T_CHARACTER: %s (%d)\n", yytext, T_CHARACTER);} else {return T_CHARACTER;}} + YY_BREAK +case 5: +YY_RULE_SETUP +#line 32 "lexicalStructure.lex" +{if(DEBUG) {printf( "WHILE: %s (%d)\n", yytext, WHILE);} else {return WHILE;}} + YY_BREAK +case 6: +YY_RULE_SETUP +#line 33 "lexicalStructure.lex" +{if(DEBUG) {printf( "IF: %s (%d)\n", yytext, IF);} else {return IF;}} + YY_BREAK +case 7: +YY_RULE_SETUP +#line 34 "lexicalStructure.lex" +{if(DEBUG) {printf( "THEN: %s (%d)\n", yytext, THEN);} else {return THEN;}} + YY_BREAK +case 8: +YY_RULE_SETUP +#line 35 "lexicalStructure.lex" +{if(DEBUG) {printf( "ELSE: %s (%d)\n", yytext, ELSE);} else {return ELSE;}} + YY_BREAK +case 9: +YY_RULE_SETUP +#line 36 "lexicalStructure.lex" +{if(DEBUG) {printf( "TYPE: %s (%d)\n", yytext, TYPE);} else {return TYPE;}} + YY_BREAK +case 10: +YY_RULE_SETUP +#line 37 "lexicalStructure.lex" +{if(DEBUG) {printf( "FUNCTION: %s (%d)\n", yytext, FUNCTION);} else {return FUNCTION;}} + YY_BREAK +case 11: +YY_RULE_SETUP +#line 38 "lexicalStructure.lex" +{if(DEBUG) {printf( "RETURN: %s (%d)\n", yytext, RETURN);} else {return RETURN;}} + YY_BREAK +case 12: +YY_RULE_SETUP +#line 39 "lexicalStructure.lex" +{if(DEBUG) {printf( "EXTERNAL: %s (%d)\n", yytext, EXTERNAL);} else {return EXTERNAL;}} + YY_BREAK +case 13: +YY_RULE_SETUP +#line 40 "lexicalStructure.lex" +{if(DEBUG) {printf( "AS: %s (%d)\n", yytext, AS);} else {return AS;}} + YY_BREAK +case 14: +YY_RULE_SETUP +#line 42 "lexicalStructure.lex" +{if(DEBUG) {printf( "RELEASE: %s (%d)\n", yytext, RELEASE);} else {return RELEASE;}} + YY_BREAK +case 15: +YY_RULE_SETUP +#line 43 "lexicalStructure.lex" +{if(DEBUG) {printf( "RESERVE: %s (%d)\n", yytext, RESERVE);} else {return RESERVE;}} + YY_BREAK +case 16: +YY_RULE_SETUP +#line 45 "lexicalStructure.lex" +{if(DEBUG) {printf( "ADD: %s (%d)\n", yytext, ADD);} else {return ADD;}} + YY_BREAK +case 17: +YY_RULE_SETUP +#line 46 "lexicalStructure.lex" +{if(DEBUG) {printf( "SUB_OR_NEG: %s (%d)\n", yytext, SUB_OR_NEG);} else {return SUB_OR_NEG;}} + YY_BREAK +case 18: +YY_RULE_SETUP +#line 47 "lexicalStructure.lex" +{if(DEBUG) {printf( "MUL: %s (%d)\n", yytext, MUL);} else {return MUL;}} + YY_BREAK +case 19: +YY_RULE_SETUP +#line 48 "lexicalStructure.lex" +{if(DEBUG) {printf( "DIV: %s (%d)\n", yytext, DIV);} else {return DIV;}} + YY_BREAK +case 20: +YY_RULE_SETUP +#line 49 "lexicalStructure.lex" +{if(DEBUG) {printf( "REM: %s (%d)\n", yytext, REM);} else {return REM;}} + YY_BREAK +case 21: +YY_RULE_SETUP +#line 50 "lexicalStructure.lex" +{if(DEBUG) {printf( "LESS_THAN: %s (%d)\n", yytext, LESS_THAN);} else {return LESS_THAN;}} + YY_BREAK +case 22: +YY_RULE_SETUP +#line 51 "lexicalStructure.lex" +{if(DEBUG) {printf( "EQUAL_TO: %s (%d)\n", yytext, EQUAL_TO);} else {return EQUAL_TO;}} + YY_BREAK +case 23: +YY_RULE_SETUP +#line 52 "lexicalStructure.lex" +{if(DEBUG) {printf( "ASSIGN: %s (%d)\n", yytext, ASSIGN);} else {return ASSIGN;}} + YY_BREAK +case 24: +YY_RULE_SETUP +#line 53 "lexicalStructure.lex" +{if(DEBUG) {printf( "NOT: %s (%d)\n", yytext, NOT);} else {return NOT;}} + YY_BREAK +case 25: +YY_RULE_SETUP +#line 54 "lexicalStructure.lex" +{if(DEBUG) {printf( "AND: %s (%d)\n", yytext, AND);} else {return AND;}} + YY_BREAK +case 26: +YY_RULE_SETUP +#line 55 "lexicalStructure.lex" +{if(DEBUG) {printf( "OR: %s (%d)\n", yytext, OR);} else {return OR;}} + YY_BREAK +case 27: +YY_RULE_SETUP +#line 56 "lexicalStructure.lex" +{if(DEBUG) {printf( "DOT: %s (%d)\n", yytext, DOT);} else {return DOT;}} + YY_BREAK +case 28: +YY_RULE_SETUP +#line 58 "lexicalStructure.lex" +{if(DEBUG) {printf( "SEMI_COLON: %s (%d)\n", yytext, SEMI_COLON);} else {return SEMI_COLON;}} + YY_BREAK +case 29: +YY_RULE_SETUP +#line 59 "lexicalStructure.lex" +{if(DEBUG) {printf( "COLON: %s (%d)\n", yytext, COLON);} else {return COLON;}} + YY_BREAK +case 30: +YY_RULE_SETUP +#line 60 "lexicalStructure.lex" +{if(DEBUG) {printf( "COMMA: %s (%d)\n", yytext, COMMA);} else {return COMMA;}} + YY_BREAK +case 31: +YY_RULE_SETUP +#line 61 "lexicalStructure.lex" +{if(DEBUG) {printf( "ARROW: %s (%d)\n", yytext, ARROW);} else {return ARROW;}} + YY_BREAK +case 32: +YY_RULE_SETUP +#line 63 "lexicalStructure.lex" +{if(DEBUG) {printf( "C_INTEGER: %s (%d)\n", yytext, C_INTEGER);} else {return C_INTEGER;}} + YY_BREAK +case 33: +YY_RULE_SETUP +#line 64 "lexicalStructure.lex" +{if(DEBUG) {printf( "C_CHARACTER: %s (%d)\n", yytext, C_CHARACTER);} else {return C_CHARACTER;}} + YY_BREAK +case 34: +YY_RULE_SETUP +#line 65 "lexicalStructure.lex" +{if(DEBUG) {printf( "C_STRING: %s (%d)\n", yytext, C_STRING);} else {return C_STRING;}} + YY_BREAK +case 35: +/* rule 35 can match eol */ +YY_RULE_SETUP +#line 66 "lexicalStructure.lex" +{if(DEBUG) {printf( "COMMENT: %s (%d)\n", yytext, COMMENT);} else {return COMMENT;}} + YY_BREAK +case 36: +YY_RULE_SETUP +#line 67 "lexicalStructure.lex" +{if(DEBUG) {printf( "C_TRUE: %s (%d)\n", yytext, C_TRUE);} else {return C_TRUE;}} + YY_BREAK +case 37: +YY_RULE_SETUP +#line 68 "lexicalStructure.lex" +{if(DEBUG) {printf( "C_FALSE: %s (%d)\n", yytext, C_FALSE);} else {return C_FALSE;}} + YY_BREAK +case 38: +YY_RULE_SETUP +#line 69 "lexicalStructure.lex" +{if(DEBUG) {printf( "C_NULL: %s (%d)\n", yytext, C_NULL);} else {return C_NULL;}} + YY_BREAK +case 39: +YY_RULE_SETUP +#line 71 "lexicalStructure.lex" +{if(DEBUG) {printf( "ID: %s (%d)\n", yytext, ID);} else {return ID;}} + YY_BREAK +case 40: +/* rule 40 can match eol */ +YY_RULE_SETUP +#line 73 "lexicalStructure.lex" +{line_number++; column_number = 1;} + YY_BREAK +case 41: +YY_RULE_SETUP +#line 74 "lexicalStructure.lex" +{column_number++;} + YY_BREAK +case 42: +YY_RULE_SETUP +#line 76 "lexicalStructure.lex" +ECHO; + YY_BREAK +#line 1037 "lex.yy.c" +case YY_STATE_EOF(INITIAL): + yyterminate(); + + 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_c_buf_p); + 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); + + 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 >= 131 ) + 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 >= 131 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_is_jam = (yy_current_state == 130); + + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_UNPUT + + static void yyunput (int c, char * yy_bp ) +{ + char *yy_cp; + + yy_cp = (yy_c_buf_p); + + /* undo effects of setting up yytext */ + *yy_cp = (yy_hold_char); + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + int number_to_move = (yy_n_chars) + 2; + char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; +} + +#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); + + 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 76 "lexicalStructure.lex" + + diff --git a/lexicalStructure.lex b/lexicalStructure.lex index a79ebfd..86799c2 100644 --- a/lexicalStructure.lex +++ b/lexicalStructure.lex @@ -8,7 +8,9 @@ #include #include "typedefs.h" int line_number = 1, column_number = 1; - bool DEBUG = false; + #ifndef DEBUG + #define DEBUG 0 + #endif %} COM ([^*]|\*+[^)*])* diff --git a/runner b/runner new file mode 100755 index 0000000000000000000000000000000000000000..1af2d69cd79231bcee0f7ba1fc3fffd4f4a080ab GIT binary patch literal 31632 zcmeHwd3;n=p6{t77s3(}kTPM@VwEi+ARvfKSPBaT4MJ>Gu&5*zk|s&TN)-?#hz69J zOBC0}ab_C3?bddCw9<->OF*;`Xbr7xjN)Oz3FS#I5XP5I`%&-CZb zA35RH?{|LNIp=qNXSt^?b#HPnUYO=^FqP8TMT~N7g9N2WGFs~;0#L+eu`GO^&CX)I zkk8;W!7ma3T#=5YSz)H6rvs8+9wFVp;eyN*R5c_>da2UteuASQ%Mp3f(+HJ$J9Li| zatbQGQC^YY8x52BJp%<@L9-tDCU2GC=hawYhHUpP36&nXi}c1zz41~{!4ByN1(iR^ zCv?q{_Uy0_JW2}M^(v*F9WD@ROhGDx(y~uO<^M0`6-&L0%Y+>}Tq)b9pek=E^vEy& z)ug)lN?Bg2eu&BVR8SVrrc_sz&YV7_x;($Ssy4hKf5WVq`7@^%)CUTt@hVWgT(~Hv zF1fsf!AuL$RClIr7I|flc!MRM9{^12d4s{FbtQ7QL zr=XXopm&1q!evkY1VVS^9!f#qm4be03VL-4`py*er77sIq@dF{>aPChrJxT$hq=JB zr<+0O&JM*vcl6v8bef*KlV6a6{%i{R3n}O$Qq=$A6!I%TAIOF>R~--}HQ&Gt8^tNs zj~kIC`9hogoswQ;qcg9!Y=h5RQB~`!uDZd`DypjewE zud0^Shk|7_b*!Q;SXCRUU~BxLGFB0&^VhP9vg$y+pVjzl>ir?el?TEhRuT03NvF1~ zu7Mzov!GuXhX@RoRr`HGe=x`@@DT`-BIO_(EUN?+(&eZJXte<^>f{Sm1!|dpLlum# z4_1ZztW21zs`rIL4U8&G)5}bD$>K%x=6k0VoIBk>rxna#-bKrocu|IbO;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_=;A;UZ%4J`pZAvLXs7Boi9ybj4GN$!(nh<6t?H1HQC zH8kMWN$3`3$MnFKe9Mu=5GEEhSdKaIVkQf}p@I5{Vuc?3f&c~%vQ!4SNW8+yreS*M z3qfFc8K#rtThvUv@M#U+qjUv|$J?H~VR}}tp@ANdGo}YV z4#j(?YzE*%nj%$%i_Ll)*IQc8$9XV>*IdC7B+KW$it1#w z#7nI#iqvv%ZMde?Pote02W5H@l|@Rtl*&T#dY3PmFUNXWpgLSrtIY7R((MbTL^r8` zq%Nbrw7#s%QV8l(W+Cuq!Gq}c0KI#QUaMshUJHW2a` ztf>tb)CKX9uOQy9l_ZshtMFRCs&Yx1J8w}wEr(pZ(pO)}3h?wKiV!dq6dXK+Sx;~9 z;$kx61uy8Y_K||b>Z(JmfUhbAKnvCckR_xZOGW`7I|Y0^7X$-*)ED?G<%(EY4r?kW zY>1_iaSesbCp%F&nluU!6RZGhat)T+AMO(V?`x?xZfnf?_V-baF*F6D_O*&k=X+*-b-t*eO9@J7*Z&FV z__5@Gs=qpaS5R)}jPrMU{e94Mv>@Be=R)vWK5dJ3+# zIb5=hVji~XZThSF0|oF^ySukP~{ETI8vN=i?W zUIt=rzdD~$FiQzaX!qZ%QeVXnE0Tf|rmHWeB-tgQ0>1}Bbz9F54c0NpT-|0rKkGwG0;dv>8tPe^1LLC9}5w{_*D7|(mAwQ-#7C59egG+U#WQHns1V?;&RtvaG#@`5J t=_p0jU(LULKvQ)W8samyR=~r?#3J&lTqR4xwLAT%gF<4cO~ICB{~Iq^?W6zz literal 0 HcmV?d00001 diff --git a/runner.o b/runner.o new file mode 100644 index 0000000000000000000000000000000000000000..00c2836f5eb4c7ad11fa80c9286bd62f68f1c66b GIT binary patch literal 4216 zcmbtWU1(fI6rN4mq}H@a>tAg}ZVS~Y%{6Ib(NgQyvgS(tqZlbzh@0KJ-EDX8E_d&> ziDlcu8uhXS1bt8t!6)%W3i?n*N>oTG6v=}vd8p7AA+>pk+K07O>iOo**^IY)@xeo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NKwD;~EbCoS%0z9B&ij(;D8Z;qPlW-VNq|rs0V5AT`KW3dfr3 zs4@R*4PUR}=QTfi{1;>JpEW;tL)rhY8eiY<%^3bL4xEJRBp*)2ZiT~#URQ@ST)%e} z4cG78afPEpez*=l()joma{S+FxbFWa4aa|Y%)hST_i8wQXc52eXETBzffTVP5K{Wpz5VF^bd=iA9j4R;?i^MdXr=WPj-GR=cY@xisb)w z2AQLzkXv1nYT~H8u}+mAPsJu0A*aa}5)RIwct}n`NrJloTf9k-4Phr9q8@l;8SzCF zQ2glnICuDr(oZWuEw8M@SX&bsppM~FKYQre9^Y+UIDW?Pj>3MB0oC`bg}E+S&GB>p z3@Lcb9Q3b516Rr@_W_V5`!dxFFURev92qDeG=c+=b2pHlIAnk|M=`+op2 CgEuw+ literal 0 HcmV?d00001 diff --git a/test_comments.tok b/test_comments.tok new file mode 100644 index 0000000..2fb6907 --- /dev/null +++ b/test_comments.tok @@ -0,0 +1,9 @@ +1 1 700 "(* hello *)" +2 1 700 "(* hello *)" +3 1 700 "(* I'd think this is a legal "string" that contains several \n \t +escaped characters, isn't it? *)" +4 1 700 "(* \ *)" +5 1 700 "(* *)" +6 1 700 "(*{COMMENT}+ *)" +7 1 700 "(* * *)" +8 1 700 "(* (hello) *)" diff --git a/test_generalTokenTest.tok b/test_generalTokenTest.tok new file mode 100644 index 0000000..69b1571 --- /dev/null +++ b/test_generalTokenTest.tok @@ -0,0 +1,61 @@ +1 1 101 "This" +1 2 101 "is" +1 3 101 "a" +1 4 101 "test" +2 1 301 "9" +2 1 101 "combined" +2 2 301 "7" +2 2 101 "okens" +3 1 301 "12345" +4 1 301 "893247892" +5 1 101 "combined" +5 2 101 "DueToUnknownChar" +5 3 101 "_validtoken" +5 4 101 "__validtoken1" +5 5 101 "_valid_token2" +5 6 101 "validToken3_" +6 1 305 "true" +6 2 306 "false" +7 1 302 "null" +7 2 401 "while" +7 3 609 "!" +7 3 101 "wrong" +7 4 402 "if" +7 5 101 "when" +8 1 404 "else" +8 2 405 "type" +8 3 406 "function" +9 1 407 "return" +9 3 408 "external" +9 11 409 "as" +10 1 101 "string" +10 2 101 "_NOte_that_was_not_reserved" +11 7 508 ":" +11 7 507 ";" +11 7 509 "," +11 7 510 "->" +12 1 601 "+" +12 1 602 "-" +12 1 603 "*" +12 1 604 "/" +12 1 605 "%" +13 1 606 "<" +13 1 607 "=" +14 1 608 ":=" +15 2 101 "This" +15 3 101 "is" +15 4 101 "not" +15 5 101 "a" +15 6 101 "valid" +16 1 101 "String" +17 1 304 ""This is a valid String"" +18 1 609 "!" +18 1 611 "|" +19 1 612 "." +19 1 612 "." +20 1 700 "(* this is a comment *)" +21 2 603 "*" +21 2 101 "Not" +21 3 101 "a" +21 4 101 "comment" +22 3 610 "&" diff --git a/test_keywords.tok b/test_keywords.tok new file mode 100644 index 0000000..9e70321 --- /dev/null +++ b/test_keywords.tok @@ -0,0 +1,29 @@ +1 1 401 "while" +2 1 101 "While" +3 1 101 "whiLe" +4 1 402 "if" +5 1 101 "IF" +6 1 101 "If" +7 1 101 "iF" +8 1 403 "then" +9 1 101 "Then" +10 1 101 "theN" +11 1 404 "else" +12 1 101 "eLse" +13 1 101 "elSe" +14 1 101 "Else" +15 1 405 "type" +16 1 101 "Type" +17 1 101 "tyPe" +18 1 406 "function" +19 1 101 "Function" +20 1 101 "functioN" +21 1 407 "return" +22 1 101 "Return" +23 1 101 "returN" +24 1 408 "external" +25 1 101 "External" +26 1 101 "exteRnal" +27 1 409 "as" +28 1 101 "As" +29 1 101 "aS" diff --git a/test_operators.tok b/test_operators.tok new file mode 100644 index 0000000..9ca0302 --- /dev/null +++ b/test_operators.tok @@ -0,0 +1,22 @@ +1 1 601 "+" +2 1 602 "-" +3 1 603 "*" +4 1 604 "/" +6 1 605 "%" +7 1 606 "<" +9 1 607 "=" +10 1 608 ":=" +11 1 607 "=" +11 1 508 ":" +12 1 508 ":" +13 1 607 "=" +14 1 609 "!" +15 1 610 "&" +16 1 611 "|" +17 1 612 "." +18 1 101 "relEASE" +19 1 614 "release" +20 1 101 "RELEASE" +21 1 613 "reserve" +22 1 101 "RESERVE" +23 1 101 "reSERVe" diff --git a/test_otherpunc.tok b/test_otherpunc.tok new file mode 100644 index 0000000..005f61c --- /dev/null +++ b/test_otherpunc.tok @@ -0,0 +1,7 @@ +1 1 507 ";" +2 1 508 ":" +3 1 509 "," +4 1 510 "->" +5 1 510 "->" +6 1 602 "-" +6 1 510 "->" diff --git a/test_simpleIntTest.tok b/test_simpleIntTest.tok new file mode 100644 index 0000000..2bdbdd3 --- /dev/null +++ b/test_simpleIntTest.tok @@ -0,0 +1,3 @@ +1 1 301 "45" +2 1 301 "123" +3 1 301 "8392" diff --git a/test_simpleLiterals.tok b/test_simpleLiterals.tok new file mode 100644 index 0000000..51f07e1 --- /dev/null +++ b/test_simpleLiterals.tok @@ -0,0 +1,62 @@ +1 1 304 ""this is a string"" +1 2 301 "721398" +1 3 303 "'g'" +1 5 604 "/" +1 5 101 "n" +1 7 700 "(* should print 3 tokens before this *)" +4 1 301 "12893" +4 3 101 "this" +4 4 101 "is" +4 5 101 "not" +4 6 101 "a" +4 7 101 "string" +4 8 700 "(*one valid token before this*)" +5 1 700 "(* spacey comment here +over multiple lines +will it work? *)" +9 1 306 "false" +10 1 700 "(**)" +12 1 101 "nullfalse" +13 2 101 "nulltrue" +14 1 302 "null" +15 1 303 "'7'" +16 1 305 "true" +17 2 301 "189" +18 1 303 "'\t'" +19 1 303 "'"'" +20 1 303 "'/'" +21 1 303 "'\n'" +22 1 303 "'\''" +23 1 303 "'\t'" +25 1 303 "'n'" +27 2 101 "fdsf" +28 1 700 "(*/jnewjno2893u86^ Lots of random characters /n /t '") *)" +33 1 304 ""STRINGwithnotSPaces"" +34 1 303 "' '" +36 1 304 ""J"" +37 1 304 """" +38 1 304 "" "" +40 1 304 ""{SCHAR}"" +41 1 304 ""SCHAR"" +42 1 304 ""[SCHAR]"" +43 1 304 ""FINAL: I'd think this is a legal \"string\" that contains \n \t several escaped characters, isn't it?"" +44 2 101 "I" +44 3 101 "d" +44 4 101 "think" +44 5 101 "this" +44 6 101 "is" +44 7 101 "a" +44 8 101 "legal" +44 11 101 "string" +44 14 101 "that" +44 15 101 "contains" +44 16 101 "several" +44 19 101 "n" +44 21 101 "t" +44 22 101 "escaped" +44 23 101 "characters" +44 23 509 "," +44 24 101 "isn" +44 25 101 "t" +44 26 101 "it" +45 1 101 "nullLike" From 3c6d3be9b403cedd51bc8d101310429289f86aec Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Thu, 13 Feb 2025 19:28:38 -0500 Subject: [PATCH 038/105] testing int with yyleng --- flex.o | Bin 27880 -> 27952 bytes lex.yy.c | 2 +- lexicalStructure.lex | 2 +- runner | Bin 31632 -> 31632 bytes test_simpleIntTest.tok | 5 +++++ tests/test_simpleIntTest.alpha | 3 ++- 6 files changed, 9 insertions(+), 3 deletions(-) diff --git a/flex.o b/flex.o index c0c6827f98437382a2536fac1e48819a8616fb92..ca2157c706aba473e84b983141b9b06e00cd79b0 100644 GIT binary patch delta 5715 zcmZ{o3s98T703620aQd5mFrEUu+}!4Rs*Xh8Cn7+?M>9&TZB7 z4upMD?1lGyS40-zoZ)ab*D$Grzu`_#}qhTd=JW_&XQ3#HgVR{eYkCSbE`exqx? z3L%X772DrK6eIs+M4G+yLcCCpIIbyuOoB;%3HJ(9)t5#N&d6nNqq|V;mqI`ct%7#6 zIqXk?2>L%@B|wT=!28}B-*~KG&$*UkR&Z7u`yK4R#ufH~2uN`N!bK8)YVt3zf1UlC zZ11tnfGE-u2%)WlAlfCYJj+TOE3dG!hwUFoaUV>=pU&{UEvTaBi=Wn`h)6gBI-ftRuGwBdFp2 zE0yANw*TWuG29|F1|J^w7}CHuN2*MNPBv&3QSk)C(dI!ABWsMvDMn-+gfM0$+n;dF z7mP@A?rAUVW+V6wA{Bg)BPZ4uj zt!8yK`_GZDI#RJ1Hk!Y=Gj?#yE{;C{eOT)#D<@dFjCG|LVEYy6&^k9As<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tjs!i=r&!t9M z0y634)VR>I_X+3Y3^>31DfS|Ll^T(^3zh>4949feL#?B&w3Q zelG|yp$8iaT3p>&(ARXJ*KBnbCHLN?_NKGFv(=5%^X_Hpz4ZRwDXu5);pC%hovVXl z!yp<*(6g9j&!jUx-^cuA<|&2L^fl2IA>$jrE>Kz4Zw=`!45k*|LPtbmgW(SGg<=%e z<6bqiT{NeUO+Cx4>#P2_shhgNHzf>BdPB&LmTs8&Qdszb_*#?rN|X4GUvz74HA=5H z(M}#n{;^=V!0i%$7`O>Z6X+BFLC666hsfRaId_XkqBC3JV@ zt5$8vG5iCd4bGQCBERUG|Yek8^jCkOez~Qai;aozP1w%&~GrTS~uni{N zaYx8<%b=jvj-r5oy4LO6;8@1M9D=*;FfAAnZ>js1UKtUs22t4vyXD4lItgV9-5Oz6 zUng63yqZh{vh8Xs8jp596=vHl*G|)>>}YiY?T4u?oknZYuY!&mX;=Hw0JM2DUdV-L z@2A($DztxOq#8pfAcxQ`v?|$h?3U}_Q@@;O^*oKqv8!LxvuF>|2DG128QKGM0__gE zh4wA7<=WNDl!103jX}GBo<+O3WJB)Wc4~S_?)V=x+q_f^5YGUNk)Mx%79~WPK)I8{ zY}8p=d;8f-e)cn30yZ;RvU!+Ae%fNcaO^(X1@_AXX+7qTjrFsy(mAl5k|ldcg3{N| z?xzk@-chGh*_0G@FL|ddRBa^_pTO|bY01N@&jYD&bvaW?r$lAzqgM(c=5cp_+g*L7)$V7<``KZ1EI&+rkG%N{)!j64T9`VCo}HGW zR?|PGrC4h3rjyeKtKBGedWyP&a?!4$C1}^suIcY}5Zea{PhiJ!SC?q+j3KI(%4V#w tz3ndtm#cURc+6!e1{{eNhnqvR} diff --git a/test_simpleIntTest.tok b/test_simpleIntTest.tok index 2bdbdd3..e7925f5 100644 --- a/test_simpleIntTest.tok +++ b/test_simpleIntTest.tok @@ -1,3 +1,8 @@ 1 1 301 "45" 2 1 301 "123" 3 1 301 "8392" +4 1 301 "40" +4 2 301 "40" +5 2 301 "200" +5 3 301 "50" +5 4 301 "21783" diff --git a/tests/test_simpleIntTest.alpha b/tests/test_simpleIntTest.alpha index 507ec22..127f0a6 100644 --- a/tests/test_simpleIntTest.alpha +++ b/tests/test_simpleIntTest.alpha @@ -1,4 +1,5 @@ 45 123 8392 - +40 40 + 200 50 21783 From 52a7c69dae50ecabe8d4a123ff9deac4a75854a3 Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Thu, 13 Feb 2025 20:02:42 -0500 Subject: [PATCH 039/105] updated comment count --- flex.o | Bin 27952 -> 27880 bytes lex.yy.c | 2 +- lexicalStructure.lex | 2 +- runner | Bin 31632 -> 31632 bytes runner.c | 11 +++ runner.h | 3 +- runner.o | Bin 4216 -> 4616 bytes test_comments.tok | 10 +-- test_generalTokenTest.tok | 78 +++++++++++----------- test_operators.tok | 2 +- test_otherpunc.tok | 2 +- test_simpleIntTest.tok | 6 +- test_simpleLiterals.tok | 115 ++++++++++++++++---------------- tests/test_simpleLiterals.alpha | 2 +- 14 files changed, 123 insertions(+), 110 deletions(-) diff --git a/flex.o b/flex.o index ca2157c706aba473e84b983141b9b06e00cd79b0..c0c6827f98437382a2536fac1e48819a8616fb92 100644 GIT binary patch delta 5683 zcmZ{o4{%La9>?!Vh=kBQe|j8J@<=OPw)RD6sY)UV3GwG48idIDlawxvvPxt! zV`v##h+Z^uZxdT*=sx&zMyrW3CMTQm95A#TwK)UDa)fiFScy-mzX#WIDpkasU7E?3 zkr*3E6jg&|$t6S0NjifJz3qt_Vf4f&Vrg9e5~FuTWUy5I4eeoSRT^4^R-%=Lx+7U; z=wkSXNO7ZS=#a;fMFm15q?pHcAtKa&4XtF~)K+b76U$8J?DVDM{=-=N9sIdcePq$6 zEV>WDT-ousO))c9Vnc3f;Hst4c$^$Mbi3)%Gh?#T7QQ?wQqf5Ddh@*16U}jSY@YFX zihX{reZ&allYcQQ6IiL{{vyusMw|?r5Y3b71B=?{vxn*NIP|QhqJ`}>wh!0_5XzTg zI9kaT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{Ch2uoMxD*l5GSH6MQ-@5hFj%|i8Rvqs?=tFA%$2Q=gyFjd#s#HH#O%xWUs&vc*AJQ}WL8Qq+*Fq5K9sMA(-$9Q<2&w&F z+P@tXPidr;`erkcI>To7yB*?4yY$7n$w7~TXU)U^6uTYt6R1XdRbOxi9P}2nBenl~ z^Xffr_bVZS)T=LN4G!vu7}BMhc01@ga5qTRsp)`&?u7u-2by~I-m&}L4=qSP(if}- z2mKnt4PPW=WWy_K3-KB4^xA1+A&5plY-&t_vc^`?+#7B53xSU?O@GISyJ*wn{|DCN BwFm$J diff --git a/lex.yy.c b/lex.yy.c index 683e3bd..09a71bf 100644 --- a/lex.yy.c +++ b/lex.yy.c @@ -824,7 +824,7 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP #line 27 "lexicalStructure.lex" -{if(DEBUG) {printf( "T_INTEGER: %s (%d)\n", yytext, T_INTEGER);} else {column_number=column_number+yyleng; return T_INTEGER;}} +{if(DEBUG) {printf( "T_INTEGER: %s (%d)\n", yytext, T_INTEGER);} else {return T_INTEGER;}} YY_BREAK case 2: YY_RULE_SETUP diff --git a/lexicalStructure.lex b/lexicalStructure.lex index ef6b184..86799c2 100644 --- a/lexicalStructure.lex +++ b/lexicalStructure.lex @@ -23,7 +23,7 @@ SCHAR \\n|\\t|\\\"|[^\"\n\\] %% -"integer" {if(DEBUG) {printf( "T_INTEGER: %s (%d)\n", yytext, T_INTEGER);} else {column_number=column_number+yyleng; return T_INTEGER;}} +"integer" {if(DEBUG) {printf( "T_INTEGER: %s (%d)\n", yytext, T_INTEGER);} else {return T_INTEGER;}} "address" {if(DEBUG) {printf( "T_ADDRESS: %s (%d)\n", yytext, T_ADDRESS);} else {return T_ADDRESS;}} "Boolean" {if(DEBUG) {printf( "T_BOOLEAN: %s (%d)\n", yytext, T_BOOLEAN);} else {return T_BOOLEAN;}} "character" {if(DEBUG) {printf( "T_CHARACTER: %s (%d)\n", yytext, T_CHARACTER);} else {return T_CHARACT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0P{QExwt%hnL9f__M>;+R~zVTyB;*)& zCe#eARf}QM*x~=z@^+vFuf>4$IzvAf2*aGd42^^vkLFh+S%^<`i`)`@Y-5+Ccbjv& z#al-4jd=rT#hREW(tVSU$WIS`>N)86g*)57`EUsdcX zcqYtK-eednK)(ZR1-%OLg5Cr9Kuw_2pl?CvL03UR#|$G96b(uQrGxT7<3JNZQ$ce< zi$D*7{tL7g^b}|dXd7q;=&fT$p0OXoVbEuwW>6dGN6-yW=%f@)V@lsC&rTV}cJR}u4dV#-_Ad>i z9o&bN91$c*E1L~t82D1`l`?Pxd@1;?cpdl=KLUVel)B^? zJ{RRWUX3!CzksrmzlSoOe_86XZEfZ^OXFdVo8pou@i8bD@wuj4jdCV`0i}b#H)Wul z%TGcc%&($UxUWAmG1>R*2+(THMH_;U~jkb z0p;8HgD{ZvdKeZ4S!6s>W%sN=XaKc}T{P8RhhD^8-N z-#OIOr%MAZLyBb>mMI(#2`1%R`lejo_r5<)s>Z)7^j#KAdJg8kXuqSsP?*aB;-4-3 z;Z&jDW#M;O`lAZB-9Jyx^xkv7OO_||#}*dbUd!c&7G^o+e1Ww*rHj~A)I<>PvuMS{ z(p+K1Ukm0}imgJ{);v+S#z&fA>C>!eE(<@`($D8ji=u5G+`_+GwA^_hM_98g(0&WF zoUg3Nwq4BOuT^Bp5&UFDu{@S1F3z?+pT+N7oMn44gRcSGmd$r9em2eAN{H|&b|Iy7 zE3QfU%q;+Z($Zhca>`i@SQP95txZJ#r diff --git a/runner.c b/runner.c index 8567aea..30f7551 100644 --- a/runner.c +++ b/runner.c @@ -26,6 +26,17 @@ int main(int argc, char *argv[]) { if (arg == TOK_ARG) { fprintf(output, "%d %d %3d \"%s\"\n", line_number, column_number, token, yytext); } + if(token == COMMENT){ + for (int i = 0; i < yyleng; i++) { + if(yytext[i] == '\n'){ + line_number++; + column_number = 0; + } + column_number++; + } + continue; + } + column_number += yyleng; } if (yyin != NULL) { diff --git a/runner.h b/runner.h index 07ec277..b7c7369 100644 --- a/runner.h +++ b/runner.h @@ -14,6 +14,7 @@ #include #include #include "flex.h" +#include "typedefs.h" extern int line_number, column_number; extern char *yytext; @@ -22,4 +23,4 @@ int arg; int main(int argc, char* argv[]); char *is_tok(int argc, char* argv[]); -int is_alpha_file(char *file, int file_len); \ No newline at end of file +int is_alpha_file(char *file, int file_len); diff --git a/runner.o b/runner.o index 00c2836f5eb4c7ad11fa80c9286bd62f68f1c66b..6778a689da82ad0f00fa83c9b9985ff9dd0930ef 100644 GIT binary patch delta 1092 zcmZ{jPiPZS5XRrUWV6jCyPK`8o4pi;LTu@wy%-hg`iF(!$=q6Rz38cuLrV;_E^Vl^ zMzG0%h$14rND(PStb&NQdgviS5A`G-glI!gLUNGC_p%904;^^B!|(gv%)I4o>&)u# z`Z>O8lt(L^@$%<1&qKL6$FqR5a6|e1jxmNG!S$CG8=p91^HV!sT`+cVEmInlNy)2c zo@StCzGs)Ud8edESo{KOon)u;?D&ogMXwHl_o7!{s2&V-t94vZ3wC!pt$B^&Vqb%q zE0@~sb~VB`K@5U#Lx+iFkuc9lJmA;$NT|T^O?VfUv7n@2179h5kvox>;Ny~FV=a<| zM>4CZNqCN+BENeFAFCtPZFPjhef$}}R`9NfyY}>~P zp*D!B619mlG20&u2_!gB#j?I|m>~=kJP?^q( zC1VfI#$9o}XX3WF>V^0Z_=D4WTAS(%^qhjv^z$%^-;5Nt^duh(W4|#8l3<&6Lv6HwfhPoRy-nU{_EFXLn#)-#N3lYg?RGpbKkWGe@HUim`Cp!Y! z%O^kN60hIF2(q4mfdz;Kf%wmV2-t}vE`%h05-JXI95<5qRUG1Xk<1ZBQvV7fKDnJs zQ1UkpH71iM@`y{?fUE)nkPCT%80Ny5$p?Y51xT{&NV3(FKLTZEBFTy%$?gH^HN1i( zD~crh1xZ{CNt|J_BCj~3;^anNamfH?pac+rl!BPKAPx{jOy0$xhXVFY7Ce)c1noFKfI" +11 8 507 ";" +11 9 509 "," +11 10 510 "->" 12 1 601 "+" -12 1 602 "-" -12 1 603 "*" -12 1 604 "/" -12 1 605 "%" +12 2 602 "-" +12 3 603 "*" +12 4 604 "/" +12 5 605 "%" 13 1 606 "<" -13 1 607 "=" +13 2 607 "=" 14 1 608 ":=" 15 2 101 "This" -15 3 101 "is" -15 4 101 "not" -15 5 101 "a" -15 6 101 "valid" +15 7 101 "is" +15 10 101 "not" +15 14 101 "a" +15 16 101 "valid" 16 1 101 "String" 17 1 304 ""This is a valid String"" 18 1 609 "!" -18 1 611 "|" -19 1 612 "." +18 2 611 "|" 19 1 612 "." +19 2 612 "." 20 1 700 "(* this is a comment *)" 21 2 603 "*" -21 2 101 "Not" -21 3 101 "a" -21 4 101 "comment" +21 3 101 "Not" +21 7 101 "a" +21 9 101 "comment" 22 3 610 "&" diff --git a/test_operators.tok b/test_operators.tok index 9ca0302..dd3eaab 100644 --- a/test_operators.tok +++ b/test_operators.tok @@ -7,7 +7,7 @@ 9 1 607 "=" 10 1 608 ":=" 11 1 607 "=" -11 1 508 ":" +11 2 508 ":" 12 1 508 ":" 13 1 607 "=" 14 1 609 "!" diff --git a/test_otherpunc.tok b/test_otherpunc.tok index 005f61c..7500378 100644 --- a/test_otherpunc.tok +++ b/test_otherpunc.tok @@ -4,4 +4,4 @@ 4 1 510 "->" 5 1 510 "->" 6 1 602 "-" -6 1 510 "->" +6 2 510 "->" diff --git a/test_simpleIntTest.tok b/test_simpleIntTest.tok index e7925f5..0bcbefb 100644 --- a/test_simpleIntTest.tok +++ b/test_simpleIntTest.tok @@ -2,7 +2,7 @@ 2 1 301 "123" 3 1 301 "8392" 4 1 301 "40" -4 2 301 "40" +4 4 301 "40" 5 2 301 "200" -5 3 301 "50" -5 4 301 "21783" +5 6 301 "50" +5 9 301 "21783" diff --git a/test_simpleLiterals.tok b/test_simpleLiterals.tok index 51f07e1..7e38bb3 100644 --- a/test_simpleLiterals.tok +++ b/test_simpleLiterals.tok @@ -1,62 +1,63 @@ 1 1 304 ""this is a string"" -1 2 301 "721398" -1 3 303 "'g'" -1 5 604 "/" -1 5 101 "n" -1 7 700 "(* should print 3 tokens before this *)" +1 20 301 "721398" +1 27 303 "'g'" +1 32 604 "/" +1 33 101 "n" +1 36 700 "(* should print 3 tokens before this *)" 4 1 301 "12893" -4 3 101 "this" -4 4 101 "is" -4 5 101 "not" -4 6 101 "a" -4 7 101 "string" -4 8 700 "(*one valid token before this*)" +4 8 101 "this" +4 13 101 "is" +4 16 101 "not" +4 20 101 "a" +4 22 101 "string" +4 29 700 "(*one valid token before this*)" 5 1 700 "(* spacey comment here over multiple lines will it work? *)" -9 1 306 "false" -10 1 700 "(**)" -12 1 101 "nullfalse" -13 2 101 "nulltrue" -14 1 302 "null" -15 1 303 "'7'" -16 1 305 "true" -17 2 301 "189" -18 1 303 "'\t'" -19 1 303 "'"'" -20 1 303 "'/'" -21 1 303 "'\n'" -22 1 303 "'\''" -23 1 303 "'\t'" -25 1 303 "'n'" -27 2 101 "fdsf" -28 1 700 "(*/jnewjno2893u86^ Lots of random characters /n /t '") *)" -33 1 304 ""STRINGwithnotSPaces"" -34 1 303 "' '" -36 1 304 ""J"" -37 1 304 """" -38 1 304 "" "" -40 1 304 ""{SCHAR}"" -41 1 304 ""SCHAR"" -42 1 304 ""[SCHAR]"" -43 1 304 ""FINAL: I'd think this is a legal \"string\" that contains \n \t several escaped characters, isn't it?"" -44 2 101 "I" -44 3 101 "d" -44 4 101 "think" -44 5 101 "this" -44 6 101 "is" -44 7 101 "a" -44 8 101 "legal" -44 11 101 "string" -44 14 101 "that" -44 15 101 "contains" -44 16 101 "several" -44 19 101 "n" -44 21 101 "t" -44 22 101 "escaped" -44 23 101 "characters" -44 23 509 "," -44 24 101 "isn" -44 25 101 "t" -44 26 101 "it" -45 1 101 "nullLike" +7 18 306 "false" +11 1 306 "false" +12 1 700 "(**)" +14 1 101 "nullfalse" +15 2 101 "nulltrue" +16 1 302 "null" +17 1 303 "'7'" +18 1 305 "true" +19 2 301 "189" +20 1 303 "'\t'" +21 1 303 "'"'" +22 1 303 "'/'" +23 1 303 "'\n'" +24 1 303 "'\''" +25 1 303 "'\t'" +27 1 303 "'n'" +29 2 101 "fdsf" +30 1 700 "(*/jnewjno2893u86^ Lots of random characters /n /t '") *)" +35 1 304 ""STRINGwithnotSPaces"" +36 1 303 "' '" +38 1 304 ""J"" +39 1 304 """" +40 1 304 "" "" +42 1 304 ""{SCHAR}"" +43 1 304 ""SCHAR"" +44 1 304 ""[SCHAR]"" +45 1 304 ""FINAL: I'd think this is a legal \"string\" that contains \n \t several escaped characters, isn't it?"" +46 2 101 "I" +46 4 101 "d" +46 6 101 "think" +46 12 101 "this" +46 17 101 "is" +46 20 101 "a" +46 22 101 "legal" +46 30 101 "string" +46 39 101 "that" +46 44 101 "contains" +46 53 101 "several" +46 63 101 "n" +46 66 101 "t" +46 68 101 "escaped" +46 76 101 "characters" +46 86 509 "," +46 88 101 "isn" +46 92 101 "t" +46 94 101 "it" +47 1 101 "nullLike" diff --git a/tests/test_simpleLiterals.alpha b/tests/test_simpleLiterals.alpha index fd54099..4c5b0b2 100644 --- a/tests/test_simpleLiterals.alpha +++ b/tests/test_simpleLiterals.alpha @@ -4,7 +4,7 @@ 12893 "this is not a string (*one valid token before this*) (* spacey comment here over multiple lines -will it work? *) +will it work? *) false " ''' '\' From 292a8dbf8dbac9b634f9661c8a499799f169fe20 Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Thu, 13 Feb 2025 20:24:39 -0500 Subject: [PATCH 040/105] tested lexer with more files --- flex.h | 477 --------- flex.o | Bin 27880 -> 0 bytes lex.yy.c | 2043 ------------------------------------- lexicalStructure.lex | 2 +- runner | Bin 31632 -> 0 bytes runner.o | Bin 4616 -> 0 bytes test_comments.tok | 9 - test_generalTokenTest.tok | 61 -- test_keywords.tok | 29 - test_operators.tok | 22 - test_otherpunc.tok | 7 - test_simpleIntTest.tok | 8 - test_simpleLiterals.tok | 63 -- 13 files changed, 1 insertion(+), 2720 deletions(-) delete mode 100644 flex.h delete mode 100644 flex.o delete mode 100644 lex.yy.c delete mode 100755 runner delete mode 100644 runner.o delete mode 100644 test_comments.tok delete mode 100644 test_generalTokenTest.tok delete mode 100644 test_keywords.tok delete mode 100644 test_operators.tok delete mode 100644 test_otherpunc.tok delete mode 100644 test_simpleIntTest.tok delete mode 100644 test_simpleLiterals.tok diff --git a/flex.h b/flex.h deleted file mode 100644 index c528013..0000000 --- a/flex.h +++ /dev/null @@ -1,477 +0,0 @@ -#ifndef yyHEADER_H -#define yyHEADER_H 1 -#define yyIN_HEADER 1 - -#line 6 "flex.h" - -#line 8 "flex.h" - -#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 - -/* 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 - -#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; - -#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; - - }; -#endif /* !YY_STRUCT_YY_BUFFER_STATE */ - -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 ); - -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 * ); - -/* Begin user sect3 */ - -#define yywrap() (/*CONSTCOND*/1) -#define YY_SKIP_YYWRAP - -extern int yylineno; - -extern char *yytext; -#ifdef yytext_ptr -#undef yytext_ptr -#endif -#define yytext_ptr yytext - -#ifdef YY_HEADER_EXPORT_START_CONDITIONS -#define INITIAL 0 - -#endif - -#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 - -/* 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 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 - -#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 - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* 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 */ - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - -#undef YY_NEW_FILE -#undef YY_FLUSH_BUFFER -#undef yy_set_bol -#undef yy_new_buffer -#undef yy_set_interactive -#undef YY_DO_BEFORE_ACTION - -#ifdef YY_DECL_IS_OURS -#undef YY_DECL_IS_OURS -#undef YY_DECL -#endif - -#ifndef yy_create_buffer_ALREADY_DEFINED -#undef yy_create_buffer -#endif -#ifndef yy_delete_buffer_ALREADY_DEFINED -#undef yy_delete_buffer -#endif -#ifndef yy_scan_buffer_ALREADY_DEFINED -#undef yy_scan_buffer -#endif -#ifndef yy_scan_string_ALREADY_DEFINED -#undef yy_scan_string -#endif -#ifndef yy_scan_bytes_ALREADY_DEFINED -#undef yy_scan_bytes -#endif -#ifndef yy_init_buffer_ALREADY_DEFINED -#undef yy_init_buffer -#endif -#ifndef yy_flush_buffer_ALREADY_DEFINED -#undef yy_flush_buffer -#endif -#ifndef yy_load_buffer_state_ALREADY_DEFINED -#undef yy_load_buffer_state -#endif -#ifndef yy_switch_to_buffer_ALREADY_DEFINED -#undef yy_switch_to_buffer -#endif -#ifndef yypush_buffer_state_ALREADY_DEFINED -#undef yypush_buffer_state -#endif -#ifndef yypop_buffer_state_ALREADY_DEFINED -#undef yypop_buffer_state -#endif -#ifndef yyensure_buffer_stack_ALREADY_DEFINED -#undef yyensure_buffer_stack -#endif -#ifndef yylex_ALREADY_DEFINED -#undef yylex -#endif -#ifndef yyrestart_ALREADY_DEFINED -#undef yyrestart -#endif -#ifndef yylex_init_ALREADY_DEFINED -#undef yylex_init -#endif -#ifndef yylex_init_extra_ALREADY_DEFINED -#undef yylex_init_extra -#endif -#ifndef yylex_destroy_ALREADY_DEFINED -#undef yylex_destroy -#endif -#ifndef yyget_debug_ALREADY_DEFINED -#undef yyget_debug -#endif -#ifndef yyset_debug_ALREADY_DEFINED -#undef yyset_debug -#endif -#ifndef yyget_extra_ALREADY_DEFINED -#undef yyget_extra -#endif -#ifndef yyset_extra_ALREADY_DEFINED -#undef yyset_extra -#endif -#ifndef yyget_in_ALREADY_DEFINED -#undef yyget_in -#endif -#ifndef yyset_in_ALREADY_DEFINED -#undef yyset_in -#endif -#ifndef yyget_out_ALREADY_DEFINED -#undef yyget_out -#endif -#ifndef yyset_out_ALREADY_DEFINED -#undef yyset_out -#endif -#ifndef yyget_leng_ALREADY_DEFINED -#undef yyget_leng -#endif -#ifndef yyget_text_ALREADY_DEFINED -#undef yyget_text -#endif -#ifndef yyget_lineno_ALREADY_DEFINED -#undef yyget_lineno -#endif -#ifndef yyset_lineno_ALREADY_DEFINED -#undef yyset_lineno -#endif -#ifndef yyget_column_ALREADY_DEFINED -#undef yyget_column -#endif -#ifndef yyset_column_ALREADY_DEFINED -#undef yyset_column -#endif -#ifndef yywrap_ALREADY_DEFINED -#undef yywrap -#endif -#ifndef yyget_lval_ALREADY_DEFINED -#undef yyget_lval -#endif -#ifndef yyset_lval_ALREADY_DEFINED -#undef yyset_lval -#endif -#ifndef yyget_lloc_ALREADY_DEFINED -#undef yyget_lloc -#endif -#ifndef yyset_lloc_ALREADY_DEFINED -#undef yyset_lloc -#endif -#ifndef yyalloc_ALREADY_DEFINED -#undef yyalloc -#endif -#ifndef yyrealloc_ALREADY_DEFINED -#undef yyrealloc -#endif -#ifndef yyfree_ALREADY_DEFINED -#undef yyfree -#endif -#ifndef yytext_ALREADY_DEFINED -#undef yytext -#endif -#ifndef yyleng_ALREADY_DEFINED -#undef yyleng -#endif -#ifndef yyin_ALREADY_DEFINED -#undef yyin -#endif -#ifndef yyout_ALREADY_DEFINED -#undef yyout -#endif -#ifndef yy_flex_debug_ALREADY_DEFINED -#undef yy_flex_debug -#endif -#ifndef yylineno_ALREADY_DEFINED -#undef yylineno -#endif -#ifndef yytables_fload_ALREADY_DEFINED -#undef yytables_fload -#endif -#ifndef yytables_destroy_ALREADY_DEFINED -#undef yytables_destroy -#endif -#ifndef yyTABLES_NAME_ALREADY_DEFINED -#undef yyTABLES_NAME -#endif - -#line 76 "lexicalStructure.lex" - - -#line 476 "flex.h" -#undef yyIN_HEADER -#endif /* yyHEADER_H */ diff --git a/flex.o b/flex.o deleted file mode 100644 index c0c6827f98437382a2536fac1e48819a8616fb92..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 27880 zcmd6v4|tT-mGJK*0U{y^iY7?Vk$;AN5fCj1(kU`JRjTn%T-{_wPx3&!|8vOIruxtI?PrfZG?UyukOF!r~RV3dz_n!04 znZvwbpJ)5*UY?ovzQ23!x#ymH?tSn3W?nXiS6o{V2pCQQv(#kIm>N^rlFf%~He^c7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BKVAwwI z3n6RMM>E_J`zI61V&da 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 42 -#define YY_END_OF_BUFFER 43 -/* 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[131] = - { 0, - 0, 0, 43, 41, 40, 24, 41, 20, 25, 41, - 41, 18, 16, 30, 17, 27, 19, 32, 29, 28, - 21, 22, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 39, 26, 0, 34, 0, 0, 0, 0, - 31, 32, 23, 39, 39, 39, 13, 39, 39, 39, - 39, 39, 6, 39, 39, 39, 39, 39, 39, 39, - 33, 0, 0, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 39, 39, 39, 39, 39, 39, 39, 35, - 0, 39, 39, 39, 8, 39, 39, 39, 39, 38, - 39, 39, 39, 7, 36, 9, 39, 39, 39, 39, - - 39, 37, 39, 39, 39, 39, 39, 5, 39, 39, - 39, 39, 39, 39, 39, 39, 11, 3, 2, 39, - 39, 39, 1, 14, 15, 39, 12, 10, 4, 0 - } ; - -static const YY_CHAR yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 4, 5, 1, 1, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 18, 19, 20, - 21, 22, 1, 1, 23, 24, 23, 23, 23, 23, - 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, - 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, - 1, 25, 1, 1, 23, 1, 26, 23, 27, 28, - - 29, 30, 31, 32, 33, 23, 23, 34, 23, 35, - 36, 37, 23, 38, 39, 40, 41, 42, 43, 44, - 45, 23, 1, 46, 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, 1 - } ; - -static const YY_CHAR yy_meta[47] = - { 0, - 1, 2, 3, 1, 1, 1, 1, 2, 1, 1, - 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, - 1, 1, 4, 4, 1, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 1 - } ; - -static const flex_int16_t yy_base[135] = - { 0, - 0, 0, 160, 161, 161, 161, 42, 161, 161, 134, - 147, 161, 161, 161, 135, 161, 161, 139, 134, 161, - 161, 161, 0, 118, 20, 121, 16, 23, 21, 111, - 122, 20, 118, 161, 48, 161, 49, 141, 47, 137, - 161, 130, 161, 0, 110, 117, 0, 118, 104, 102, - 107, 105, 0, 99, 104, 23, 108, 95, 98, 101, - 161, 122, 58, 98, 93, 92, 100, 99, 88, 99, - 96, 90, 94, 93, 80, 85, 90, 89, 83, 161, - 60, 87, 86, 88, 0, 75, 83, 71, 79, 0, - 83, 70, 69, 0, 0, 0, 77, 79, 65, 76, - - 67, 0, 63, 66, 53, 46, 51, 0, 50, 44, - 41, 54, 43, 40, 48, 47, 0, 0, 0, 46, - 40, 37, 0, 0, 0, 28, 0, 0, 0, 161, - 89, 93, 57, 97 - } ; - -static const flex_int16_t yy_def[135] = - { 0, - 130, 1, 130, 130, 130, 130, 131, 130, 130, 132, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 130, 131, 130, 130, 130, 130, 134, - 130, 130, 130, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 130, 134, 134, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 130, - 134, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 0, - 130, 130, 130, 130 - } ; - -static const flex_int16_t yy_nxt[208] = - { 0, - 4, 4, 5, 6, 7, 8, 9, 10, 11, 4, - 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 4, 23, 24, 4, 25, 26, 23, 27, 28, - 23, 23, 29, 23, 30, 23, 23, 31, 23, 32, - 23, 23, 33, 23, 23, 34, 36, 46, 51, 49, - 53, 57, 36, 35, 38, 54, 73, 58, 47, 50, - 44, 74, 75, 52, 59, 129, 37, 80, 81, 130, - 81, 128, 37, 127, 126, 125, 124, 123, 122, 121, - 120, 38, 119, 35, 118, 117, 38, 116, 35, 35, - 35, 115, 35, 38, 114, 113, 38, 62, 62, 62, - - 62, 112, 111, 110, 109, 108, 107, 106, 105, 104, - 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, - 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, - 83, 82, 63, 79, 78, 77, 76, 72, 71, 70, - 69, 68, 67, 66, 65, 64, 42, 63, 61, 60, - 56, 55, 48, 45, 43, 42, 41, 40, 39, 130, - 3, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - - 130, 130, 130, 130, 130, 130, 130 - } ; - -static const flex_int16_t yy_chk[208] = - { 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, 1, 7, 25, 28, 27, - 29, 32, 35, 37, 39, 29, 56, 32, 25, 27, - 133, 56, 56, 28, 32, 126, 7, 63, 63, 81, - 81, 122, 35, 121, 120, 116, 115, 114, 113, 112, - 111, 39, 110, 37, 109, 107, 39, 106, 37, 131, - 131, 105, 131, 132, 104, 103, 132, 134, 134, 134, - - 134, 101, 100, 99, 98, 97, 93, 92, 91, 89, - 88, 87, 86, 84, 83, 82, 79, 78, 77, 76, - 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, - 65, 64, 62, 60, 59, 58, 57, 55, 54, 52, - 51, 50, 49, 48, 46, 45, 42, 40, 38, 33, - 31, 30, 26, 24, 19, 18, 15, 11, 10, 3, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - - 130, 130, 130, 130, 130, 130, 130 - } ; - -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 "lexicalStructure.lex" -/* Lexical Analysis with Flex (1.6.0) We used some of the code from this manual */ -/* so we placed the citation here. */ -/* definitions */ -#line 8 "lexicalStructure.lex" - #include - #include "typedefs.h" - int line_number = 1, column_number = 1; - #ifndef DEBUG - #define DEBUG 0 - #endif -#line 544 "lex.yy.c" -#line 21 "lexicalStructure.lex" - /* char can be a newline, tab, an escaped quote, or anything but a single quote, an actual line break, an actual tab, or a backslash by itself (to prevent confusion from escaped quote */ - /* similar to above, a string Char (SCHAR) is the same as a CHAR except we cannot have double quotes instead of single quotes. Double quotes need to be escaped in Flex unlike single quotes based on documentation */ -#line 548 "lex.yy.c" - -#define INITIAL 0 - -#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 - - static void yyunput ( int c, char *buf_ptr ); - -#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 \ - 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 25 "lexicalStructure.lex" - - -#line 768 "lex.yy.c" - - 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_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 >= 131 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 161 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - 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 27 "lexicalStructure.lex" -{if(DEBUG) {printf( "T_INTEGER: %s (%d)\n", yytext, T_INTEGER);} else {return T_INTEGER;}} - YY_BREAK -case 2: -YY_RULE_SETUP -#line 28 "lexicalStructure.lex" -{if(DEBUG) {printf( "T_ADDRESS: %s (%d)\n", yytext, T_ADDRESS);} else {return T_ADDRESS;}} - YY_BREAK -case 3: -YY_RULE_SETUP -#line 29 "lexicalStructure.lex" -{if(DEBUG) {printf( "T_BOOLEAN: %s (%d)\n", yytext, T_BOOLEAN);} else {return T_BOOLEAN;}} - YY_BREAK -case 4: -YY_RULE_SETUP -#line 30 "lexicalStructure.lex" -{if(DEBUG) {printf( "T_CHARACTER: %s (%d)\n", yytext, T_CHARACTER);} else {return T_CHARACTER;}} - YY_BREAK -case 5: -YY_RULE_SETUP -#line 32 "lexicalStructure.lex" -{if(DEBUG) {printf( "WHILE: %s (%d)\n", yytext, WHILE);} else {return WHILE;}} - YY_BREAK -case 6: -YY_RULE_SETUP -#line 33 "lexicalStructure.lex" -{if(DEBUG) {printf( "IF: %s (%d)\n", yytext, IF);} else {return IF;}} - YY_BREAK -case 7: -YY_RULE_SETUP -#line 34 "lexicalStructure.lex" -{if(DEBUG) {printf( "THEN: %s (%d)\n", yytext, THEN);} else {return THEN;}} - YY_BREAK -case 8: -YY_RULE_SETUP -#line 35 "lexicalStructure.lex" -{if(DEBUG) {printf( "ELSE: %s (%d)\n", yytext, ELSE);} else {return ELSE;}} - YY_BREAK -case 9: -YY_RULE_SETUP -#line 36 "lexicalStructure.lex" -{if(DEBUG) {printf( "TYPE: %s (%d)\n", yytext, TYPE);} else {return TYPE;}} - YY_BREAK -case 10: -YY_RULE_SETUP -#line 37 "lexicalStructure.lex" -{if(DEBUG) {printf( "FUNCTION: %s (%d)\n", yytext, FUNCTION);} else {return FUNCTION;}} - YY_BREAK -case 11: -YY_RULE_SETUP -#line 38 "lexicalStructure.lex" -{if(DEBUG) {printf( "RETURN: %s (%d)\n", yytext, RETURN);} else {return RETURN;}} - YY_BREAK -case 12: -YY_RULE_SETUP -#line 39 "lexicalStructure.lex" -{if(DEBUG) {printf( "EXTERNAL: %s (%d)\n", yytext, EXTERNAL);} else {return EXTERNAL;}} - YY_BREAK -case 13: -YY_RULE_SETUP -#line 40 "lexicalStructure.lex" -{if(DEBUG) {printf( "AS: %s (%d)\n", yytext, AS);} else {return AS;}} - YY_BREAK -case 14: -YY_RULE_SETUP -#line 42 "lexicalStructure.lex" -{if(DEBUG) {printf( "RELEASE: %s (%d)\n", yytext, RELEASE);} else {return RELEASE;}} - YY_BREAK -case 15: -YY_RULE_SETUP -#line 43 "lexicalStructure.lex" -{if(DEBUG) {printf( "RESERVE: %s (%d)\n", yytext, RESERVE);} else {return RESERVE;}} - YY_BREAK -case 16: -YY_RULE_SETUP -#line 45 "lexicalStructure.lex" -{if(DEBUG) {printf( "ADD: %s (%d)\n", yytext, ADD);} else {return ADD;}} - YY_BREAK -case 17: -YY_RULE_SETUP -#line 46 "lexicalStructure.lex" -{if(DEBUG) {printf( "SUB_OR_NEG: %s (%d)\n", yytext, SUB_OR_NEG);} else {return SUB_OR_NEG;}} - YY_BREAK -case 18: -YY_RULE_SETUP -#line 47 "lexicalStructure.lex" -{if(DEBUG) {printf( "MUL: %s (%d)\n", yytext, MUL);} else {return MUL;}} - YY_BREAK -case 19: -YY_RULE_SETUP -#line 48 "lexicalStructure.lex" -{if(DEBUG) {printf( "DIV: %s (%d)\n", yytext, DIV);} else {return DIV;}} - YY_BREAK -case 20: -YY_RULE_SETUP -#line 49 "lexicalStructure.lex" -{if(DEBUG) {printf( "REM: %s (%d)\n", yytext, REM);} else {return REM;}} - YY_BREAK -case 21: -YY_RULE_SETUP -#line 50 "lexicalStructure.lex" -{if(DEBUG) {printf( "LESS_THAN: %s (%d)\n", yytext, LESS_THAN);} else {return LESS_THAN;}} - YY_BREAK -case 22: -YY_RULE_SETUP -#line 51 "lexicalStructure.lex" -{if(DEBUG) {printf( "EQUAL_TO: %s (%d)\n", yytext, EQUAL_TO);} else {return EQUAL_TO;}} - YY_BREAK -case 23: -YY_RULE_SETUP -#line 52 "lexicalStructure.lex" -{if(DEBUG) {printf( "ASSIGN: %s (%d)\n", yytext, ASSIGN);} else {return ASSIGN;}} - YY_BREAK -case 24: -YY_RULE_SETUP -#line 53 "lexicalStructure.lex" -{if(DEBUG) {printf( "NOT: %s (%d)\n", yytext, NOT);} else {return NOT;}} - YY_BREAK -case 25: -YY_RULE_SETUP -#line 54 "lexicalStructure.lex" -{if(DEBUG) {printf( "AND: %s (%d)\n", yytext, AND);} else {return AND;}} - YY_BREAK -case 26: -YY_RULE_SETUP -#line 55 "lexicalStructure.lex" -{if(DEBUG) {printf( "OR: %s (%d)\n", yytext, OR);} else {return OR;}} - YY_BREAK -case 27: -YY_RULE_SETUP -#line 56 "lexicalStructure.lex" -{if(DEBUG) {printf( "DOT: %s (%d)\n", yytext, DOT);} else {return DOT;}} - YY_BREAK -case 28: -YY_RULE_SETUP -#line 58 "lexicalStructure.lex" -{if(DEBUG) {printf( "SEMI_COLON: %s (%d)\n", yytext, SEMI_COLON);} else {return SEMI_COLON;}} - YY_BREAK -case 29: -YY_RULE_SETUP -#line 59 "lexicalStructure.lex" -{if(DEBUG) {printf( "COLON: %s (%d)\n", yytext, COLON);} else {return COLON;}} - YY_BREAK -case 30: -YY_RULE_SETUP -#line 60 "lexicalStructure.lex" -{if(DEBUG) {printf( "COMMA: %s (%d)\n", yytext, COMMA);} else {return COMMA;}} - YY_BREAK -case 31: -YY_RULE_SETUP -#line 61 "lexicalStructure.lex" -{if(DEBUG) {printf( "ARROW: %s (%d)\n", yytext, ARROW);} else {return ARROW;}} - YY_BREAK -case 32: -YY_RULE_SETUP -#line 63 "lexicalStructure.lex" -{if(DEBUG) {printf( "C_INTEGER: %s (%d)\n", yytext, C_INTEGER);} else {return C_INTEGER;}} - YY_BREAK -case 33: -YY_RULE_SETUP -#line 64 "lexicalStructure.lex" -{if(DEBUG) {printf( "C_CHARACTER: %s (%d)\n", yytext, C_CHARACTER);} else {return C_CHARACTER;}} - YY_BREAK -case 34: -YY_RULE_SETUP -#line 65 "lexicalStructure.lex" -{if(DEBUG) {printf( "C_STRING: %s (%d)\n", yytext, C_STRING);} else {return C_STRING;}} - YY_BREAK -case 35: -/* rule 35 can match eol */ -YY_RULE_SETUP -#line 66 "lexicalStructure.lex" -{if(DEBUG) {printf( "COMMENT: %s (%d)\n", yytext, COMMENT);} else {return COMMENT;}} - YY_BREAK -case 36: -YY_RULE_SETUP -#line 67 "lexicalStructure.lex" -{if(DEBUG) {printf( "C_TRUE: %s (%d)\n", yytext, C_TRUE);} else {return C_TRUE;}} - YY_BREAK -case 37: -YY_RULE_SETUP -#line 68 "lexicalStructure.lex" -{if(DEBUG) {printf( "C_FALSE: %s (%d)\n", yytext, C_FALSE);} else {return C_FALSE;}} - YY_BREAK -case 38: -YY_RULE_SETUP -#line 69 "lexicalStructure.lex" -{if(DEBUG) {printf( "C_NULL: %s (%d)\n", yytext, C_NULL);} else {return C_NULL;}} - YY_BREAK -case 39: -YY_RULE_SETUP -#line 71 "lexicalStructure.lex" -{if(DEBUG) {printf( "ID: %s (%d)\n", yytext, ID);} else {return ID;}} - YY_BREAK -case 40: -/* rule 40 can match eol */ -YY_RULE_SETUP -#line 73 "lexicalStructure.lex" -{line_number++; column_number = 1;} - YY_BREAK -case 41: -YY_RULE_SETUP -#line 74 "lexicalStructure.lex" -{column_number++;} - YY_BREAK -case 42: -YY_RULE_SETUP -#line 76 "lexicalStructure.lex" -ECHO; - YY_BREAK -#line 1037 "lex.yy.c" -case YY_STATE_EOF(INITIAL): - yyterminate(); - - 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_c_buf_p); - 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); - - 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 >= 131 ) - 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 >= 131 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - yy_is_jam = (yy_current_state == 130); - - return yy_is_jam ? 0 : yy_current_state; -} - -#ifndef YY_NO_UNPUT - - static void yyunput (int c, char * yy_bp ) -{ - char *yy_cp; - - yy_cp = (yy_c_buf_p); - - /* undo effects of setting up yytext */ - *yy_cp = (yy_hold_char); - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - int number_to_move = (yy_n_chars) + 2; - char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; -} - -#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); - - 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 76 "lexicalStructure.lex" - - diff --git a/lexicalStructure.lex b/lexicalStructure.lex index 86799c2..cf5e50f 100644 --- a/lexicalStructure.lex +++ b/lexicalStructure.lex @@ -16,7 +16,7 @@ COM ([^*]|\*+[^)*])* ID [A-Za-z_][0-9A-Za-z_]* DIGIT [0-9] -CHAR \\n|\\t|\\'|[^'\n\t\\] +CHAR \\n|\\t|\\'|[^'\n\t\\]|\\\\ /* char can be a newline, tab, an escaped quote, or anything but a single quote, an actual line break, an actual tab, or a backslash by itself (to prevent confusion from escaped quote */ SCHAR \\n|\\t|\\\"|[^\"\n\\] /* similar to above, a string Char (SCHAR) is the same as a CHAR except we cannot have double quotes instead of single quotes. Double quotes need to be escaped in Flex unlike single quotes based on documentation */ diff --git a/runner b/runner deleted file mode 100755 index 067c50734e81c7aca4d80ecc4986f74a57d26c20..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 31632 zcmeHwdwf*Yz3-YNTf!qGC}YA)1_b1l5D*kZG&}|d0Szz33JjBELLx~fPG*2uf=B?F zvx(vxPiqhKw%S%b*DAHNq6QxfD%DV_qEd~Db;i&df!6q9?)SGId-mRDyuJ5x`Z?#1 zEZFn=t>0^{^;_??clN%;J%4tZ!@*QYXIC(awVo>|MUv4{ClP=mHkoDNcQCtvor8D= zrwM+M0N{#nEX@itB|ROG^zsPl1P&Brrl86pLDEYVR`nDd1zC=Wlb%MXjN9RX5kgKu z#W&I`5`3dzGQPKupetzBBj4n$5d6GqE6kAP-YuchBX^PBNU1kc>M7VR9igD|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H%cYFSQ(5JI^rLWHC6>O0V$|Lz%>8o?{O3=tnSw2f z=l$`Fs44&Iyj($bZiHnb4=No6H-buM@hYy);|(bF?D>~u{EZBqenu5|(r00N` z%dgI76wFeB659RulGIo2hZRXd3Deb$DM@xosK6h9Q2I(=oeL_s+~$9K`tREGSIrle z65WScTgLgm`hKikUd0vs9J<*ieRV&-^^J3&RYJu+{wqCY zuoskxrqWmY>w!{#mlBlFWsCQb=@;7QN?#tY8(hjO1v6A_M{vZiXO)1vW&0b1C>_

|BJckN97$)J$vZ&R>E+5Z8R#QfR- diff --git a/runner.o b/runner.o deleted file mode 100644 index 6778a689da82ad0f00fa83c9b9985ff9dd0930ef..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4616 zcmbtYUx-vy7(cVCu5GKcn&!Wdn`D^mPCL3uipi+lykY+oHjIL8cIJ*VI&){Zb8ovF zj#9&hw@K(BB8YSmfZEgg8?3r`U z@BF?$=R5x{drE)u@vcZjkVM2D(e4o{#OdYjc0x82V!2o*evNLtHDY+zjq2QxSGj6< zZlhYc8gX{PZ}+KT`0a9EFlu_ksMePnHDP$uO;q>3VW4+~;HkPZXw()X!|=ZTauDhZ z7>;p9VZQeH+aNbYmk`py_GvjPwV10jt0mI5Zg`S+V;oExwUI_mhk&oBhzw6}K};>f zyBP2WL9GuPae27+{cE^~q*rjzAufI1p90JXB9qzb$82?=`cwD}h<=``tuA-is6B>r ztu2$ka^5v}4lK<-;r+hXn>Wrpf+LXT^H|Fzc(pS375H>ePQSQb6ulTSBO+g z^urElff!jKaif^^-qG~;X!J_YE6rnQ#^h#u?Q#Kn(a|h z-jN`fVx{G|H*5OMYSXtabvy3)9(l@U7ppwO+(2^H%gKB$t>vte>uBRSC#%H=v_0Dg zw4$w9MN5k%^QCN3OWH@ZUSW%LE|Vc8k;%Wyv2G|RtNcntUO6lx6aA45eLYLxf&+?27z@g4cpCNP{jYcJU$&%svI{73Y_}X0 z;(p+_$Ja(^{6#f>0Bh1eiKF3yrWT2xZ+BvJcf65tF7jyIq0$Sz6<~>kT6lf0WOn4- z0J{eY<|!!a0YLs)l`uIMz_vi?#K*1Q3EvTdV-7p<_X3W7DL$EFz>E<7Ga>kMA$U3j zFNNR}A^52fd@2NgGX#G-1b;6C7q)9zrX5QOI5nb>%vqxB*m=_ux$>wydZU?K-UKjh z+P27y+d0P+nPLeTlas&(8XhZ9N)<`~Ip%~TQpLPmutqJnFlO2!pR-JAXG(U?axy>! zA4g?1Au_3av5Y=!JC(IXDw)q0Q`ogqrAY`JWZ19dPFw=*Kk>x|ImqxHhU0pn;E}^~ zLi}S0f*_7tk#HM95ZvE)K_UD!f*{Dpv6k=l_6G=pke#i5SA48$L7nHUJxM2=lNO3aLmt6B!SSmK|4G@ zI|6*l`(A}3pXcEqoqkYQH8w|(0i*UT7Q7{itD1^Vm zaJ*Lt|AgTf=Mg97oP_skr_`91Snz&@S3)#wZaW5kbOivLlDbNkOS{9eW{F?z(FotrO+2MK62;lUtz7)Xeofon4WWh;}LG9Rnou!s-=94k` zUc}N#Cn;iM<+6y`MZc3O77C{2h?rG$%ou!g4VIl`3O?Xu|ET50N;W)0wlfJjXvxfu zX6$6aRFV9@N&|H~T9{id3Dx;g<&DPFF{G~804-em!~)_sj^JerQc|BDVNQ2IeL!9MO|w8_^Vx?)HX@jHeK#ZMT%8>l}-fT}-I z`m`@;nBu2;9}G~NI9Oi}2C4>w+{1w5ISs}?qx3bUM^!NXV=#a=gZi!iIDg!QNKHWD z@*N&B5W}zJw*bDU#Z)c+f;O|Db` diff --git a/test_comments.tok b/test_comments.tok deleted file mode 100644 index 0486ed9..0000000 --- a/test_comments.tok +++ /dev/null @@ -1,9 +0,0 @@ -1 1 700 "(* hello *)" -2 1 700 "(* hello *)" -3 1 700 "(* I'd think this is a legal "string" that contains several \n \t -escaped characters, isn't it? *)" -5 1 700 "(* \ *)" -6 1 700 "(* *)" -7 1 700 "(*{COMMENT}+ *)" -8 1 700 "(* * *)" -9 1 700 "(* (hello) *)" diff --git a/test_generalTokenTest.tok b/test_generalTokenTest.tok deleted file mode 100644 index 08c907c..0000000 --- a/test_generalTokenTest.tok +++ /dev/null @@ -1,61 +0,0 @@ -1 1 101 "This" -1 6 101 "is" -1 9 101 "a" -1 11 101 "test" -2 1 301 "9" -2 2 101 "combined" -2 11 301 "7" -2 12 101 "okens" -3 1 301 "12345" -4 1 301 "893247892" -5 1 101 "combined" -5 10 101 "DueToUnknownChar" -5 27 101 "_validtoken" -5 39 101 "__validtoken1" -5 53 101 "_valid_token2" -5 67 101 "validToken3_" -6 1 305 "true" -6 6 306 "false" -7 1 302 "null" -7 6 401 "while" -7 12 609 "!" -7 13 101 "wrong" -7 19 402 "if" -7 22 101 "when" -8 1 404 "else" -8 6 405 "type" -8 11 406 "function" -9 1 407 "return" -9 9 408 "external" -9 25 409 "as" -10 1 101 "string" -10 8 101 "_NOte_that_was_not_reserved" -11 7 508 ":" -11 8 507 ";" -11 9 509 "," -11 10 510 "->" -12 1 601 "+" -12 2 602 "-" -12 3 603 "*" -12 4 604 "/" -12 5 605 "%" -13 1 606 "<" -13 2 607 "=" -14 1 608 ":=" -15 2 101 "This" -15 7 101 "is" -15 10 101 "not" -15 14 101 "a" -15 16 101 "valid" -16 1 101 "String" -17 1 304 ""This is a valid String"" -18 1 609 "!" -18 2 611 "|" -19 1 612 "." -19 2 612 "." -20 1 700 "(* this is a comment *)" -21 2 603 "*" -21 3 101 "Not" -21 7 101 "a" -21 9 101 "comment" -22 3 610 "&" diff --git a/test_keywords.tok b/test_keywords.tok deleted file mode 100644 index 9e70321..0000000 --- a/test_keywords.tok +++ /dev/null @@ -1,29 +0,0 @@ -1 1 401 "while" -2 1 101 "While" -3 1 101 "whiLe" -4 1 402 "if" -5 1 101 "IF" -6 1 101 "If" -7 1 101 "iF" -8 1 403 "then" -9 1 101 "Then" -10 1 101 "theN" -11 1 404 "else" -12 1 101 "eLse" -13 1 101 "elSe" -14 1 101 "Else" -15 1 405 "type" -16 1 101 "Type" -17 1 101 "tyPe" -18 1 406 "function" -19 1 101 "Function" -20 1 101 "functioN" -21 1 407 "return" -22 1 101 "Return" -23 1 101 "returN" -24 1 408 "external" -25 1 101 "External" -26 1 101 "exteRnal" -27 1 409 "as" -28 1 101 "As" -29 1 101 "aS" diff --git a/test_operators.tok b/test_operators.tok deleted file mode 100644 index dd3eaab..0000000 --- a/test_operators.tok +++ /dev/null @@ -1,22 +0,0 @@ -1 1 601 "+" -2 1 602 "-" -3 1 603 "*" -4 1 604 "/" -6 1 605 "%" -7 1 606 "<" -9 1 607 "=" -10 1 608 ":=" -11 1 607 "=" -11 2 508 ":" -12 1 508 ":" -13 1 607 "=" -14 1 609 "!" -15 1 610 "&" -16 1 611 "|" -17 1 612 "." -18 1 101 "relEASE" -19 1 614 "release" -20 1 101 "RELEASE" -21 1 613 "reserve" -22 1 101 "RESERVE" -23 1 101 "reSERVe" diff --git a/test_otherpunc.tok b/test_otherpunc.tok deleted file mode 100644 index 7500378..0000000 --- a/test_otherpunc.tok +++ /dev/null @@ -1,7 +0,0 @@ -1 1 507 ";" -2 1 508 ":" -3 1 509 "," -4 1 510 "->" -5 1 510 "->" -6 1 602 "-" -6 2 510 "->" diff --git a/test_simpleIntTest.tok b/test_simpleIntTest.tok deleted file mode 100644 index 0bcbefb..0000000 --- a/test_simpleIntTest.tok +++ /dev/null @@ -1,8 +0,0 @@ -1 1 301 "45" -2 1 301 "123" -3 1 301 "8392" -4 1 301 "40" -4 4 301 "40" -5 2 301 "200" -5 6 301 "50" -5 9 301 "21783" diff --git a/test_simpleLiterals.tok b/test_simpleLiterals.tok deleted file mode 100644 index 7e38bb3..0000000 --- a/test_simpleLiterals.tok +++ /dev/null @@ -1,63 +0,0 @@ -1 1 304 ""this is a string"" -1 20 301 "721398" -1 27 303 "'g'" -1 32 604 "/" -1 33 101 "n" -1 36 700 "(* should print 3 tokens before this *)" -4 1 301 "12893" -4 8 101 "this" -4 13 101 "is" -4 16 101 "not" -4 20 101 "a" -4 22 101 "string" -4 29 700 "(*one valid token before this*)" -5 1 700 "(* spacey comment here -over multiple lines -will it work? *)" -7 18 306 "false" -11 1 306 "false" -12 1 700 "(**)" -14 1 101 "nullfalse" -15 2 101 "nulltrue" -16 1 302 "null" -17 1 303 "'7'" -18 1 305 "true" -19 2 301 "189" -20 1 303 "'\t'" -21 1 303 "'"'" -22 1 303 "'/'" -23 1 303 "'\n'" -24 1 303 "'\''" -25 1 303 "'\t'" -27 1 303 "'n'" -29 2 101 "fdsf" -30 1 700 "(*/jnewjno2893u86^ Lots of random characters /n /t '") *)" -35 1 304 ""STRINGwithnotSPaces"" -36 1 303 "' '" -38 1 304 ""J"" -39 1 304 """" -40 1 304 "" "" -42 1 304 ""{SCHAR}"" -43 1 304 ""SCHAR"" -44 1 304 ""[SCHAR]"" -45 1 304 ""FINAL: I'd think this is a legal \"string\" that contains \n \t several escaped characters, isn't it?"" -46 2 101 "I" -46 4 101 "d" -46 6 101 "think" -46 12 101 "this" -46 17 101 "is" -46 20 101 "a" -46 22 101 "legal" -46 30 101 "string" -46 39 101 "that" -46 44 101 "contains" -46 53 101 "several" -46 63 101 "n" -46 66 101 "t" -46 68 101 "escaped" -46 76 101 "characters" -46 86 509 "," -46 88 101 "isn" -46 92 101 "t" -46 94 101 "it" -47 1 101 "nullLike" From 910760661e76a10c800dc03177ed0e80c43ddf3d Mon Sep 17 00:00:00 2001 From: Meyer Simon Date: Thu, 13 Feb 2025 21:11:03 -0500 Subject: [PATCH 041/105] Lexer is ready just added some test files t#09 --- Makefile | 4 ++++ runner.c | 13 +++++++------ tests/test_real_alpha_2.alpha | 26 ++++++++++++++++++++++++++ tests/test_real_alpha_file.alpha | 28 ++++++++++++++++++++++++++++ 4 files changed, 65 insertions(+), 6 deletions(-) create mode 100644 tests/test_real_alpha_2.alpha create mode 100644 tests/test_real_alpha_file.alpha diff --git a/Makefile b/Makefile index 81376c3..8164ae1 100644 --- a/Makefile +++ b/Makefile @@ -28,6 +28,8 @@ test: ./$(EXE) ./tests/test_otherpunc.alpha ./$(EXE) ./tests/test_simpleIntTest.alpha ./$(EXE) ./tests/test_simpleLiterals.alpha + ./$(EXE) ./tests/test_real_alpha_file.alpha + ./$(EXE) ./tests/test_real_alpha_2.alpha ./$(EXE) -tok ./tests/test_comments.alpha ./$(EXE) -tok ./tests/test_generalTokenTest.alpha ./$(EXE) -tok ./tests/test_keywords.alpha @@ -35,6 +37,8 @@ test: ./$(EXE) -tok ./tests/test_otherpunc.alpha ./$(EXE) -tok ./tests/test_simpleIntTest.alpha ./$(EXE) -tok ./tests/test_simpleLiterals.alpha + ./$(EXE) -tok ./tests/test_real_alpha_file.alpha + ./$(EXE) -tok ./tests/test_real_alpha_2.alpha clean: rm -f *.o rm -f lex.yy.c diff --git a/runner.c b/runner.c index 30f7551..9a8e41c 100644 --- a/runner.c +++ b/runner.c @@ -7,7 +7,7 @@ int main(int argc, char *argv[]) { FILE *output; if (argc == 1 || argc > 3 || (argc == 2 && is_alpha_file(argv[1], strlen(argv[1])) != 0)) { - fprintf(stderr, "invalid input with 1, >3, or non .alpha arg \n"); + fprintf(stderr, "invalid input with 1, >3, or non .alpha arg \n"); return -1; //no alpha file or too many args } else if (argc == 2) { arg = NO_ARG; //no argument but valid input @@ -15,7 +15,7 @@ int main(int argc, char *argv[]) { } else { check_input = is_tok(argc, argv); if (strcmp(CHECK_OTHER, check_input) == 0 || strcmp(INVALID_ARG, check_input) == 0) { - fprintf(stderr, "check_other or invalid_arg \n"); + fprintf(stderr, "check_other or invalid_arg \n"); return -1; //invalid argument (need to update as we add more valid arguments) } output = fopen(check_input, "w"); @@ -65,16 +65,17 @@ char *is_tok(int argc, char *argv[]) { // Calculate lengths int basename_len = strlen(basename); - char* FILE_tok = calloc(basename_len - ALPHA_OFFSET + TOK_LEN + 1, sizeof(char)); - + char* FILE_tok = calloc(basename_len - ALPHA_OFFSET + TOK_LEN + 2, sizeof(char)); + // Copy filename and add .tok extension strncpy(FILE_tok, basename, basename_len - ALPHA_OFFSET); + //fprintf(stderr, "hello"); strcat(FILE_tok, ".tok"); - + return FILE_tok; } return CHECK_OTHER; -} +} int is_alpha_file(char *file, int file_len) { if (strcmp(".alpha", file + sizeof(char) * (file_len - ALPHA_OFFSET)) != 0) { diff --git a/tests/test_real_alpha_2.alpha b/tests/test_real_alpha_2.alpha new file mode 100644 index 0000000..0beb2af --- /dev/null +++ b/tests/test_real_alpha_2.alpha @@ -0,0 +1,26 @@ +(* Type definitions *) +type string: 1 -> character +type int2int: integer -> integer +type string2int: string -> integer +(* Function prototypes +They use the above type definitions +*) +function square : int2int +function entry : string2int +(* Function definition +Functions must be declared before they are defined +*) +square(x) := { +return x * x; +} +(* Function definition +entry is the first function called +*) +entry(arg) := { +input = 7; +expected = 49; +actual := square(input); +rseult := expected = actual; +return 0; +[ integer: input; integer: expected; integer: actual; boolean: result; string: input ] +} diff --git a/tests/test_real_alpha_file.alpha b/tests/test_real_alpha_file.alpha new file mode 100644 index 0000000..51d5d08 --- /dev/null +++ b/tests/test_real_alpha_file.alpha @@ -0,0 +1,28 @@ +type rec: [integer: x; integer: y] +type T1: integer -> integer +type T2: rec -> integer +function foo : T1 +function bar1 : T2 +function bar2 : T2 +foo(x) := { + return x * x; + } +bar1(a) := { + return a.x * a.y; + } +bar2 as (r,s) := { + return r * s; + } +entry(arg) := { + [ integer: result ; rec: w] + result := foo(5); + w := reserve(w); (* see types.alpha – reserve returns a value of type address, + which can be assigned to array and record variables + *) + w.x := 5; + w.y := 7; + result := bar1(w); (* pass w (a rec type value) to bar1 *) + result := bar2(5,7); (* implicitly build a rec type value, assign 5 and 7 to fields x and y, but call them r and s *) + + return 0; +} From 7a52aa51bf025aad7d9ecc8d555c8d151ad52936 Mon Sep 17 00:00:00 2001 From: Annie Date: Tue, 18 Feb 2025 14:22:28 -0500 Subject: [PATCH 042/105] added -help functionality --- runner.c | 15 ++++++++++++++- runner.h | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/runner.c b/runner.c index 9a8e41c..c927d71 100644 --- a/runner.c +++ b/runner.c @@ -6,10 +6,15 @@ int main(int argc, char *argv[]) { int token; FILE *output; - if (argc == 1 || argc > 3 || (argc == 2 && is_alpha_file(argv[1], strlen(argv[1])) != 0)) { + if (argc == 1 || argc > 3) { fprintf(stderr, "invalid input with 1, >3, or non .alpha arg \n"); return -1; //no alpha file or too many args } else if (argc == 2) { + if (is_help(argv[1])) { + return 0; + } else if (is_alpha_file(argv[1], strlen(argv[1])) != 0) { + return -1; + } arg = NO_ARG; //no argument but valid input yyin = fopen(argv[1], "r"); } else { @@ -48,6 +53,14 @@ int main(int argc, char *argv[]) { return 0; } +bool is_help(char * input) { + if (strcmp(input, "-help") == 0) { + printf("HELP:\nHow to run the alpha compiler:\n./alpha [options] program\nValid options:\n-tok output the token number, token, line number, and column number for each of the tokens to the .tok file\n"); + return true; + } + return false; +} + char *is_tok(int argc, char *argv[]) { if (argc == 3 && strcmp("-tok", argv[1]) == 0) { char *input_prog = argv[2]; diff --git a/runner.h b/runner.h index b7c7369..c96c3df 100644 --- a/runner.h +++ b/runner.h @@ -15,6 +15,7 @@ #include #include "flex.h" #include "typedefs.h" +#include extern int line_number, column_number; extern char *yytext; @@ -24,3 +25,4 @@ int arg; int main(int argc, char* argv[]); char *is_tok(int argc, char* argv[]); int is_alpha_file(char *file, int file_len); +bool is_help(char * input); From 4e22726d5be6849ec2281d63a4792b6060cf7528 Mon Sep 17 00:00:00 2001 From: Meyer Simon Date: Tue, 18 Feb 2025 16:01:30 -0500 Subject: [PATCH 043/105] added .gitignore t#09 --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..47f37f6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.tok +*.o +alpha +flex.h From c2adcdf8bb121929957f9454636865f6847c284a Mon Sep 17 00:00:00 2001 From: Scarlett Date: Tue, 18 Feb 2025 16:03:52 -0500 Subject: [PATCH 044/105] Makefile updated t#09 --- Makefile | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 8164ae1..90bdaca 100644 --- a/Makefile +++ b/Makefile @@ -1,21 +1,20 @@ CC := gcc FLEX := flex LEX := lexicalStructure.lex -EXE := runner +EXE := alpha CFLAGS := -std=c99 -Wall CPPFLAGS := -runner: flex.o runner.o - $(CC) -o runner runner.o flex.o +build: lex.yy.c runner.o runner + +lex.yy.c: lexicalStructure.lex + $(FLEX) -o lex.yy.c $(LEX) runner.o: runner.c runner.h flex.h $(CC) $(CFLAGS) -o runner.o -c runner.c -flex.o: lex.yy.c typedefs.h - $(CC) $(CFLAGS) -o flex.o -c lex.yy.c - -lex.yy.c: lexicalStructure.lex - $(FLEX) -o lex.yy.c $(LEX) +runner: lex.yy.c runner.o + $(CC) -o $(EXE) runner.o lex.yy.c debug: CFLAGS += -DDEBUG=1 debug: clean runner From 57d52922d2877edbbd83b697479845b3e2e105f6 Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Wed, 19 Feb 2025 02:18:05 -0500 Subject: [PATCH 045/105] fixed comment issues --- lexicalStructure.lex | 5 +++-- tests/test_comment_issues.alpha | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 tests/test_comment_issues.alpha diff --git a/lexicalStructure.lex b/lexicalStructure.lex index 0763c99..7857730 100644 --- a/lexicalStructure.lex +++ b/lexicalStructure.lex @@ -13,7 +13,8 @@ #endif %} -COM ([^*]|\*+[^)*])* +STARCOM [^\*]|\*+[^\)\*]+ +PARENCOM [^\)]|[^\*\)]+\)+ ID [A-Za-z_][0-9A-Za-z_]* DIGIT [0-9] CHAR \\n|\\t|\\'|[^'\n\t\\]|\\\\ @@ -62,7 +63,7 @@ SCHAR \\n|\\t|\\\"|[^\"\n\\] {DIGIT}+ {if(DEBUG) {printf( "C_INTEGER: %s (%d)\n", yytext, C_INTEGER);} else {return C_INTEGER;}} '{CHAR}' {if(DEBUG) {printf( "C_CHARACTER: %s (%d)\n", yytext, C_CHARACTER);} else {return C_CHARACTER;}} \"{SCHAR}*\" {if(DEBUG) {printf( "C_STRING: %s (%d)\n", yytext, C_STRING);} else {return C_STRING;}} -"(*"{COM}"*)" {if(DEBUG) {printf( "COMMENT: %s (%d)\n", yytext, COMMENT);} else {return COMMENT;}} +\(\*{STARCOM}*\*\)|\(\*{PARENCOM}*\*\) {if(DEBUG) {printf( "COMMENT: %s (%d)\n", yytext, COMMENT);} else {return COMMENT;}} "(" {if(DEBUG) {printf( "L_PAREN: %s (%d)\n", yytext, L_PAREN);} else {return L_PAREN;}} ")" {if(DEBUG) {printf( "R_PAREN: %s (%d)\n", yytext, R_PAREN);} else {return R_PAREN;}} diff --git a/tests/test_comment_issues.alpha b/tests/test_comment_issues.alpha new file mode 100644 index 0000000..e968d93 --- /dev/null +++ b/tests/test_comment_issues.alpha @@ -0,0 +1,7 @@ +(*(**)*) +(***) +(******)(*\kpp*********) +((*((*)) +(***)(*) +(* *) +(***)))))))*(*))))))))*)) From 7836f6ecd0866854848950797d652f59c1be431a Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Thu, 20 Feb 2025 01:18:22 -0500 Subject: [PATCH 046/105] started symbol table file --- symbol_table.c | 50 +++++++++++++++++++++++++++++++++++ symbol_table.h | 0 test_comment_issues.tok | 0 tests/test_comment_issues.tok | 0 4 files changed, 50 insertions(+) create mode 100644 symbol_table.c create mode 100644 symbol_table.h create mode 100644 test_comment_issues.tok create mode 100644 tests/test_comment_issues.tok diff --git a/symbol_table.c b/symbol_table.c new file mode 100644 index 0000000..31d2945 --- /dev/null +++ b/symbol_table.c @@ -0,0 +1,50 @@ +//Defining a symbol table +//Using a Linked List Structure. Head of linked List points to parent scope (if one exists) +//Tail of Linked List points to a Linked List of all the child scopes +//T +#include "symbol_table.h" + +typedef struct ListOfTable{ + struct SymbolTable* table; + struct ListOfTable* prev; + struct ListOfTable* next; +}ListOfTable; + +typedef union Value{ + int* value_of_int; + void* value_of_pointer; + bool* value_of_bool; + char* value_of_char; + int* size_of_char_array; + }Value; + +typedef struct TableNode{ + string* theType; + string* theName; + Value* value; + struct TableNode* next; +}TableNode; + +typedef struct SymbolTable{ + TableNode* entries; + struct SymbolTable* Parent_Scope; + struct ListOfTable* Children_Scope; +}SymbolTable; + +SymbolTable* CreateScope(SymbolTable* ParentScope){ + SymbolTable* table = (SymbolTable*)malloc(sizeof(SymbolTable)); + table.Parent_Scope = ParentScope; + table.Children_Scope = NULL; + table.entries = NULL; + return table; +} + +Entry* CreateEntry(SymbolTable* table, string typeOf, string id, Value value){ + if( + + + + + + + diff --git a/symbol_table.h b/symbol_table.h new file mode 100644 index 0000000..e69de29 diff --git a/test_comment_issues.tok b/test_comment_issues.tok new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_comment_issues.tok b/tests/test_comment_issues.tok new file mode 100644 index 0000000..e69de29 From 5171e4bc8649356ce90d3e961a6bae48f2039263 Mon Sep 17 00:00:00 2001 From: Scarlett Date: Thu, 20 Feb 2025 14:30:18 -0500 Subject: [PATCH 047/105] Makefile updated t#30 --- Makefile | 3 ++- Makefile.save | 43 ------------------------------------------- 2 files changed, 2 insertions(+), 44 deletions(-) delete mode 100644 Makefile.save diff --git a/Makefile b/Makefile index 90bdaca..6fb4421 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ EXE := alpha CFLAGS := -std=c99 -Wall CPPFLAGS := -build: lex.yy.c runner.o runner +compiler: lex.yy.c runner.o runner lex.yy.c: lexicalStructure.lex $(FLEX) -o lex.yy.c $(LEX) @@ -38,6 +38,7 @@ test: ./$(EXE) -tok ./tests/test_simpleLiterals.alpha ./$(EXE) -tok ./tests/test_real_alpha_file.alpha ./$(EXE) -tok ./tests/test_real_alpha_2.alpha + clean: rm -f *.o rm -f lex.yy.c diff --git a/Makefile.save b/Makefile.save deleted file mode 100644 index 668af54..0000000 --- a/Makefile.save +++ /dev/null @@ -1,43 +0,0 @@ -CC := gcc -FLEX := flex -LEX := lexicalStructure.lex -EXE := runner -CFLAGS := -std=c99 -Wall -CPPFLAGS := - -runner: flex.o runner.o - $(CC) -o runner runner.o flex.o - -debug: CFLAGS += -DDEBUG=true -debug: clean runner - -runner.o: runner.c runner.h flex.h - $(CC) $(CFLAGS) -o runner.o -c runner.c - -flex.o: lex.yy.c typedefs.h - $(CC) $(CFLAGS) -o flex.o -c lex.yy.c - -lex.yy.c: lexicalStructure.lex - $(FLEX) -o lex.yy.c $(LEX) - -test: - ./$(EXE) ./tests/test_comments.alpha - ./$(EXE) ./tests/test_generalTokenTest.alpha - ./$(EXE) ./tests/test_keywords.alpha - ./$(EXE) ./tests/test_operators.alpha - ./$(EXE) ./tests/test_otherpunc.alpha - ./$(EXE) ./tests/test_simpleIntTest.alpha - ./$(EXE) ./tests/test_simpleLiterals.alpha - ./$(EXE) -tok ./tests/test_comments.alpha - ./$(EXE) -tok ./tests/test_generalTokenTest.alpha - ./$(EXE) -tok ./tests/test_keywords.alpha - ./$(EXE) -tok ./tests/test_operators.alpha - ./$(EXE) -tok ./tests/test_otherpunc.alpha - ./$(EXE) -tok ./tests/test_simpleIntTest.alpha - ./$(EXE) -tok ./tests/test_simpleLiterals.alpha -clean: - rm -f *.o - rm -f lex.yy.c - rm -f $(EXE) - rm -f flex.h - rm -f *.tok From 5f35308361a2f594c0145aa45e5b55633a501170 Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Thu, 20 Feb 2025 15:19:50 -0500 Subject: [PATCH 048/105] continued working on table structure --- symbol_table.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/symbol_table.c b/symbol_table.c index 31d2945..196bf06 100644 --- a/symbol_table.c +++ b/symbol_table.c @@ -8,6 +8,8 @@ typedef struct ListOfTable{ struct SymbolTable* table; struct ListOfTable* prev; struct ListOfTable* next; + int Line_Number; + int Column_Number; }ListOfTable; typedef union Value{ @@ -15,7 +17,6 @@ typedef union Value{ void* value_of_pointer; bool* value_of_bool; char* value_of_char; - int* size_of_char_array; }Value; typedef struct TableNode{ @@ -23,6 +24,8 @@ typedef struct TableNode{ string* theName; Value* value; struct TableNode* next; + //this next value is an int for string types to tell you how far to traverse a buffer for the string + int StrLength; }TableNode; typedef struct SymbolTable{ @@ -31,18 +34,23 @@ typedef struct SymbolTable{ struct ListOfTable* Children_Scope; }SymbolTable; -SymbolTable* CreateScope(SymbolTable* ParentScope){ +SymbolTable* CreateScope(SymbolTable* ParentScope, int Line, int Column){ SymbolTable* table = (SymbolTable*)malloc(sizeof(SymbolTable)); + table.Line_Number = Line; + table.Column_Number = Column; table.Parent_Scope = ParentScope; table.Children_Scope = NULL; table.entries = NULL; return table; } -Entry* CreateEntry(SymbolTable* table, string typeOf, string id, Value value){ - if( - - +TableNode* CreateEntry(SymbolTable* table, string typeOf, string id, Value value, int StringLength){ + if(table.entries == NULL){ + TableNode* newEntry = (TableNode*)malloc(sizeof(SymbolTable)); + newEntry.theType = typeOf; + newEntry.theName = id; + newEntry.StrLength = StringLength; + } else{ From 0aea539095ee52a937e12a70b3e02bf986361c96 Mon Sep 17 00:00:00 2001 From: Annie Date: Thu, 20 Feb 2025 16:07:44 -0500 Subject: [PATCH 049/105] implemented -st and -tok functionality, updated -help --- Makefile | 1 + runner.c | 175 ++++++++++++++++++++++++++++++++++++------------------- runner.h | 23 ++++---- 3 files changed, 128 insertions(+), 71 deletions(-) diff --git a/Makefile b/Makefile index 90bdaca..7d58bb2 100644 --- a/Makefile +++ b/Makefile @@ -44,3 +44,4 @@ clean: rm -f $(EXE) rm -f flex.h rm -f *.tok + rm -f *.st diff --git a/runner.c b/runner.c index c927d71..85e8214 100644 --- a/runner.c +++ b/runner.c @@ -2,96 +2,151 @@ int main(int argc, char *argv[]) { - char *check_input; - int token; - FILE *output; - - if (argc == 1 || argc > 3) { - fprintf(stderr, "invalid input with 1, >3, or non .alpha arg \n"); - return -1; //no alpha file or too many args + if (argc == 1) { + fprintf(stderr, "INVALID INPUT: Include a .alpha file or use -help for more inputs \n"); + return -1; } else if (argc == 2) { + //can be either -help or .alpha file if (is_help(argv[1])) { return 0; - } else if (is_alpha_file(argv[1], strlen(argv[1])) != 0) { + } else if (is_alpha_file(argv[1], strlen(argv[1])) == 0) { + //run flex for now + no_flag = SET_FLAG; //no argument but valid input + alpha_file = fopen(argv[1], "r"); + + } else { + fprintf(stderr, "INVALID INPUT: Include a .alpha file or use -help for more inputs\n"); return -1; } - arg = NO_ARG; //no argument but valid input - yyin = fopen(argv[1], "r"); } else { - check_input = is_tok(argc, argv); - if (strcmp(CHECK_OTHER, check_input) == 0 || strcmp(INVALID_ARG, check_input) == 0) { - fprintf(stderr, "check_other or invalid_arg \n"); - return -1; //invalid argument (need to update as we add more valid arguments) + //last input must be .alpha + if (is_alpha_file(argv[argc - 1], strlen(argv[argc - 1])) != 0) { + fprintf(stderr, "INVALID INPUT: Include a .alpha file at end of input or use -help for more inputs \n"); + return -1; + } else { + //now check that other args are valid (flags will not be null if flag is present) + for (int i = 1; i < argc - 1; i++) { + if (check_flag(argv[i], argv[argc - 1]) != 0) { + fprintf(stderr, "INVALID FLAG(S): Use -help to view valid inputs \n"); + return -1; + } + } + alpha_file = fopen(argv[argc - 1], "r"); } - output = fopen(check_input, "w"); - arg = TOK_ARG; //it is a -tok arg with a valid alpha file at argv[2] - yyin = fopen(argv[2], "r"); } - while (0 != (token = yylex())) { - if (arg == TOK_ARG) { - fprintf(output, "%d %d %3d \"%s\"\n", line_number, column_number, token, yytext); + return run(alpha_file); +} + +int check_flag(char *arg, char* alpha) { + if (strcmp("-tok", arg) == 0) { + if (tok_flag == NULL) { + return new_file(arg, alpha); } - if(token == COMMENT){ - for (int i = 0; i < yyleng; i++) { - if(yytext[i] == '\n'){ - line_number++; - column_number = 0; - } - column_number++; - } - continue; + fprintf(stderr, "FLAGS REPEAT\n"); + return -1; + } else if (strcmp("-st", arg) == 0) { + if (st_flag == NULL) { + return new_file(arg, alpha); + } + fprintf(stderr, "FLAGS REPEAT\n"); + return -1; + } else { + fprintf(stderr, "INVALID FLAG: Use -help for valid inputs\n"); + return -1; + } +} + + +int run(FILE *alpha) { + int token; + //check that file exists + if (alpha == NULL) { + fprintf(stderr, "INPUT FILE NOT FOUND\n"); + return -1; + } + yyin = alpha; + while (0 != (token = yylex())) { + if (tok_flag != NULL) { + fprintf(tok_flag, "%d %d %3d \"%s\"\n", line_number, column_number, token, yytext); + } + if(token == COMMENT){ + for (int i = 0; i < yyleng; i++) { + if(yytext[i] == '\n'){ + line_number++; + column_number = 0; + } + column_number++; + } + continue; } column_number += yyleng; } + if (st_flag != NULL) { + //output symbol table, file pointer is + fprintf(st_flag, "just checking that this works \n"); + } + if (yyin != NULL) { fclose(yyin); } - if (output != NULL && arg == TOK_ARG) { - fclose(output); + + if (tok_flag != NULL) { + fclose(tok_flag); } + return 0; } + + bool is_help(char * input) { if (strcmp(input, "-help") == 0) { - printf("HELP:\nHow to run the alpha compiler:\n./alpha [options] program\nValid options:\n-tok output the token number, token, line number, and column number for each of the tokens to the .tok file\n"); + printf("%s", HELP); return true; } return false; } -char *is_tok(int argc, char *argv[]) { - if (argc == 3 && strcmp("-tok", argv[1]) == 0) { - char *input_prog = argv[2]; - int file_len = strlen(input_prog); - //check that input program is a .alpha file - if (is_alpha_file(input_prog, file_len) != 0) { - return INVALID_ARG; - } - - const char *basename = input_prog; - const char *slash = strrchr(input_prog, '/'); - if (slash != NULL) { - basename = slash + 1; - } - - // Calculate lengths - int basename_len = strlen(basename); - char* FILE_tok = calloc(basename_len - ALPHA_OFFSET + TOK_LEN + 2, sizeof(char)); - - // Copy filename and add .tok extension - strncpy(FILE_tok, basename, basename_len - ALPHA_OFFSET); - //fprintf(stderr, "hello"); - strcat(FILE_tok, ".tok"); - - return FILE_tok; +int new_file(char *arg, char *alpha) { + int type_len; + const char *basename = alpha; + const char *slash = strchr(alpha, '/'); + while (slash != NULL) { + basename = slash + 1; + slash = strchr(basename, '/'); } - return CHECK_OTHER; + if (strcmp(arg, "-tok") == 0) { + type_len = TOK_LEN; + } else if (strcmp(arg, "-st") == 0) { + type_len = ST_LEN; + } else { + fprintf(stderr, "INVALID FLAG: Use -help to view valid inputs\n"); + return -1; + } + + + // calculate lengths + int basename_len = strlen(basename); + char *file_name = calloc(basename_len - ALPHA_OFFSET + type_len + 2, sizeof(char)); + + //coy filename and add extension + strncpy(file_name, basename, basename_len - ALPHA_OFFSET); + strcat(file_name, "."); + strcat(file_name, arg + 1); + + + if (strcmp(arg, "-tok") == 0) { + tok_flag = fopen(file_name, "w"); + } else if (strcmp(arg, "-st") == 0) { + st_flag = fopen(file_name, "w"); + } + return 0; } -int is_alpha_file(char *file, int file_len) { - if (strcmp(".alpha", file + sizeof(char) * (file_len - ALPHA_OFFSET)) != 0) { + +int is_alpha_file(char *alpha, int file_len) { + if (strcmp(".alpha", alpha + sizeof(char) * (file_len - ALPHA_OFFSET)) != 0) { return -1; //not alpha file } return 0; //is alpha file diff --git a/runner.h b/runner.h index c96c3df..4ac136d 100644 --- a/runner.h +++ b/runner.h @@ -1,14 +1,9 @@ #define ALPHA_OFFSET 6 #define TOK_LEN 3 - -//returns for is_tok -#define INVALID_ARG "invalid" -#define CHECK_OTHER "diff" - -//argument type in main -#define NO_ARG 0 -#define DIFF_ARG 1 -#define TOK_ARG 2 +#define ST_LEN 2 +#define HELP "HELP:\nHow to run the alpha compiler:\n./alpha [options] program\nValid options:\n-tok output the token number, token, line number, and column number for each of the tokens to the .tok file\n-st output the symbol table for the program to the .st file\n" +//use to set flags for arg types +#define SET_FLAG 1 #include #include @@ -21,8 +16,14 @@ extern int line_number, column_number; extern char *yytext; extern FILE *yyin; int arg; +FILE *alpha_file; +FILE *tok_flag = NULL; +FILE *st_flag = NULL; +int no_flag = 0; int main(int argc, char* argv[]); -char *is_tok(int argc, char* argv[]); -int is_alpha_file(char *file, int file_len); +int new_file(char *arg, char *alpha); +int is_alpha_file(char *alpha, int file_len); bool is_help(char * input); +int run(FILE*alpha); +int check_flag(char * arg, char* alpha); From fdb8f493e17c7eb67294eef1437b746e0dd00684 Mon Sep 17 00:00:00 2001 From: Annie Date: Thu, 20 Feb 2025 16:14:50 -0500 Subject: [PATCH 050/105] include -help description in -help --- runner.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runner.h b/runner.h index 4ac136d..a5c12fb 100644 --- a/runner.h +++ b/runner.h @@ -1,7 +1,7 @@ #define ALPHA_OFFSET 6 #define TOK_LEN 3 #define ST_LEN 2 -#define HELP "HELP:\nHow to run the alpha compiler:\n./alpha [options] program\nValid options:\n-tok output the token number, token, line number, and column number for each of the tokens to the .tok file\n-st output the symbol table for the program to the .st file\n" +#define HELP "HELP:\nHow to run the alpha compiler:\n./alpha [options] program\nValid options:\n-tok output the token number, token, line number, and column number for each of the tokens to the .tok file\n-st output the symbol table for the program to the .st file\n-help print this message and exit the alpha compiler\n" //use to set flags for arg types #define SET_FLAG 1 From b21d7039a2e2e68b86d6a49e1108f80a7c731617 Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Thu, 20 Feb 2025 17:50:25 -0500 Subject: [PATCH 051/105] finished base code for table setup. Still have to check grammar --- symbol_table.c | 57 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 15 deletions(-) diff --git a/symbol_table.c b/symbol_table.c index 196bf06..70cb359 100644 --- a/symbol_table.c +++ b/symbol_table.c @@ -6,10 +6,9 @@ typedef struct ListOfTable{ struct SymbolTable* table; - struct ListOfTable* prev; + //struct ListOfTable* prev; struct ListOfTable* next; - int Line_Number; - int Column_Number; + }ListOfTable; typedef union Value{ @@ -32,27 +31,55 @@ typedef struct SymbolTable{ TableNode* entries; struct SymbolTable* Parent_Scope; struct ListOfTable* Children_Scope; + int Line_Number; + int Column_Number; }SymbolTable; SymbolTable* CreateScope(SymbolTable* ParentScope, int Line, int Column){ SymbolTable* table = (SymbolTable*)malloc(sizeof(SymbolTable)); - table.Line_Number = Line; - table.Column_Number = Column; - table.Parent_Scope = ParentScope; - table.Children_Scope = NULL; - table.entries = NULL; + table->Line_Number = Line; + table->Column_Number = Column; + table->Parent_Scope = ParentScope; + table->Children_Scope = NULL; + table->entries = NULL; + if(ParentScope->Children_scope == NULL){ + ListOfTable* newEntry = (ListOfTable*)malloc(sizeof(ListOfTable)); + newEntry->next = NULL; + //newEntry->prev = NULL; + newEntry->table = table; + ParentScope->Children_scope = newEntry; + } else{ + ListOfTable* newEntry = (ListOfTable*)malloc(sizeof(ListOfTable)); + //newEntry->prev = NULL; + newEntry->table= table; + ListOfTable* oldEntry = ParentScope->Children_scope; + ParentScope->Children_scope = newEntry; + newEntry->next = oldEntry; + } + return table; + } + return table; } TableNode* CreateEntry(SymbolTable* table, string typeOf, string id, Value value, int StringLength){ - if(table.entries == NULL){ - TableNode* newEntry = (TableNode*)malloc(sizeof(SymbolTable)); - newEntry.theType = typeOf; - newEntry.theName = id; - newEntry.StrLength = StringLength; + if(table->entries == NULL){ + TableNode* newEntry = (TableNode*)malloc(sizeof(TableNode)); + newEntry->theType = typeOf; + newEntry->theName = id; + newEntry->StrLength = StringLength; + return newEntry; } else{ - + TableNode* newEntry = (TableNode*)malloc(sizeof(TableNode)); + newEntry->theType = typeOf; + newEntry->theName = id; + newEntry->StrLength = StringLength; + TableNode* oldEntry = table->entries; + table->entries = newEntry; + newEntry->next = oldEntry; + return newEntry; + } + } - From f2a0fbd1bc8dc171034e99eb81ce053bddc21797 Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Thu, 20 Feb 2025 19:07:21 -0500 Subject: [PATCH 052/105] added a simple test of symbol table and entry creation --- symbol_table.c | 148 +++++++++++++++++++++++----------------- symbol_table.h | 34 +++++++++ test_comment_issues.tok | 0 3 files changed, 118 insertions(+), 64 deletions(-) delete mode 100644 test_comment_issues.tok diff --git a/symbol_table.c b/symbol_table.c index 70cb359..2c3f3a2 100644 --- a/symbol_table.c +++ b/symbol_table.c @@ -2,84 +2,104 @@ //Using a Linked List Structure. Head of linked List points to parent scope (if one exists) //Tail of Linked List points to a Linked List of all the child scopes //T -#include "symbol_table.h" +//*#include "symbol_table.h" +/* +#include +#include +#include typedef struct ListOfTable{ - struct SymbolTable* table; - //struct ListOfTable* prev; - struct ListOfTable* next; + struct SymbolTable* table; + //struct ListOfTable* prev; + struct ListOfTable* next; }ListOfTable; typedef union Value{ - int* value_of_int; + int* value_of_int; void* value_of_pointer; bool* value_of_bool; char* value_of_char; }Value; - + typedef struct TableNode{ - string* theType; - string* theName; - Value* value; - struct TableNode* next; - //this next value is an int for string types to tell you how far to traverse a buffer for the string - int StrLength; -}TableNode; - + char* theType; + char* theName; + Value* value; + struct TableNode* next; + //this next value is an int for string types to tell you how far to traverse a buffer for the string + int StrLength; + }TableNode; + typedef struct SymbolTable{ - TableNode* entries; - struct SymbolTable* Parent_Scope; - struct ListOfTable* Children_Scope; - int Line_Number; + TableNode* entries; + struct SymbolTable* Parent_Scope; + struct ListOfTable* Children_Scope; + int Line_Number; int Column_Number; -}SymbolTable; + }SymbolTable; +*/ + SymbolTable* CreateScope(SymbolTable* ParentScope, int Line, int Column){ - SymbolTable* table = (SymbolTable*)malloc(sizeof(SymbolTable)); - table->Line_Number = Line; - table->Column_Number = Column; - table->Parent_Scope = ParentScope; - table->Children_Scope = NULL; - table->entries = NULL; - if(ParentScope->Children_scope == NULL){ - ListOfTable* newEntry = (ListOfTable*)malloc(sizeof(ListOfTable)); - newEntry->next = NULL; - //newEntry->prev = NULL; - newEntry->table = table; - ParentScope->Children_scope = newEntry; - } else{ - ListOfTable* newEntry = (ListOfTable*)malloc(sizeof(ListOfTable)); - //newEntry->prev = NULL; - newEntry->table= table; - ListOfTable* oldEntry = ParentScope->Children_scope; - ParentScope->Children_scope = newEntry; - newEntry->next = oldEntry; + SymbolTable* table = (SymbolTable*)malloc(sizeof(SymbolTable)); + table->Line_Number = Line; + table->Column_Number = Column; + table->Parent_Scope = ParentScope; + table->Children_Scope = NULL; + table->entries = NULL; + if(ParentScope != NULL){ + if(ParentScope->Children_Scope == NULL){ + ListOfTable* newEntry = (ListOfTable*)malloc(sizeof(ListOfTable)); + newEntry->next = NULL; + //newEntry->prev = NULL; + newEntry->table = table; + ParentScope->Children_Scope = newEntry; + } else{ + ListOfTable* newEntry = (ListOfTable*)malloc(sizeof(ListOfTable)); + //newEntry->prev = NULL; + newEntry->table= table; + ListOfTable* oldEntry = ParentScope->Children_Scope; + ParentScope->Children_Scope = newEntry; + newEntry->next = oldEntry; } - return table; - } - - return table; -} - -TableNode* CreateEntry(SymbolTable* table, string typeOf, string id, Value value, int StringLength){ - if(table->entries == NULL){ - TableNode* newEntry = (TableNode*)malloc(sizeof(TableNode)); - newEntry->theType = typeOf; - newEntry->theName = id; - newEntry->StrLength = StringLength; - return newEntry; - } else{ - TableNode* newEntry = (TableNode*)malloc(sizeof(TableNode)); - newEntry->theType = typeOf; - newEntry->theName = id; - newEntry->StrLength = StringLength; - TableNode* oldEntry = table->entries; - table->entries = newEntry; - newEntry->next = oldEntry; - return newEntry; - } - } - - + } + return table; + } + + +TableNode* CreateEntry(SymbolTable* table, char* typeOf, char* id, Value* value, int StringLength){ + if(table->entries == NULL){ + TableNode* newEntry = (TableNode*)malloc(sizeof(TableNode)); + newEntry->theType = typeOf; + newEntry->theName = id; + newEntry->value = value; + newEntry->StrLength = StringLength; + return newEntry; + } else{ + TableNode* newEntry = (TableNode*)malloc(sizeof(TableNode)); + newEntry->theType = typeOf; + newEntry->theName = id; + newEntry->value = value; + newEntry->StrLength = StringLength; + TableNode* oldEntry = table->entries; + table->entries = newEntry; + newEntry->next = oldEntry; + return newEntry; + } + } +//uncomment the below main function along with the headers above for a simple standalone test of table and entry creation +/* +int main(){ + char* String = "STRING"; + char* X = "X"; + Value* ofX = (Value*)malloc(sizeof(Value)); + ofX->value_of_char = X; + SymbolTable* Second = CreateScope(NULL, 2,2); + printf("Line number is %d, Column number of scope is %d\n",Second->Line_Number,Second->Column_Number); + TableNode* First_Entry = CreateEntry(Second,String,X,ofX,-1); + printf("The value of the first entry is %s\n",First_Entry->value->value_of_char); + return 0; + } +*/ diff --git a/symbol_table.h b/symbol_table.h index e69de29..539f2e4 100644 --- a/symbol_table.h +++ b/symbol_table.h @@ -0,0 +1,34 @@ +#include +#include +#include + +typedef struct ListOfTable{ + struct SymbolTable* table; + //struct ListOfTable* prev; + struct ListOfTable* next; + +}ListOfTable; + +typedef union Value{ + int* value_of_int; + void* value_of_pointer; + bool* value_of_bool; + char* value_of_char; + }Value; + +typedef struct TableNode{ + char* theType; + char* theName; + Value* value; + struct TableNode* next; + //this next value is an int for string types to tell you how far to traverse a buffer for the string + int StrLength; +}TableNode; + +typedef struct SymbolTable{ + TableNode* entries; + struct SymbolTable* Parent_Scope; + struct ListOfTable* Children_Scope; + int Line_Number; + int Column_Number; +}SymbolTable; diff --git a/test_comment_issues.tok b/test_comment_issues.tok deleted file mode 100644 index e69de29..0000000 From bf65f47b50cbc25d772a83891c0b0b34a24ad8d4 Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Thu, 20 Feb 2025 19:20:34 -0500 Subject: [PATCH 053/105] uncommented one part of symbol_table --- symbol_table.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/symbol_table.c b/symbol_table.c index 2c3f3a2..343cf66 100644 --- a/symbol_table.c +++ b/symbol_table.c @@ -2,7 +2,7 @@ //Using a Linked List Structure. Head of linked List points to parent scope (if one exists) //Tail of Linked List points to a Linked List of all the child scopes //T -//*#include "symbol_table.h" +#include "symbol_table.h" /* #include #include From 0b10c50a7847e46ae593cc1b36c3b325d172c892 Mon Sep 17 00:00:00 2001 From: Annie Date: Fri, 21 Feb 2025 01:19:39 -0500 Subject: [PATCH 054/105] added tests to makefile --- Makefile | 4 ++++ tests/test_wrong_type.txt | 0 2 files changed, 4 insertions(+) create mode 100644 tests/test_wrong_type.txt diff --git a/Makefile b/Makefile index 7d58bb2..e912658 100644 --- a/Makefile +++ b/Makefile @@ -38,6 +38,10 @@ test: ./$(EXE) -tok ./tests/test_simpleLiterals.alpha ./$(EXE) -tok ./tests/test_real_alpha_file.alpha ./$(EXE) -tok ./tests/test_real_alpha_2.alpha + ./$(EXE) -tok -st ./tests/test_real_alpha_2.alpha + ./$(EXE) -st -tok ./tests/test_operators.alpha + ./$(EXE) -st ./tests/test_keywords.alpha + clean: rm -f *.o rm -f lex.yy.c diff --git a/tests/test_wrong_type.txt b/tests/test_wrong_type.txt new file mode 100644 index 0000000..e69de29 From 4468dbd02f653c35d89dddc8dff747b6c1f4622e Mon Sep 17 00:00:00 2001 From: Meyer Simon Date: Fri, 21 Feb 2025 09:32:06 -0500 Subject: [PATCH 055/105] Fixed some functionality in symbol_table and added print_symbole_table t#29 --- print_symbol_table.c | 62 ++++++++++++++++++++++++++++++++++++++++++++ symbol_table.c | 48 ++++++++++++++++------------------ 2 files changed, 84 insertions(+), 26 deletions(-) create mode 100644 print_symbol_table.c diff --git a/print_symbol_table.c b/print_symbol_table.c new file mode 100644 index 0000000..91393e8 --- /dev/null +++ b/print_symbol_table.c @@ -0,0 +1,62 @@ +#include +#include "symbol_table.h" +#include "symbol_table.c" + +void print_symbol_table(SymbolTable *table, FILE *file_ptr){ + if(table->Parent_Scope == NULL){ + fprintf(file_ptr, "%-17s:%-8s:%-8s:%-22s:%-29s\n", "NAME", "SCOPE", "PARANT", "TYPE", "Extra annotation"); + } + TableNode * entrie = table->entries; + fprintf(file_ptr, "-----------------:--------:--------:----------------------:-----------------------------\n"); + int parant_scope = 0; + int current_scope = 0; + if(table->Parent_Scope != NULL){ + parant_scope = table->Parent_Scope->Line_Number*1000 + table->Parent_Scope->Column_Number; + current_scope = table->Line_Number*1000 + table->Column_Number; + } else { + current_scope = 1001; + } + + for(; entrie != NULL; entrie = entrie->next){ + fprintf(file_ptr, "%-17s: %06d : %06d :%-22s:%-29s\n", + entrie->theName, current_scope, parant_scope, + entrie->theType, "Extra annotation"); + } + if (table->Children_Scope != NULL){ + ListOfTable* node = table->Children_Scope; + for(; node != NULL; node = node->next){ + print_symbol_table(node->table, file_ptr); + } + } + if (table->Parent_Scope == NULL) { + fprintf(file_ptr, "-----------------:--------:--------:----------------------:-----------------------------\n"); + } +} +/* + +int main(void){ + SymbolTable * parant = CreateScope(NULL, 1,1); + // Value* v = calloc(1, sizeof(Value)); + CreateEntry(parant, &"primitive", &"Boolean", NULL, 0); + CreateEntry(parant, &"primitive", &"character", NULL, 0); + CreateEntry(parant, &"primitive", &"integer", NULL, 0); + CreateEntry(parant, &"1 -> character", &"string", NULL, 0); + CreateEntry(parant, &"integer -> integer", &"int2int", NULL, 0); + CreateEntry(parant, &"string -> integer", &"string2int", NULL, 0); + CreateEntry(parant, &"int2int", &"square", NULL, 0); + CreateEntry(parant, &"string2int", &"entry", NULL, 0); + SymbolTable * child = CreateScope(parant, 14,14); + CreateEntry(child, &"integer", &"x", NULL, 0); + SymbolTable * second = CreateScope(parant, 14,14); + CreateEntry(second, &"string", &"arg", NULL, 0); + CreateEntry(second, &"integer", &"input", NULL, 0); + CreateEntry(second, &"integer", &"expected", NULL, 0); + CreateEntry(second, &"integer", &"actual", NULL, 0); + CreateEntry(second, &"$_undefined_type", &"result", NULL, 0); + SymbolTable * third = CreateScope(second, 33,44); + CreateEntry(third, &"BOO", &"arg", NULL, 0); + CreateEntry(third, &"YAZOO", &"input", NULL, 0); + print_symbol_table(parant, stderr); + return 0; +} +*/ diff --git a/symbol_table.c b/symbol_table.c index 2c3f3a2..0e4c3d0 100644 --- a/symbol_table.c +++ b/symbol_table.c @@ -30,7 +30,7 @@ typedef struct TableNode{ //this next value is an int for string types to tell you how far to traverse a buffer for the string int StrLength; }TableNode; - + typedef struct SymbolTable{ TableNode* entries; struct SymbolTable* Parent_Scope; @@ -40,7 +40,7 @@ typedef struct SymbolTable{ }SymbolTable; */ - + SymbolTable* CreateScope(SymbolTable* ParentScope, int Line, int Column){ SymbolTable* table = (SymbolTable*)malloc(sizeof(SymbolTable)); table->Line_Number = Line; @@ -66,31 +66,27 @@ SymbolTable* CreateScope(SymbolTable* ParentScope, int Line, int Column){ } return table; } - - -TableNode* CreateEntry(SymbolTable* table, char* typeOf, char* id, Value* value, int StringLength){ - if(table->entries == NULL){ - TableNode* newEntry = (TableNode*)malloc(sizeof(TableNode)); - newEntry->theType = typeOf; - newEntry->theName = id; - newEntry->value = value; - newEntry->StrLength = StringLength; - return newEntry; - } else{ - TableNode* newEntry = (TableNode*)malloc(sizeof(TableNode)); - newEntry->theType = typeOf; - newEntry->theName = id; - newEntry->value = value; - newEntry->StrLength = StringLength; - TableNode* oldEntry = table->entries; - table->entries = newEntry; - newEntry->next = oldEntry; - return newEntry; - } - } -//uncomment the below main function along with the headers above for a simple standalone test of table and entry creation -/* + +TableNode* CreateEntry(SymbolTable* table, char* typeOf, char* id, Value* value, int StringLength){ + TableNode* newEntry = (TableNode*)malloc(sizeof(TableNode)); + newEntry->theType = typeOf; + newEntry->theName = id; + newEntry->value = value; + newEntry->StrLength = StringLength; + if(table->entries == NULL){ + table->entries = newEntry; + return newEntry; + } else{ + TableNode* oldEntry = table->entries; + table->entries = newEntry; + newEntry->next = oldEntry; + return newEntry; + } +} + +//uncomment the below main function along with the headers above for a simple standalone test of table and entry creation +/* int main(){ char* String = "STRING"; char* X = "X"; From dbcdafb1a0e6515e048baaffe652fa9a0dda4b5c Mon Sep 17 00:00:00 2001 From: Meyer Simon Date: Fri, 21 Feb 2025 10:09:26 -0500 Subject: [PATCH 056/105] fixed some of the spacing in the table t#29 --- print_symbol_table.c | 6 +++--- symbol_table.h | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/print_symbol_table.c b/print_symbol_table.c index 91393e8..0121538 100644 --- a/print_symbol_table.c +++ b/print_symbol_table.c @@ -4,7 +4,7 @@ void print_symbol_table(SymbolTable *table, FILE *file_ptr){ if(table->Parent_Scope == NULL){ - fprintf(file_ptr, "%-17s:%-8s:%-8s:%-22s:%-29s\n", "NAME", "SCOPE", "PARANT", "TYPE", "Extra annotation"); + fprintf(file_ptr, "%-17s: %-6s : %-6s : %-21s: %-28s\n", "NAME", "SCOPE", "PARANT", "TYPE", "Extra annotation"); } TableNode * entrie = table->entries; fprintf(file_ptr, "-----------------:--------:--------:----------------------:-----------------------------\n"); @@ -18,7 +18,7 @@ void print_symbol_table(SymbolTable *table, FILE *file_ptr){ } for(; entrie != NULL; entrie = entrie->next){ - fprintf(file_ptr, "%-17s: %06d : %06d :%-22s:%-29s\n", + fprintf(file_ptr, "%-17s: %06d : %06d : %-21s: %-28s\n", entrie->theName, current_scope, parant_scope, entrie->theType, "Extra annotation"); } @@ -34,6 +34,7 @@ void print_symbol_table(SymbolTable *table, FILE *file_ptr){ } /* +*/ int main(void){ SymbolTable * parant = CreateScope(NULL, 1,1); // Value* v = calloc(1, sizeof(Value)); @@ -59,4 +60,3 @@ int main(void){ print_symbol_table(parant, stderr); return 0; } -*/ diff --git a/symbol_table.h b/symbol_table.h index 539f2e4..1e002d0 100644 --- a/symbol_table.h +++ b/symbol_table.h @@ -32,3 +32,7 @@ typedef struct SymbolTable{ int Line_Number; int Column_Number; }SymbolTable; + + +TableNode* CreateEntry(SymbolTable* table, char* typeOf, char* id, Value* value, int StringLength); +SymbolTable* CreateScope(SymbolTable* ParentScope, int Line, int Column); From ad5da9685799ae3e80cdb36e3e68f5f1d34e80eb Mon Sep 17 00:00:00 2001 From: Meyer Simon Date: Fri, 21 Feb 2025 11:47:20 -0500 Subject: [PATCH 057/105] Made spelling errors t#29 --- print_symbol_table.c | 49 ++++++++++++++++++++++++++++++-------------- 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/print_symbol_table.c b/print_symbol_table.c index 0121538..0ae90f6 100644 --- a/print_symbol_table.c +++ b/print_symbol_table.c @@ -1,10 +1,11 @@ #include #include "symbol_table.h" #include "symbol_table.c" +#include void print_symbol_table(SymbolTable *table, FILE *file_ptr){ if(table->Parent_Scope == NULL){ - fprintf(file_ptr, "%-17s: %-6s : %-6s : %-21s: %-28s\n", "NAME", "SCOPE", "PARANT", "TYPE", "Extra annotation"); + fprintf(file_ptr, "%-17s: %-6s : %-6s : %-21s: %-28s\n", "NAME", "SCOPE", "PARENT", "TYPE", "Extra annotation"); } TableNode * entrie = table->entries; fprintf(file_ptr, "-----------------:--------:--------:----------------------:-----------------------------\n"); @@ -18,9 +19,15 @@ void print_symbol_table(SymbolTable *table, FILE *file_ptr){ } for(; entrie != NULL; entrie = entrie->next){ - fprintf(file_ptr, "%-17s: %06d : %06d : %-21s: %-28s\n", - entrie->theName, current_scope, parant_scope, - entrie->theType, "Extra annotation"); + if (parant_scope == 0){ + fprintf(file_ptr, "%-17s: %06d : : %-21s: %-28s\n", + entrie->theName, current_scope, + entrie->theType, "Extra annotation"); + } else { + fprintf(file_ptr, "%-17s: %06d : %06d : %-21s: %-28s\n", + entrie->theName, current_scope, parant_scope, + entrie->theType, "Extra annotation"); + } } if (table->Children_Scope != NULL){ ListOfTable* node = table->Children_Scope; @@ -36,27 +43,39 @@ void print_symbol_table(SymbolTable *table, FILE *file_ptr){ */ int main(void){ + char *prim = strdup("primitive"); + char *inte = strdup("integer"); SymbolTable * parant = CreateScope(NULL, 1,1); + char *boole = strdup("Boolean"); + char *chare = strdup("character"); + char *str = strdup("string"); + char *arg = strdup("arg"); // Value* v = calloc(1, sizeof(Value)); - CreateEntry(parant, &"primitive", &"Boolean", NULL, 0); - CreateEntry(parant, &"primitive", &"character", NULL, 0); - CreateEntry(parant, &"primitive", &"integer", NULL, 0); - CreateEntry(parant, &"1 -> character", &"string", NULL, 0); + CreateEntry(parant, prim, boole, NULL, 0); + CreateEntry(parant, prim, chare, NULL, 0); + CreateEntry(parant, prim, inte, NULL, 0); + CreateEntry(parant, &"1 -> character", str, NULL, 0); CreateEntry(parant, &"integer -> integer", &"int2int", NULL, 0); CreateEntry(parant, &"string -> integer", &"string2int", NULL, 0); CreateEntry(parant, &"int2int", &"square", NULL, 0); CreateEntry(parant, &"string2int", &"entry", NULL, 0); SymbolTable * child = CreateScope(parant, 14,14); - CreateEntry(child, &"integer", &"x", NULL, 0); - SymbolTable * second = CreateScope(parant, 14,14); - CreateEntry(second, &"string", &"arg", NULL, 0); - CreateEntry(second, &"integer", &"input", NULL, 0); - CreateEntry(second, &"integer", &"expected", NULL, 0); - CreateEntry(second, &"integer", &"actual", NULL, 0); + CreateEntry(child, inte, &"x", NULL, 0); + SymbolTable * second = CreateScope(parant, 21,15); + CreateEntry(second, str, arg, NULL, 0); + CreateEntry(second, inte, &"input", NULL, 0); + CreateEntry(second, inte, &"expected", NULL, 0); + CreateEntry(second, inte, &"actual", NULL, 0); CreateEntry(second, &"$_undefined_type", &"result", NULL, 0); SymbolTable * third = CreateScope(second, 33,44); - CreateEntry(third, &"BOO", &"arg", NULL, 0); + CreateEntry(third, &"BOO", arg, NULL, 0); CreateEntry(third, &"YAZOO", &"input", NULL, 0); print_symbol_table(parant, stderr); + free(inte); + free(boole); + free(prim); + free(str); + free(chare); + free(arg); return 0; } From e0ab5540da8dd3f0b2cb0d15ee30581b82c47ec3 Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Fri, 21 Feb 2025 12:52:24 -0500 Subject: [PATCH 058/105] edited symbol table node structure to remove strlength and value as they are not needed --- symbol_table.c | 54 ++++++------------------------------------------- symbol_table.h | 12 +---------- test | Bin 0 -> 16088 bytes 3 files changed, 7 insertions(+), 59 deletions(-) create mode 100755 test diff --git a/symbol_table.c b/symbol_table.c index 0e4c3d0..9cbdf90 100644 --- a/symbol_table.c +++ b/symbol_table.c @@ -1,45 +1,8 @@ //Defining a symbol table //Using a Linked List Structure. Head of linked List points to parent scope (if one exists) -//Tail of Linked List points to a Linked List of all the child scopes -//T -//*#include "symbol_table.h" -/* -#include -#include -#include +//Tail of Linked List points to a List of child scopes -typedef struct ListOfTable{ - struct SymbolTable* table; - //struct ListOfTable* prev; - struct ListOfTable* next; - -}ListOfTable; - -typedef union Value{ - int* value_of_int; - void* value_of_pointer; - bool* value_of_bool; - char* value_of_char; - }Value; - -typedef struct TableNode{ - char* theType; - char* theName; - Value* value; - struct TableNode* next; - //this next value is an int for string types to tell you how far to traverse a buffer for the string - int StrLength; - }TableNode; - -typedef struct SymbolTable{ - TableNode* entries; - struct SymbolTable* Parent_Scope; - struct ListOfTable* Children_Scope; - int Line_Number; - int Column_Number; - }SymbolTable; - -*/ +#include "symbol_table.h" SymbolTable* CreateScope(SymbolTable* ParentScope, int Line, int Column){ SymbolTable* table = (SymbolTable*)malloc(sizeof(SymbolTable)); @@ -68,12 +31,10 @@ SymbolTable* CreateScope(SymbolTable* ParentScope, int Line, int Column){ } -TableNode* CreateEntry(SymbolTable* table, char* typeOf, char* id, Value* value, int StringLength){ +TableNode* CreateEntry(SymbolTable* table, char* typeOf, char* id){ TableNode* newEntry = (TableNode*)malloc(sizeof(TableNode)); newEntry->theType = typeOf; newEntry->theName = id; - newEntry->value = value; - newEntry->StrLength = StringLength; if(table->entries == NULL){ table->entries = newEntry; return newEntry; @@ -86,16 +47,13 @@ TableNode* CreateEntry(SymbolTable* table, char* typeOf, char* id, Value* value, } //uncomment the below main function along with the headers above for a simple standalone test of table and entry creation -/* + int main(){ char* String = "STRING"; char* X = "X"; - Value* ofX = (Value*)malloc(sizeof(Value)); - ofX->value_of_char = X; SymbolTable* Second = CreateScope(NULL, 2,2); printf("Line number is %d, Column number of scope is %d\n",Second->Line_Number,Second->Column_Number); - TableNode* First_Entry = CreateEntry(Second,String,X,ofX,-1); - printf("The value of the first entry is %s\n",First_Entry->value->value_of_char); + TableNode* First_Entry = CreateEntry(Second,String,X); + printf("The type of the first entry is %s\n",First_Entry->theType); return 0; } -*/ diff --git a/symbol_table.h b/symbol_table.h index 1e002d0..d510a3b 100644 --- a/symbol_table.h +++ b/symbol_table.h @@ -9,20 +9,10 @@ typedef struct ListOfTable{ }ListOfTable; -typedef union Value{ - int* value_of_int; - void* value_of_pointer; - bool* value_of_bool; - char* value_of_char; - }Value; - typedef struct TableNode{ char* theType; char* theName; - Value* value; struct TableNode* next; - //this next value is an int for string types to tell you how far to traverse a buffer for the string - int StrLength; }TableNode; typedef struct SymbolTable{ @@ -34,5 +24,5 @@ typedef struct SymbolTable{ }SymbolTable; -TableNode* CreateEntry(SymbolTable* table, char* typeOf, char* id, Value* value, int StringLength); +TableNode* CreateEntry(SymbolTable* table, char* typeOf, char* id); SymbolTable* CreateScope(SymbolTable* ParentScope, int Line, int Column); diff --git a/test b/test new file mode 100755 index 0000000000000000000000000000000000000000..4941bf240c8f2f1ec1cf50ca112b79be646ae11c GIT binary patch literal 16088 zcmeHOZ)_Y#6(2iI>d+*RbH+whpg^sB8Z9&Wm?6-bGFe+m>sY=3lyD7HsX}iyVkJ}}BucpX%3%r!MX2I_5N;tU zm=DsU9EVWRm)o-ljAH4}GW`J=pa}KjD3tL=tybeZE9qg*%OF$15lgrU#!WCz=nS_f zRPsqVp=&$$BS@Q|qarkj8)RINwi}odN^MX%blyw6pZ2;L=ULi~3Q}oDsI+${a6GgI zc$H5X=7ZeceB;o~`4`IRRhv`EzHP0WQ;Eh@GE*3C9NxaIaa(INpN+QYmMJa^7tN_X z`+F7KOpuJzsA@+IFaAiklJ#W&O6T*xIrZB52e!YsvE_Js;pB&7Z~TmGC~m@#4Hfby zQ-pY`UyF-uOg_GdnvoGb=f0FCI$yaFitDQ=?}W^%BHsjAHG68Lnmxr|&HjOT?5Q6c zaJ{EEPXBP+8AxX0spS2xO2<>FY`=0Gj7z_h_u@IvNyn2JHIz$cya7dG8l7!w&)%-x zZB9$HCAzg--_oj_uAY5P!p*ryl6lX~_3Ud)WixJ1yf5X#>ydOe!(JU@TGf#9UxP7` zi^ic=-%~Q*3Tu*!Y1DS0LnM3p>yKiXYE>t9P@V&F{~ca#6esyU7rDjqx|q?6T=>a5 zjGX2G^)PGbuAZxtUK!GwYMne3SA#%Sk44opfh?a{ZhYKuE(3gc%4k z5N06EK$w9r17QaKr!w%@`n7+zk6oy<#}>Y_Stb7j%|7;r zneLvB=85JP>=Qeiv3@PB+5*eJ4MgkLJ*4A-{4PlB6AKR#`NXWZ3Z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L4pw&tH1ali2 Date: Fri, 21 Feb 2025 14:30:14 -0500 Subject: [PATCH 059/105] it looks like this should work. t#29 --- Makefile | 20 ++++++++++------- grammar.y | 46 +++++++++++++++++++++++++++++++++++++++ print_symbol_table.c | 51 +++++++++++++++++++++++++++++--------------- runner.c | 17 ++++++++++++++- runner.h | 4 ++++ symbol_table.c | 29 +++++++++++++++++++------ symbol_table.h | 3 ++- 7 files changed, 136 insertions(+), 34 deletions(-) create mode 100644 grammar.y diff --git a/Makefile b/Makefile index 8164ae1..e912658 100644 --- a/Makefile +++ b/Makefile @@ -1,21 +1,20 @@ CC := gcc FLEX := flex LEX := lexicalStructure.lex -EXE := runner +EXE := alpha CFLAGS := -std=c99 -Wall CPPFLAGS := -runner: flex.o runner.o - $(CC) -o runner runner.o flex.o +build: lex.yy.c runner.o runner + +lex.yy.c: lexicalStructure.lex + $(FLEX) -o lex.yy.c $(LEX) runner.o: runner.c runner.h flex.h $(CC) $(CFLAGS) -o runner.o -c runner.c -flex.o: lex.yy.c typedefs.h - $(CC) $(CFLAGS) -o flex.o -c lex.yy.c - -lex.yy.c: lexicalStructure.lex - $(FLEX) -o lex.yy.c $(LEX) +runner: lex.yy.c runner.o + $(CC) -o $(EXE) runner.o lex.yy.c debug: CFLAGS += -DDEBUG=1 debug: clean runner @@ -39,9 +38,14 @@ test: ./$(EXE) -tok ./tests/test_simpleLiterals.alpha ./$(EXE) -tok ./tests/test_real_alpha_file.alpha ./$(EXE) -tok ./tests/test_real_alpha_2.alpha + ./$(EXE) -tok -st ./tests/test_real_alpha_2.alpha + ./$(EXE) -st -tok ./tests/test_operators.alpha + ./$(EXE) -st ./tests/test_keywords.alpha + clean: rm -f *.o rm -f lex.yy.c rm -f $(EXE) rm -f flex.h rm -f *.tok + rm -f *.st diff --git a/grammar.y b/grammar.y new file mode 100644 index 0000000..19c6ea2 --- /dev/null +++ b/grammar.y @@ -0,0 +1,46 @@ +%token ID 101 +%token T_INTEGER 201 +%token T_ADDRESS 202 +%token T_BOOLEAN 203 +%token T_CHARACTER 204 +%token T_STRING 205 +%token C_INTEGER 301 +%token C_NULL 302 +%token C_CHARACTER 303 +%token C_STRING 304 +%token C_TRUE 305 +%token C_FALSE 306 +%token WHILE 401 +%token IF 402 +%token THEN 403 +%token ELSE 404 +%token TYPE 405 +%token FUNCTION 406 +%token RETURN 407 +%token EXTERNAL 408 +%token AS 409 +%token L_PAREN 501 +%token R_PAREN 502 +%token L_BRACKET 503 +%token R_BRACKET 504 +%token L_BRACE 505 +%token R_BRACE 506 +%token SEMI_COLON 507 +%token COLON 508 +%token COMMA 509 +%token ARROW 510 +%token ADD 601 +%token SUB_OR_NEG 602 +%token MUL 603 +%token DIV 604 +%token REM 605 +%token LESS_THAN 606 +%token EQUAL_TO 607 +%token ASSIGN 608 +%token NOT 609 +%token AND 610 +%token OR 611 +%token DOT 612 +%token RESERVE 613 +%token RELEASE 614 +%token COMMENT 700 diff --git a/print_symbol_table.c b/print_symbol_table.c index 0ae90f6..c5e4208 100644 --- a/print_symbol_table.c +++ b/print_symbol_table.c @@ -41,7 +41,6 @@ void print_symbol_table(SymbolTable *table, FILE *file_ptr){ } /* -*/ int main(void){ char *prim = strdup("primitive"); char *inte = strdup("integer"); @@ -51,25 +50,41 @@ int main(void){ char *str = strdup("string"); char *arg = strdup("arg"); // Value* v = calloc(1, sizeof(Value)); - CreateEntry(parant, prim, boole, NULL, 0); - CreateEntry(parant, prim, chare, NULL, 0); - CreateEntry(parant, prim, inte, NULL, 0); - CreateEntry(parant, &"1 -> character", str, NULL, 0); - CreateEntry(parant, &"integer -> integer", &"int2int", NULL, 0); - CreateEntry(parant, &"string -> integer", &"string2int", NULL, 0); - CreateEntry(parant, &"int2int", &"square", NULL, 0); - CreateEntry(parant, &"string2int", &"entry", NULL, 0); + CreateEntry(parant, prim, boole); + CreateEntry(parant, prim, chare); + CreateEntry(parant, prim, inte); + CreateEntry(parant, &"1 -> character", str); + CreateEntry(parant, &"integer -> integer", &"int2int"); + CreateEntry(parant, &"string -> integer", &"string2int"); + CreateEntry(parant, &"int2int", &"square"); + CreateEntry(parant, &"string2int", &"entry"); SymbolTable * child = CreateScope(parant, 14,14); - CreateEntry(child, inte, &"x", NULL, 0); + CreateEntry(child, inte, &"x"); SymbolTable * second = CreateScope(parant, 21,15); - CreateEntry(second, str, arg, NULL, 0); - CreateEntry(second, inte, &"input", NULL, 0); - CreateEntry(second, inte, &"expected", NULL, 0); - CreateEntry(second, inte, &"actual", NULL, 0); - CreateEntry(second, &"$_undefined_type", &"result", NULL, 0); + CreateEntry(second, str, arg); + CreateEntry(second, inte, &"input"); + CreateEntry(second, inte, &"expected"); + CreateEntry(second, inte, &"actual"); + CreateEntry(second, &"$_undefined_type", &"result"); SymbolTable * third = CreateScope(second, 33,44); - CreateEntry(third, &"BOO", arg, NULL, 0); - CreateEntry(third, &"YAZOO", &"input", NULL, 0); + CreateEntry(third, &"BOO", arg); + CreateEntry(third, &"YAZOO", &"input"); + + TableNode *ret = table_lookup(third, "arg"); + printf("%s == %s\n", ret->theName, "arg"); + + ret = table_lookup(third, "hello"); + printf("This should be nil %p != %s\n", ret, "BOO"); + + ret = look_up(second, "input"); + printf("%s == %s\n", ret->theName, "input"); + + ret = look_up(second, "square"); + printf("%s == %s\n", ret->theName, "square"); + + ret = look_up(second, "spuare"); + printf("This should be nil %p == %s\n", ret, "square"); + print_symbol_table(parant, stderr); free(inte); free(boole); @@ -79,3 +94,5 @@ int main(void){ free(arg); return 0; } + +*/ diff --git a/runner.c b/runner.c index 9a8e41c..a0223c8 100644 --- a/runner.c +++ b/runner.c @@ -1,6 +1,7 @@ +#include "symbol_table.h" +#include "symbol_table.c" #include "runner.h" - int main(int argc, char *argv[]) { char *check_input; int token; @@ -84,3 +85,17 @@ int is_alpha_file(char *file, int file_len) { return 0; //is alpha file } +void enter_scope(int line, int column){ + curr = CreateScope(curr, line, column); +} +void exit_scope() { + if(curr->Parent_Scope == NULL){ + printf("Can't close top"); + return; + } + curr = curr->Parent_Scope; +} + + + + diff --git a/runner.h b/runner.h index b7c7369..968eada 100644 --- a/runner.h +++ b/runner.h @@ -20,7 +20,11 @@ extern int line_number, column_number; extern char *yytext; extern FILE *yyin; int arg; +SymbolTable * top; +SymbolTable * curr; int main(int argc, char* argv[]); char *is_tok(int argc, char* argv[]); int is_alpha_file(char *file, int file_len); +void enter_scope(int, int); +void exit_scope(void); diff --git a/symbol_table.c b/symbol_table.c index 0e4c3d0..3695a32 100644 --- a/symbol_table.c +++ b/symbol_table.c @@ -68,12 +68,10 @@ SymbolTable* CreateScope(SymbolTable* ParentScope, int Line, int Column){ } -TableNode* CreateEntry(SymbolTable* table, char* typeOf, char* id, Value* value, int StringLength){ +TableNode* CreateEntry(SymbolTable* table, char* typeOf, char* id){ TableNode* newEntry = (TableNode*)malloc(sizeof(TableNode)); newEntry->theType = typeOf; newEntry->theName = id; - newEntry->value = value; - newEntry->StrLength = StringLength; if(table->entries == NULL){ table->entries = newEntry; return newEntry; @@ -84,18 +82,35 @@ TableNode* CreateEntry(SymbolTable* table, char* typeOf, char* id, Value* value, return newEntry; } } +TableNode * table_lookup(SymbolTable * table, char * x){ + TableNode * entrie = table->entries; + for(; entrie != NULL; entrie = entrie->next){ + if (!strcmp(entrie->theName, x)){ + return entrie; + } + } + return NULL; +} +TableNode * look_up(SymbolTable * table, char * x){ + if(table == NULL){ + return NULL; + } + TableNode * ret = table_lookup(table, x); + if (ret != NULL){ + return ret; + } + return look_up(table->Parent_Scope, x); +} //uncomment the below main function along with the headers above for a simple standalone test of table and entry creation /* int main(){ char* String = "STRING"; char* X = "X"; - Value* ofX = (Value*)malloc(sizeof(Value)); - ofX->value_of_char = X; SymbolTable* Second = CreateScope(NULL, 2,2); printf("Line number is %d, Column number of scope is %d\n",Second->Line_Number,Second->Column_Number); - TableNode* First_Entry = CreateEntry(Second,String,X,ofX,-1); - printf("The value of the first entry is %s\n",First_Entry->value->value_of_char); + TableNode* First_Entry = CreateEntry(Second,String,X); + printf("The value of the first entry is %s\n",First_Entry->theType); return 0; } */ diff --git a/symbol_table.h b/symbol_table.h index 1e002d0..11f828f 100644 --- a/symbol_table.h +++ b/symbol_table.h @@ -1,6 +1,7 @@ #include #include #include +#include typedef struct ListOfTable{ struct SymbolTable* table; @@ -34,5 +35,5 @@ typedef struct SymbolTable{ }SymbolTable; -TableNode* CreateEntry(SymbolTable* table, char* typeOf, char* id, Value* value, int StringLength); +TableNode* CreateEntry(SymbolTable* table, char* typeOf, char* id); SymbolTable* CreateScope(SymbolTable* ParentScope, int Line, int Column); From eb3452fec9afd4a71c97adfd83ecc34903a7ed7a Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Fri, 21 Feb 2025 15:25:21 -0500 Subject: [PATCH 060/105] added code to print out positions of incorrect tokens --- lexicalStructure.lex | 4 +++- runner.c | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lexicalStructure.lex b/lexicalStructure.lex index 7857730..64b2863 100644 --- a/lexicalStructure.lex +++ b/lexicalStructure.lex @@ -81,6 +81,8 @@ SCHAR \\n|\\t|\\\"|[^\"\n\\] {ID} {if(DEBUG) {printf( "ID: %s (%d)\n", yytext, ID);} else {return ID;}} \n {line_number++; column_number = 1;} -. {column_number++;} +\t {column_number++;} +" " {column_number++;} +. {column_number++; return 1999;} %% diff --git a/runner.c b/runner.c index 85e8214..a87df49 100644 --- a/runner.c +++ b/runner.c @@ -79,6 +79,9 @@ int run(FILE *alpha) { } continue; } + if(token == 1999){ + printf("On line number %d and column number %d we have an invalid character:%s\n",line_number,column_number,yytext); + } column_number += yyleng; } From 5505d11d2133ab7eb9779e55eb49e409346c67cb Mon Sep 17 00:00:00 2001 From: Scarlett Date: Fri, 21 Feb 2025 16:18:38 -0500 Subject: [PATCH 061/105] Completed task1 objectives t#30 --- .gitignore | 2 ++ Makefile | 12 ++++++++---- README.MD | 17 +++++++++++++++++ grammar.y | 18 ++++++++++++++++++ 4 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 README.MD create mode 100644 grammar.y diff --git a/.gitignore b/.gitignore index 47f37f6..b927c65 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ *.o alpha flex.h +grammar.tab.c +grammar.tab.h \ No newline at end of file diff --git a/Makefile b/Makefile index 6fb4421..a6d045b 100644 --- a/Makefile +++ b/Makefile @@ -2,8 +2,7 @@ CC := gcc FLEX := flex LEX := lexicalStructure.lex EXE := alpha -CFLAGS := -std=c99 -Wall -CPPFLAGS := +CFLAGS := compiler: lex.yy.c runner.o runner @@ -14,10 +13,13 @@ runner.o: runner.c runner.h flex.h $(CC) $(CFLAGS) -o runner.o -c runner.c runner: lex.yy.c runner.o - $(CC) -o $(EXE) runner.o lex.yy.c + $(CC) $(CFLAGS) -o $(EXE) runner.o lex.yy.c + +bison: grammar.y + bison -d grammar.y debug: CFLAGS += -DDEBUG=1 -debug: clean runner +debug: clean compiler test: ./$(EXE) ./tests/test_comments.alpha @@ -45,3 +47,5 @@ clean: rm -f $(EXE) rm -f flex.h rm -f *.tok + rm -f grammar.tab.c + rm -f grammar.tab.h diff --git a/README.MD b/README.MD new file mode 100644 index 0000000..525582f --- /dev/null +++ b/README.MD @@ -0,0 +1,17 @@ +# The Translators α Compiler +#### Members: Annie Slenker, Meyer Simon, Partho Bhattacharya, & Scarlett Kadan + +## Lexical Analyzer +* **Undefined Behavior:** + * Spaces are not required between tokens. For instance, an INTEGER and an ID are valid even if there is no space between them +``` +Input: *5variable* +Output: 2 14 301 "5" + 1 1 101 "variable" +``` + +## Syntax Analyzer +* *Incomplete* + +## Symbol Table +* *TODO: Create diagram.* \ No newline at end of file diff --git a/grammar.y b/grammar.y new file mode 100644 index 0000000..4a1c8a4 --- /dev/null +++ b/grammar.y @@ -0,0 +1,18 @@ +/* Syntax Analyzer with Bison (3.8.1) */ +/* (referenced Bison manual for file boilerplate [3.1]) */ + +// Prologue +%{ + #include +%} + +// Declarations + + +// Grammar Rules +%% +semicolon.opt: + %empty +| ";" +; +%% \ No newline at end of file From e86edb324b6ead099ee1b7074ee2665ce6e8e480 Mon Sep 17 00:00:00 2001 From: Meyer Simon Date: Fri, 21 Feb 2025 16:26:37 -0500 Subject: [PATCH 062/105] Fix the conflicts t#29 --- runner.c | 6 +++--- runner.h | 4 ++-- symbol_table.c | 2 ++ test | Bin 16088 -> 0 bytes 4 files changed, 7 insertions(+), 5 deletions(-) delete mode 100755 test diff --git a/runner.c b/runner.c index dd096aa..d183b52 100644 --- a/runner.c +++ b/runner.c @@ -1,4 +1,4 @@ -#include "symbol_table.h" +//#include "symbol_table.h" #include "symbol_table.c" #include "runner.h" @@ -94,7 +94,7 @@ int run(FILE *alpha) { if (yyin != NULL) { fclose(yyin); } - + if (tok_flag != NULL) { fclose(tok_flag); } @@ -139,7 +139,7 @@ int new_file(char *arg, char *alpha) { strcat(file_name, "."); strcat(file_name, arg + 1); - + if (strcmp(arg, "-tok") == 0) { tok_flag = fopen(file_name, "w"); } else if (strcmp(arg, "-st") == 0) { diff --git a/runner.h b/runner.h index e7a8194..73c94f2 100644 --- a/runner.h +++ b/runner.h @@ -20,9 +20,9 @@ int arg; SymbolTable * top; SymbolTable * curr; -int main(int argc, char* argv[]); +// int main(int argc, char* argv[]); char *is_tok(int argc, char* argv[]); -int is_alpha_file(char *file, int file_len); +// int is_alpha_file(char *file, int file_len); void enter_scope(int, int); void exit_scope(void); diff --git a/symbol_table.c b/symbol_table.c index e5d1366..a8592eb 100644 --- a/symbol_table.c +++ b/symbol_table.c @@ -69,6 +69,7 @@ TableNode * look_up(SymbolTable * table, char * x){ //uncomment the below main function along with the headers above for a simple standalone test of table and entry creation +/* int main(){ char* String = "STRING"; char* X = "X"; @@ -79,3 +80,4 @@ int main(){ printf("The type of the first entry is %s\n",First_Entry->theType); return 0; } + */ diff --git a/test b/test deleted file mode 100755 index 4941bf240c8f2f1ec1cf50ca112b79be646ae11c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16088 zcmeHOZ)_Y#6(2iI>d+*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a1HaaACcZ~sEGc}E2S*)}h;zv6FV(|1u7l#qz0ud<)Cv{s5~>7d~s$ z8Wo8dUdE4hS=Xo=l+1UdRq6p$s9m|=ME+H6zpA{SU*wOYQZ4@Z`t>92XQleydhswv ztND3W+ux{y04VJr6m>AGCiNa;wsX<}O0Mp^AKQE#(>C0)hKN9qP|{&Cx9Oy2tyHju$_o zAjo@#fq`hhn%fuecxk7fcE;ynnaDavQrW(E%1LF;DQAnpp0P%4SEWHZT{7AYln?iWlmXEj`r}N;heH~86{&olZ z^4ss)ziVGt8^kys;dI!nwc8IWXV2aPyLat%4s>=N>gaKLcJ1EV0Yvb)Kuk^tT;)VS zTh5JpZU_BrsT?;E_u@+Ti;o+W-OwQeNU@4yUZ*i#tK3rWOGN7`+@k#J`g_m0$+}9MldZpe z2n?-da69WV-+3-pm)B>)Z$rh851#9y-^2Yyo{J)*?@K>kzORK^V#qXz|1{)pVJ#%_ z%X(3$v@d5)Wc?*>!6gt6%6eHzM@UpH;LPkpr!OQwosH{g}qDwIUpM#Xv zdV-hroltqaO8jCc^g-Zh?I^sgAB8rVW_6DJ@v~T+K!tKDcv;U1onS+0KiL0oF@87O z$@;iVeR#@Q5dVG1C@%3|{yyQ3%XCqb-9_x1Nd$>5GwZb z;l~5`!we8=36QDy6Z(??ev}nLFUr6K@Zy&C7W(@y>mH%~iO z3ta@TAFpC;+GMD-BMt;7JpIQ>GHGAdg%QRF?Wrw)Sn x*x?f#*axAcrL4pw&tH1ali2 Date: Fri, 21 Feb 2025 16:28:53 -0500 Subject: [PATCH 063/105] switched -st to call print_symbol_table --- runner.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runner.c b/runner.c index 85e8214..4560da4 100644 --- a/runner.c +++ b/runner.c @@ -84,7 +84,7 @@ int run(FILE *alpha) { if (st_flag != NULL) { //output symbol table, file pointer is - fprintf(st_flag, "just checking that this works \n"); + print_symbol_table(curr,st_flag); } if (yyin != NULL) { From 6c72120785505bf4d6270d96d8c7745a70161e4b Mon Sep 17 00:00:00 2001 From: Meyer Simon Date: Sun, 23 Feb 2025 11:38:55 -0500 Subject: [PATCH 064/105] added the prototypes for lookups to the h file t#29 --- symbol_table.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/symbol_table.h b/symbol_table.h index 4830345..e2372a0 100644 --- a/symbol_table.h +++ b/symbol_table.h @@ -27,3 +27,5 @@ typedef struct SymbolTable{ TableNode* CreateEntry(SymbolTable* table, char* typeOf, char* id); SymbolTable* CreateScope(SymbolTable* ParentScope, int Line, int Column); +TableNode * table_lookup(SymbolTable * table, char * x); +TableNode * look_up(SymbolTable * table, char * x); From d790d5fdefb5ea277aee6b397c5f0bbad11808d1 Mon Sep 17 00:00:00 2001 From: Meyer Simon Date: Sun, 23 Feb 2025 12:06:37 -0500 Subject: [PATCH 065/105] Made some changes to the files t#29 --- print_symbol_table.c | 98 -------------------------------------------- symbol_table.c | 43 +++++++++++++++++++ symbol_table.h | 1 + test.c | 74 +++++++++++++++++++++++++++++++++ 4 files changed, 118 insertions(+), 98 deletions(-) delete mode 100644 print_symbol_table.c create mode 100644 test.c diff --git a/print_symbol_table.c b/print_symbol_table.c deleted file mode 100644 index c5e4208..0000000 --- a/print_symbol_table.c +++ /dev/null @@ -1,98 +0,0 @@ -#include -#include "symbol_table.h" -#include "symbol_table.c" -#include - -void print_symbol_table(SymbolTable *table, FILE *file_ptr){ - if(table->Parent_Scope == NULL){ - fprintf(file_ptr, "%-17s: %-6s : %-6s : %-21s: %-28s\n", "NAME", "SCOPE", "PARENT", "TYPE", "Extra annotation"); - } - TableNode * entrie = table->entries; - fprintf(file_ptr, "-----------------:--------:--------:----------------------:-----------------------------\n"); - int parant_scope = 0; - int current_scope = 0; - if(table->Parent_Scope != NULL){ - parant_scope = table->Parent_Scope->Line_Number*1000 + table->Parent_Scope->Column_Number; - current_scope = table->Line_Number*1000 + table->Column_Number; - } else { - current_scope = 1001; - } - - for(; entrie != NULL; entrie = entrie->next){ - if (parant_scope == 0){ - fprintf(file_ptr, "%-17s: %06d : : %-21s: %-28s\n", - entrie->theName, current_scope, - entrie->theType, "Extra annotation"); - } else { - fprintf(file_ptr, "%-17s: %06d : %06d : %-21s: %-28s\n", - entrie->theName, current_scope, parant_scope, - entrie->theType, "Extra annotation"); - } - } - if (table->Children_Scope != NULL){ - ListOfTable* node = table->Children_Scope; - for(; node != NULL; node = node->next){ - print_symbol_table(node->table, file_ptr); - } - } - if (table->Parent_Scope == NULL) { - fprintf(file_ptr, "-----------------:--------:--------:----------------------:-----------------------------\n"); - } -} -/* - -int main(void){ - char *prim = strdup("primitive"); - char *inte = strdup("integer"); - SymbolTable * parant = CreateScope(NULL, 1,1); - char *boole = strdup("Boolean"); - char *chare = strdup("character"); - char *str = strdup("string"); - char *arg = strdup("arg"); - // Value* v = calloc(1, sizeof(Value)); - CreateEntry(parant, prim, boole); - CreateEntry(parant, prim, chare); - CreateEntry(parant, prim, inte); - CreateEntry(parant, &"1 -> character", str); - CreateEntry(parant, &"integer -> integer", &"int2int"); - CreateEntry(parant, &"string -> integer", &"string2int"); - CreateEntry(parant, &"int2int", &"square"); - CreateEntry(parant, &"string2int", &"entry"); - SymbolTable * child = CreateScope(parant, 14,14); - CreateEntry(child, inte, &"x"); - SymbolTable * second = CreateScope(parant, 21,15); - CreateEntry(second, str, arg); - CreateEntry(second, inte, &"input"); - CreateEntry(second, inte, &"expected"); - CreateEntry(second, inte, &"actual"); - CreateEntry(second, &"$_undefined_type", &"result"); - SymbolTable * third = CreateScope(second, 33,44); - CreateEntry(third, &"BOO", arg); - CreateEntry(third, &"YAZOO", &"input"); - - TableNode *ret = table_lookup(third, "arg"); - printf("%s == %s\n", ret->theName, "arg"); - - ret = table_lookup(third, "hello"); - printf("This should be nil %p != %s\n", ret, "BOO"); - - ret = look_up(second, "input"); - printf("%s == %s\n", ret->theName, "input"); - - ret = look_up(second, "square"); - printf("%s == %s\n", ret->theName, "square"); - - ret = look_up(second, "spuare"); - printf("This should be nil %p == %s\n", ret, "square"); - - print_symbol_table(parant, stderr); - free(inte); - free(boole); - free(prim); - free(str); - free(chare); - free(arg); - return 0; -} - -*/ diff --git a/symbol_table.c b/symbol_table.c index e5d1366..52ecf2b 100644 --- a/symbol_table.c +++ b/symbol_table.c @@ -1,5 +1,10 @@ //Defining a symbol table //Using a Linked List Structure. Head of linked List points to parent scope (if one exists) +//Tail of Linked List points to a Linked List of all the child scopes +//T +#include +#include +#include //Tail of Linked List points to a List of child scopes @@ -66,9 +71,46 @@ TableNode * look_up(SymbolTable * table, char * x){ } return look_up(table->Parent_Scope, x); } +void print_symbol_table(SymbolTable *table, FILE *file_ptr){ + if(table->Parent_Scope == NULL){ + fprintf(file_ptr, "%-17s: %-6s : %-6s : %-21s: %-28s\n", "NAME", "SCOPE", "PARENT", "TYPE", "Extra annotation"); + } + TableNode * entrie = table->entries; + fprintf(file_ptr, "-----------------:--------:--------:----------------------:-----------------------------\n"); + int parant_scope = 0; + int current_scope = 0; + if(table->Parent_Scope != NULL){ + parant_scope = table->Parent_Scope->Line_Number*1000 + table->Parent_Scope->Column_Number; + current_scope = table->Line_Number*1000 + table->Column_Number; + } else { + current_scope = 1001; + } + + for(; entrie != NULL; entrie = entrie->next){ + if (parant_scope == 0){ + fprintf(file_ptr, "%-17s: %06d : : %-21s: %-28s\n", + entrie->theName, current_scope, + entrie->theType, "Extra annotation"); + } else { + fprintf(file_ptr, "%-17s: %06d : %06d : %-21s: %-28s\n", + entrie->theName, current_scope, parant_scope, + entrie->theType, "Extra annotation"); + } + } + if (table->Children_Scope != NULL){ + ListOfTable* node = table->Children_Scope; + for(; node != NULL; node = node->next){ + print_symbol_table(node->table, file_ptr); + } + } + if (table->Parent_Scope == NULL) { + fprintf(file_ptr, "-----------------:--------:--------:----------------------:-----------------------------\n"); + } +} //uncomment the below main function along with the headers above for a simple standalone test of table and entry creation +/* int main(){ char* String = "STRING"; char* X = "X"; @@ -79,3 +121,4 @@ int main(){ printf("The type of the first entry is %s\n",First_Entry->theType); return 0; } + */ diff --git a/symbol_table.h b/symbol_table.h index e2372a0..57ae1bc 100644 --- a/symbol_table.h +++ b/symbol_table.h @@ -29,3 +29,4 @@ TableNode* CreateEntry(SymbolTable* table, char* typeOf, char* id); SymbolTable* CreateScope(SymbolTable* ParentScope, int Line, int Column); TableNode * table_lookup(SymbolTable * table, char * x); TableNode * look_up(SymbolTable * table, char * x); +void print_symbol_table(SymbolTable *table, FILE *file_ptr); diff --git a/test.c b/test.c new file mode 100644 index 0000000..0d9b343 --- /dev/null +++ b/test.c @@ -0,0 +1,74 @@ +#include +#include +#include "symbol_table.h" + +int main(void){ + char *prim = strdup("primitive"); + char *inte = strdup("integer"); + SymbolTable * parant = CreateScope(NULL, 1,1); + char *boole = strdup("Boolean"); + char *chare = strdup("character"); + char *str = strdup("string"); + char *arg = strdup("arg"); + char *one_to_char = strdup("1 -> character"); + char *int_to_int = strdup("integer -> integer"); + char *int2int = strdup("int2int"); + char *str_to_int = strdup("string -> integer"); + char *str2int = strdup("string2int"); + char *square = strdup("square"); + char *string2int = strdup("string2int"); + char *entry = strdup("entry"); + char *x = strdup("x"); + char *input = strdup("input"); + char *expected = strdup("expected"); + char *actual = strdup("actual"); + char *$_und_type = strdup("$_undefined_type"); + char *result = strdup("result"); + char *BOO = strdup("BOO"); + char *YAZOO = strdup("YAZOO"); + + CreateEntry(parant, prim, boole); + CreateEntry(parant, prim, chare); + CreateEntry(parant, prim, inte); + CreateEntry(parant, one_to_char, str); + CreateEntry(parant, int_to_int, int2int); + CreateEntry(parant, str_to_int, str2int); + CreateEntry(parant, int2int, square); + CreateEntry(parant, string2int, entry); + SymbolTable * child = CreateScope(parant, 14,14); + CreateEntry(child, inte, x); + SymbolTable * second = CreateScope(parant, 21,15); + CreateEntry(second, str, arg); + CreateEntry(second, inte, input); + CreateEntry(second, inte, expected); + CreateEntry(second, inte, actual); + CreateEntry(second, $_und_type, result); + SymbolTable * third = CreateScope(second, 33,44); + CreateEntry(third, BOO, arg); + CreateEntry(third, YAZOO, input); + + TableNode *ret = table_lookup(third, "arg"); + printf("%s == %s\n", ret->theName, "arg"); + + ret = table_lookup(third, "hello"); + printf("This should be nil %p != %s\n", ret, "BOO"); + + ret = look_up(second, "input"); + printf("%s == %s\n", ret->theName, "input"); + + ret = look_up(second, "square"); + printf("%s == %s\n", ret->theName, "square"); + + ret = look_up(second, "spuare"); + printf("This should be nil %p == %s\n", ret, "square"); + + print_symbol_table(parant, stderr); + free(inte); + free(boole); + free(prim); + free(str); + free(chare); + free(arg); + return 0; +} + From d6033e9168ea4de0dea1d3f0fbafcc51179f9df6 Mon Sep 17 00:00:00 2001 From: Meyer Simon Date: Sun, 23 Feb 2025 12:21:28 -0500 Subject: [PATCH 066/105] Removed comments to make symbole table easyer to read. --- symbol_table.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/symbol_table.c b/symbol_table.c index 52ecf2b..e87ebd8 100644 --- a/symbol_table.c +++ b/symbol_table.c @@ -1,14 +1,7 @@ -//Defining a symbol table -//Using a Linked List Structure. Head of linked List points to parent scope (if one exists) -//Tail of Linked List points to a Linked List of all the child scopes -//T #include #include #include -//Tail of Linked List points to a List of child scopes - - #include "symbol_table.h" SymbolTable* CreateScope(SymbolTable* ParentScope, int Line, int Column){ From c1191c888eddd02e3677f1d9c9c782e085917d9e Mon Sep 17 00:00:00 2001 From: Meyer Simon Date: Sun, 23 Feb 2025 13:15:35 -0500 Subject: [PATCH 067/105] fixed issues with the compilation process --- Makefile | 11 +++++++---- runner.c | 7 +------ runner.h | 1 + 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 2f53d61..05aff7a 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ CC := gcc FLEX := flex LEX := lexicalStructure.lex EXE := alpha -CFLAGS := +CFLAGS := compiler: lex.yy.c runner.o runner @@ -12,8 +12,11 @@ lex.yy.c: lexicalStructure.lex runner.o: runner.c runner.h flex.h $(CC) $(CFLAGS) -o runner.o -c runner.c -runner: lex.yy.c runner.o - $(CC) $(CFLAGS) -o $(EXE) runner.o lex.yy.c +symbol.o: symbol_table.c symbol_table.h + $(CC) $(CFLAGS) -o symbol_table.o symbol_table.c + +runner: lex.yy.c runner.o symbol_table.o + $(CC) $(CFLAGS) -o $(EXE) runner.o lex.yy.c symbol_table.o bison: grammar.y bison -d grammar.y @@ -52,4 +55,4 @@ clean: rm -f *.tok rm -f grammar.tab.c rm -f grammar.tab.h - rm -f *.st \ No newline at end of file + rm -f *.st diff --git a/runner.c b/runner.c index ee872f4..93c9991 100644 --- a/runner.c +++ b/runner.c @@ -1,5 +1,4 @@ //#include "symbol_table.h" -#include "symbol_table.c" #include "runner.h" int main(int argc, char *argv[]) { @@ -88,7 +87,7 @@ int run(FILE *alpha) { if (st_flag != NULL) { //output symbol table, file pointer is - print_symbol_table(curr,st_flag); + print_symbol_table(top,st_flag); } if (yyin != NULL) { @@ -166,7 +165,3 @@ void exit_scope() { } curr = curr->Parent_Scope; } - - - - diff --git a/runner.h b/runner.h index 73c94f2..cd5167f 100644 --- a/runner.h +++ b/runner.h @@ -11,6 +11,7 @@ #include "flex.h" #include "typedefs.h" #include +#include "symbol_table.h" extern int line_number, column_number; extern char *yytext; From cf25a1d7a421b2aac2df52bfac1193dad68126df Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Mon, 24 Feb 2025 12:31:48 -0500 Subject: [PATCH 068/105] commented out the call to print function to stop seg fault for now --- runner.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runner.c b/runner.c index 93c9991..56fa776 100644 --- a/runner.c +++ b/runner.c @@ -87,7 +87,7 @@ int run(FILE *alpha) { if (st_flag != NULL) { //output symbol table, file pointer is - print_symbol_table(top,st_flag); + //print_symbol_table(top,st_flag); } if (yyin != NULL) { From 44ddfa41f865ffd2d0c9c6fed03285532cdb3640 Mon Sep 17 00:00:00 2001 From: Scarlett Date: Mon, 24 Feb 2025 15:28:46 -0500 Subject: [PATCH 069/105] Organization + Task 1 objectives t#30 --- .gitignore | 5 ++- Makefile | 36 ++++++++----------- grammar.y | 9 ++++- runner.c | 11 +++++- runner.h | 1 + tests/sprint1/test_comment_fix1.alpha | 1 + tests/sprint1/test_comment_fix2.alpha | 1 + tests/{ => sprint1}/test_comment_issues.alpha | 0 tests/{ => sprint1}/test_comments.alpha | 0 .../test_general_token.alpha} | 0 tests/{ => sprint1}/test_keywords.alpha | 0 tests/{ => sprint1}/test_operators.alpha | 0 .../test_other_punc.alpha} | 0 .../test_punc_grouping.alpha} | 0 .../test_real_alpha_file1.alpha} | 0 .../test_real_alpha_file2.alpha} | 0 .../test_simple_int.alpha} | 0 .../test_simple_literals.alpha} | 0 tests/{ => sprint1}/test_variables.alpha | 0 tests/testPath/testPath.alpha | 23 ------------ tests/test_comment_issues.tok | 0 tests/test_operators.alpha~ | 17 --------- tests/test_wrong_type.txt | 0 23 files changed, 40 insertions(+), 64 deletions(-) create mode 100644 tests/sprint1/test_comment_fix1.alpha create mode 100644 tests/sprint1/test_comment_fix2.alpha rename tests/{ => sprint1}/test_comment_issues.alpha (100%) rename tests/{ => sprint1}/test_comments.alpha (100%) rename tests/{test_generalTokenTest.alpha => sprint1/test_general_token.alpha} (100%) rename tests/{ => sprint1}/test_keywords.alpha (100%) rename tests/{ => sprint1}/test_operators.alpha (100%) rename tests/{test_otherpunc.alpha => sprint1/test_other_punc.alpha} (100%) rename tests/{test_punctuation_grouping.alpha => sprint1/test_punc_grouping.alpha} (100%) rename tests/{test_real_alpha_file.alpha => sprint1/test_real_alpha_file1.alpha} (100%) rename tests/{test_real_alpha_2.alpha => sprint1/test_real_alpha_file2.alpha} (100%) rename tests/{test_simpleIntTest.alpha => sprint1/test_simple_int.alpha} (100%) rename tests/{test_simpleLiterals.alpha => sprint1/test_simple_literals.alpha} (100%) rename tests/{ => sprint1}/test_variables.alpha (100%) delete mode 100644 tests/testPath/testPath.alpha delete mode 100644 tests/test_comment_issues.tok delete mode 100644 tests/test_operators.alpha~ delete mode 100644 tests/test_wrong_type.txt diff --git a/.gitignore b/.gitignore index b927c65..b9f8003 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,7 @@ alpha flex.h grammar.tab.c -grammar.tab.h \ No newline at end of file +grammar.tab.h +.vscode +out +src \ No newline at end of file diff --git a/Makefile b/Makefile index 05aff7a..7ec4e72 100644 --- a/Makefile +++ b/Makefile @@ -25,27 +25,20 @@ debug: CFLAGS += -DDEBUG=1 debug: clean compiler test: - ./$(EXE) ./tests/test_comments.alpha - ./$(EXE) ./tests/test_generalTokenTest.alpha - ./$(EXE) ./tests/test_keywords.alpha - ./$(EXE) ./tests/test_operators.alpha - ./$(EXE) ./tests/test_otherpunc.alpha - ./$(EXE) ./tests/test_simpleIntTest.alpha - ./$(EXE) ./tests/test_simpleLiterals.alpha - ./$(EXE) ./tests/test_real_alpha_file.alpha - ./$(EXE) ./tests/test_real_alpha_2.alpha - ./$(EXE) -tok ./tests/test_comments.alpha - ./$(EXE) -tok ./tests/test_generalTokenTest.alpha - ./$(EXE) -tok ./tests/test_keywords.alpha - ./$(EXE) -tok ./tests/test_operators.alpha - ./$(EXE) -tok ./tests/test_otherpunc.alpha - ./$(EXE) -tok ./tests/test_simpleIntTest.alpha - ./$(EXE) -tok ./tests/test_simpleLiterals.alpha - ./$(EXE) -tok ./tests/test_real_alpha_file.alpha - ./$(EXE) -tok ./tests/test_real_alpha_2.alpha - ./$(EXE) -tok -st ./tests/test_real_alpha_2.alpha - ./$(EXE) -st -tok ./tests/test_operators.alpha - ./$(EXE) -st ./tests/test_keywords.alpha + ./$(EXE) -tok ./tests/sprint1/test_comment_fix1.alpha + ./$(EXE) -tok ./tests/sprint1/test_comment_fix2.alpha + ./$(EXE) -tok ./tests/sprint1/test_comment_issues.alpha + ./$(EXE) -tok ./tests/sprint1/test_comments.alpha + ./$(EXE) -tok ./tests/sprint1/test_general_token.alpha + ./$(EXE) -tok ./tests/sprint1/test_keywords.alpha + ./$(EXE) -tok ./tests/sprint1/test_operators.alpha + ./$(EXE) -tok ./tests/sprint1/test_other_punc.alpha + ./$(EXE) -tok ./tests/sprint1/test_punc_grouping.alpha + ./$(EXE) -tok ./tests/sprint1/test_real_alpha_file1.alpha + ./$(EXE) -tok ./tests/sprint1/test_real_alpha_file2.alpha + ./$(EXE) -tok ./tests/sprint1/test_simple_int.alpha + ./$(EXE) -tok ./tests/sprint1/test_simple_literals.alpha + ./$(EXE) -tok ./tests/sprint1/test_variables.alpha clean: rm -f *.o @@ -56,3 +49,4 @@ clean: rm -f grammar.tab.c rm -f grammar.tab.h rm -f *.st + rm -rf out \ No newline at end of file diff --git a/grammar.y b/grammar.y index 591d80a..c174533 100644 --- a/grammar.y +++ b/grammar.y @@ -52,6 +52,13 @@ %token RESERVE 613 %token RELEASE 614 %token COMMENT 700 -%% +%% + DBLOCK: %empty; + + FUNCTION_DECLARATION: FUNCTION ID COLON ID + | EXTERNAL FUNCTION ID COLON ID + ; + RECORD_DECLARATION: TYPE ID COLON DBLOCK; + ARRAY_DECLARATION: ID ASSIGN RESERVE ID L_PAREN C_INTEGER R_PAREN; %% diff --git a/runner.c b/runner.c index 93c9991..49821f5 100644 --- a/runner.c +++ b/runner.c @@ -87,7 +87,7 @@ int run(FILE *alpha) { if (st_flag != NULL) { //output symbol table, file pointer is - print_symbol_table(top,st_flag); + //print_symbol_table(top,st_flag); } if (yyin != NULL) { @@ -115,10 +115,19 @@ int new_file(char *arg, char *alpha) { int type_len; const char *basename = alpha; const char *slash = strchr(alpha, '/'); + while (slash != NULL) { basename = slash + 1; slash = strchr(basename, '/'); } + + mkdir("./out", 0777); + + char *new_basename = calloc(strlen(basename) + 5, sizeof(char)); + strcpy(new_basename, "./out/"); + strcat(new_basename, basename); + basename = new_basename; + if (strcmp(arg, "-tok") == 0) { type_len = TOK_LEN; } else if (strcmp(arg, "-st") == 0) { diff --git a/runner.h b/runner.h index cd5167f..8c83748 100644 --- a/runner.h +++ b/runner.h @@ -12,6 +12,7 @@ #include "typedefs.h" #include #include "symbol_table.h" +#include extern int line_number, column_number; extern char *yytext; diff --git a/tests/sprint1/test_comment_fix1.alpha b/tests/sprint1/test_comment_fix1.alpha new file mode 100644 index 0000000..910a538 --- /dev/null +++ b/tests/sprint1/test_comment_fix1.alpha @@ -0,0 +1 @@ +(***) \ No newline at end of file diff --git a/tests/sprint1/test_comment_fix2.alpha b/tests/sprint1/test_comment_fix2.alpha new file mode 100644 index 0000000..bd710e9 --- /dev/null +++ b/tests/sprint1/test_comment_fix2.alpha @@ -0,0 +1 @@ +(*(**)*) \ No newline at end of file diff --git a/tests/test_comment_issues.alpha b/tests/sprint1/test_comment_issues.alpha similarity index 100% rename from tests/test_comment_issues.alpha rename to tests/sprint1/test_comment_issues.alpha diff --git a/tests/test_comments.alpha b/tests/sprint1/test_comments.alpha similarity index 100% rename from tests/test_comments.alpha rename to tests/sprint1/test_comments.alpha diff --git a/tests/test_generalTokenTest.alpha b/tests/sprint1/test_general_token.alpha similarity index 100% rename from tests/test_generalTokenTest.alpha rename to tests/sprint1/test_general_token.alpha diff --git a/tests/test_keywords.alpha b/tests/sprint1/test_keywords.alpha similarity index 100% rename from tests/test_keywords.alpha rename to tests/sprint1/test_keywords.alpha diff --git a/tests/test_operators.alpha b/tests/sprint1/test_operators.alpha similarity index 100% rename from tests/test_operators.alpha rename to tests/sprint1/test_operators.alpha diff --git a/tests/test_otherpunc.alpha b/tests/sprint1/test_other_punc.alpha similarity index 100% rename from tests/test_otherpunc.alpha rename to tests/sprint1/test_other_punc.alpha diff --git a/tests/test_punctuation_grouping.alpha b/tests/sprint1/test_punc_grouping.alpha similarity index 100% rename from tests/test_punctuation_grouping.alpha rename to tests/sprint1/test_punc_grouping.alpha diff --git a/tests/test_real_alpha_file.alpha b/tests/sprint1/test_real_alpha_file1.alpha similarity index 100% rename from tests/test_real_alpha_file.alpha rename to tests/sprint1/test_real_alpha_file1.alpha diff --git a/tests/test_real_alpha_2.alpha b/tests/sprint1/test_real_alpha_file2.alpha similarity index 100% rename from tests/test_real_alpha_2.alpha rename to tests/sprint1/test_real_alpha_file2.alpha diff --git a/tests/test_simpleIntTest.alpha b/tests/sprint1/test_simple_int.alpha similarity index 100% rename from tests/test_simpleIntTest.alpha rename to tests/sprint1/test_simple_int.alpha diff --git a/tests/test_simpleLiterals.alpha b/tests/sprint1/test_simple_literals.alpha similarity index 100% rename from tests/test_simpleLiterals.alpha rename to tests/sprint1/test_simple_literals.alpha diff --git a/tests/test_variables.alpha b/tests/sprint1/test_variables.alpha similarity index 100% rename from tests/test_variables.alpha rename to tests/sprint1/test_variables.alpha diff --git a/tests/testPath/testPath.alpha b/tests/testPath/testPath.alpha deleted file mode 100644 index fa713c4..0000000 --- a/tests/testPath/testPath.alpha +++ /dev/null @@ -1,23 +0,0 @@ -This is a test -9combined 7okens -12345 -893247892 -combined'DueToUnknownChar _validtoken __validtoken1 _valid_token2 validToken3_ -true false -null while !wrong if when -else type function -return external as -string _NOte_that_was_not_reserved -([)]{}:;,->"\ -+-*/% -<= -:= -"This is not a valid -String" -"This is a valid String" -!| -.. -(* this is a comment *) -(*Not a comment -$^& -> \ No newline at end of file diff --git a/tests/test_comment_issues.tok b/tests/test_comment_issues.tok deleted file mode 100644 index e69de29..0000000 diff --git a/tests/test_operators.alpha~ b/tests/test_operators.alpha~ deleted file mode 100644 index 84d3edd..0000000 --- a/tests/test_operators.alpha~ +++ /dev/null @@ -1,17 +0,0 @@ -+ -- -* -/ -\ -% -< -> -= -:= -=: -: -= -! -& -| -. diff --git a/tests/test_wrong_type.txt b/tests/test_wrong_type.txt deleted file mode 100644 index e69de29..0000000 From 987a086daecf446b68b316dd074dbaca0aac56dd Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Tue, 25 Feb 2025 01:43:22 -0500 Subject: [PATCH 070/105] added initial block rules --- grammar.y | 7 + lex.yy.c | 2100 +++++++++++++++++++++++++++++++++++++++++++++++++++++ runner | Bin 0 -> 31656 bytes runner.c | 2 +- 4 files changed, 2108 insertions(+), 1 deletion(-) create mode 100644 lex.yy.c create mode 100755 runner diff --git a/grammar.y b/grammar.y index 591d80a..0acc0c9 100644 --- a/grammar.y +++ b/grammar.y @@ -53,5 +53,12 @@ %token RELEASE 614 %token COMMENT 700 %% +B : '{' E '}'; //Braced Expressions can have braces removed to get regular expressions +D : '[' l ']'; //Declaration Lists Brackets can be taken out to get a list of Declarations +E : Maybe_D U; //An expression can start with an optional D followed by an undeclared segment +Maybe_D : D + | ; //Either D or not +l : A ';' l; + | ; //a declaration list can either be empty or be an assignment followed by a semi-colon and another list %% diff --git a/lex.yy.c b/lex.yy.c new file mode 100644 index 0000000..c4dad48 --- /dev/null +++ b/lex.yy.c @@ -0,0 +1,2100 @@ +#line 2 "lex.yy.c" + +#line 4 "lex.yy.c" + +#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 50 +#define YY_END_OF_BUFFER 51 +/* 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[147] = + { 0, + 0, 0, 51, 49, 47, 46, 48, 24, 49, 20, + 25, 49, 36, 37, 18, 16, 30, 17, 27, 19, + 32, 29, 28, 21, 22, 45, 45, 38, 39, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 40, 26, + 41, 0, 34, 0, 0, 0, 0, 31, 32, 23, + 45, 45, 45, 13, 45, 45, 45, 45, 45, 6, + 45, 45, 45, 45, 45, 45, 45, 33, 0, 0, + 0, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 0, 0, 0, + 35, 0, 45, 45, 45, 8, 45, 45, 45, 45, + + 44, 45, 45, 45, 7, 42, 9, 45, 0, 35, + 0, 0, 45, 45, 45, 45, 43, 45, 45, 45, + 45, 45, 5, 0, 45, 45, 45, 45, 45, 45, + 45, 45, 11, 3, 2, 45, 45, 45, 1, 14, + 15, 45, 12, 10, 4, 0 + } ; + +static const YY_CHAR yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 4, 5, 6, 1, 1, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 19, 20, 21, + 22, 23, 1, 1, 24, 25, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 26, 27, 28, 1, 24, 1, 29, 24, 30, 31, + + 32, 33, 34, 35, 36, 24, 24, 37, 24, 38, + 39, 40, 24, 41, 42, 43, 44, 45, 46, 47, + 48, 24, 49, 50, 51, 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[52] = + { 0, + 1, 2, 3, 1, 1, 1, 1, 1, 2, 1, + 1, 1, 1, 1, 1, 1, 1, 4, 1, 1, + 1, 1, 1, 4, 4, 1, 1, 1, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, + 1 + } ; + +static const flex_int16_t yy_base[156] = + { 0, + 0, 0, 203, 204, 204, 204, 204, 204, 46, 204, + 204, 175, 189, 204, 204, 204, 204, 177, 204, 204, + 181, 176, 204, 204, 204, 0, 158, 204, 204, 22, + 161, 18, 25, 23, 151, 162, 22, 158, 204, 204, + 204, 52, 204, 53, 183, 51, 55, 204, 173, 204, + 0, 151, 158, 0, 159, 145, 143, 148, 146, 0, + 140, 145, 34, 149, 136, 139, 142, 204, 63, 165, + 69, 139, 134, 133, 141, 140, 129, 140, 137, 131, + 135, 134, 121, 126, 131, 130, 124, 71, 73, 75, + 204, 81, 128, 127, 129, 0, 116, 124, 112, 120, + + 0, 124, 111, 110, 0, 0, 0, 118, 86, 204, + 88, 90, 120, 106, 117, 108, 0, 109, 112, 101, + 97, 103, 0, 92, 102, 97, 95, 108, 72, 69, + 75, 63, 0, 0, 0, 58, 51, 34, 0, 0, + 0, 27, 0, 0, 0, 204, 104, 108, 58, 112, + 116, 120, 124, 128, 132 + } ; + +static const flex_int16_t yy_def[156] = + { 0, + 146, 1, 146, 146, 146, 146, 146, 146, 147, 146, + 146, 148, 146, 146, 146, 146, 146, 146, 146, 146, + 146, 146, 146, 146, 146, 149, 149, 146, 146, 149, + 149, 149, 149, 149, 149, 149, 149, 149, 146, 146, + 146, 147, 146, 146, 146, 146, 150, 146, 146, 146, + 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, + 149, 149, 149, 149, 149, 149, 149, 146, 150, 151, + 152, 149, 149, 149, 149, 149, 149, 149, 149, 149, + 149, 149, 149, 149, 149, 149, 149, 150, 153, 154, + 146, 152, 149, 149, 149, 149, 149, 149, 149, 149, + + 149, 149, 149, 149, 149, 149, 149, 149, 155, 146, + 153, 154, 149, 149, 149, 149, 149, 149, 149, 149, + 149, 149, 149, 155, 149, 149, 149, 149, 149, 149, + 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, + 149, 149, 149, 149, 149, 0, 146, 146, 146, 146, + 146, 146, 146, 146, 146 + } ; + +static const flex_int16_t yy_nxt[256] = + { 0, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 4, 26, 27, 28, 4, 29, 30, 31, + 26, 32, 33, 26, 26, 34, 26, 35, 26, 26, + 36, 26, 37, 26, 26, 38, 26, 26, 39, 40, + 41, 43, 53, 58, 56, 60, 64, 43, 42, 45, + 61, 51, 65, 54, 57, 70, 71, 145, 59, 66, + 81, 144, 44, 88, 71, 82, 83, 45, 44, 91, + 92, 88, 71, 110, 111, 88, 71, 143, 45, 142, + 42, 110, 92, 45, 141, 42, 70, 89, 146, 111, + + 88, 71, 70, 89, 42, 42, 140, 42, 45, 139, + 138, 45, 69, 69, 69, 69, 70, 70, 70, 70, + 90, 90, 90, 90, 109, 109, 109, 109, 112, 112, + 112, 112, 124, 124, 124, 124, 137, 136, 135, 134, + 133, 132, 131, 130, 129, 128, 127, 126, 125, 123, + 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, + 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, + 98, 97, 96, 95, 94, 93, 89, 87, 86, 85, + 84, 80, 79, 78, 77, 76, 75, 74, 73, 72, + 49, 68, 67, 63, 62, 55, 52, 50, 49, 48, + + 47, 46, 146, 3, 146, 146, 146, 146, 146, 146, + 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, + 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, + 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, + 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, + 146, 146, 146, 146, 146 + } ; + +static const flex_int16_t yy_chk[256] = + { 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, 1, 1, 1, 1, 1, + 1, 9, 30, 33, 32, 34, 37, 42, 44, 46, + 34, 149, 37, 30, 32, 47, 47, 142, 33, 37, + 63, 138, 9, 69, 69, 63, 63, 46, 42, 71, + 71, 88, 88, 89, 89, 90, 90, 137, 46, 136, + 44, 92, 92, 46, 132, 44, 109, 109, 111, 111, + + 112, 112, 124, 124, 147, 147, 131, 147, 148, 130, + 129, 148, 150, 150, 150, 150, 151, 151, 151, 151, + 152, 152, 152, 152, 153, 153, 153, 153, 154, 154, + 154, 154, 155, 155, 155, 155, 128, 127, 126, 125, + 122, 121, 120, 119, 118, 116, 115, 114, 113, 108, + 104, 103, 102, 100, 99, 98, 97, 95, 94, 93, + 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, + 77, 76, 75, 74, 73, 72, 70, 67, 66, 65, + 64, 62, 61, 59, 58, 57, 56, 55, 53, 52, + 49, 45, 38, 36, 35, 31, 27, 22, 21, 18, + + 13, 12, 3, 146, 146, 146, 146, 146, 146, 146, + 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, + 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, + 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, + 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, + 146, 146, 146, 146, 146 + } ; + +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 "lexicalStructure.lex" +/* Lexical Analysis with Flex (1.6.0) We used some of the code from this manual */ +/* so we placed the citation here. */ +/* definitions */ +#line 8 "lexicalStructure.lex" + #include + #include "typedefs.h" + int line_number = 1, column_number = 1; + #ifndef DEBUG + #define DEBUG 0 + #endif +#line 561 "lex.yy.c" +#line 22 "lexicalStructure.lex" + /* char can be a newline, tab, an escaped quote, or anything but a single quote, an actual line break, an actual tab, or a backslash by itself (to prevent confusion from escaped quote */ + /* similar to above, a string Char (SCHAR) is the same as a CHAR except we cannot have double quotes instead of single quotes. Double quotes need to be escaped in Flex unlike single quotes based on documentation */ +#line 565 "lex.yy.c" + +#define INITIAL 0 + +#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 + + static void yyunput ( int c, char *buf_ptr ); + +#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 \ + 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 26 "lexicalStructure.lex" + + +#line 785 "lex.yy.c" + + 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_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 >= 147 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 204 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + 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 28 "lexicalStructure.lex" +{if(DEBUG) {printf( "T_INTEGER: %s (%d)\n", yytext, T_INTEGER);} else {return T_INTEGER;}} + YY_BREAK +case 2: +YY_RULE_SETUP +#line 29 "lexicalStructure.lex" +{if(DEBUG) {printf( "T_ADDRESS: %s (%d)\n", yytext, T_ADDRESS);} else {return T_ADDRESS;}} + YY_BREAK +case 3: +YY_RULE_SETUP +#line 30 "lexicalStructure.lex" +{if(DEBUG) {printf( "T_BOOLEAN: %s (%d)\n", yytext, T_BOOLEAN);} else {return T_BOOLEAN;}} + YY_BREAK +case 4: +YY_RULE_SETUP +#line 31 "lexicalStructure.lex" +{if(DEBUG) {printf( "T_CHARACTER: %s (%d)\n", yytext, T_CHARACTER);} else {return T_CHARACTER;}} + YY_BREAK +case 5: +YY_RULE_SETUP +#line 33 "lexicalStructure.lex" +{if(DEBUG) {printf( "WHILE: %s (%d)\n", yytext, WHILE);} else {return WHILE;}} + YY_BREAK +case 6: +YY_RULE_SETUP +#line 34 "lexicalStructure.lex" +{if(DEBUG) {printf( "IF: %s (%d)\n", yytext, IF);} else {return IF;}} + YY_BREAK +case 7: +YY_RULE_SETUP +#line 35 "lexicalStructure.lex" +{if(DEBUG) {printf( "THEN: %s (%d)\n", yytext, THEN);} else {return THEN;}} + YY_BREAK +case 8: +YY_RULE_SETUP +#line 36 "lexicalStructure.lex" +{if(DEBUG) {printf( "ELSE: %s (%d)\n", yytext, ELSE);} else {return ELSE;}} + YY_BREAK +case 9: +YY_RULE_SETUP +#line 37 "lexicalStructure.lex" +{if(DEBUG) {printf( "TYPE: %s (%d)\n", yytext, TYPE);} else {return TYPE;}} + YY_BREAK +case 10: +YY_RULE_SETUP +#line 38 "lexicalStructure.lex" +{if(DEBUG) {printf( "FUNCTION: %s (%d)\n", yytext, FUNCTION);} else {return FUNCTION;}} + YY_BREAK +case 11: +YY_RULE_SETUP +#line 39 "lexicalStructure.lex" +{if(DEBUG) {printf( "RETURN: %s (%d)\n", yytext, RETURN);} else {return RETURN;}} + YY_BREAK +case 12: +YY_RULE_SETUP +#line 40 "lexicalStructure.lex" +{if(DEBUG) {printf( "EXTERNAL: %s (%d)\n", yytext, EXTERNAL);} else {return EXTERNAL;}} + YY_BREAK +case 13: +YY_RULE_SETUP +#line 41 "lexicalStructure.lex" +{if(DEBUG) {printf( "AS: %s (%d)\n", yytext, AS);} else {return AS;}} + YY_BREAK +case 14: +YY_RULE_SETUP +#line 43 "lexicalStructure.lex" +{if(DEBUG) {printf( "RELEASE: %s (%d)\n", yytext, RELEASE);} else {return RELEASE;}} + YY_BREAK +case 15: +YY_RULE_SETUP +#line 44 "lexicalStructure.lex" +{if(DEBUG) {printf( "RESERVE: %s (%d)\n", yytext, RESERVE);} else {return RESERVE;}} + YY_BREAK +case 16: +YY_RULE_SETUP +#line 46 "lexicalStructure.lex" +{if(DEBUG) {printf( "ADD: %s (%d)\n", yytext, ADD);} else {return ADD;}} + YY_BREAK +case 17: +YY_RULE_SETUP +#line 47 "lexicalStructure.lex" +{if(DEBUG) {printf( "SUB_OR_NEG: %s (%d)\n", yytext, SUB_OR_NEG);} else {return SUB_OR_NEG;}} + YY_BREAK +case 18: +YY_RULE_SETUP +#line 48 "lexicalStructure.lex" +{if(DEBUG) {printf( "MUL: %s (%d)\n", yytext, MUL);} else {return MUL;}} + YY_BREAK +case 19: +YY_RULE_SETUP +#line 49 "lexicalStructure.lex" +{if(DEBUG) {printf( "DIV: %s (%d)\n", yytext, DIV);} else {return DIV;}} + YY_BREAK +case 20: +YY_RULE_SETUP +#line 50 "lexicalStructure.lex" +{if(DEBUG) {printf( "REM: %s (%d)\n", yytext, REM);} else {return REM;}} + YY_BREAK +case 21: +YY_RULE_SETUP +#line 51 "lexicalStructure.lex" +{if(DEBUG) {printf( "LESS_THAN: %s (%d)\n", yytext, LESS_THAN);} else {return LESS_THAN;}} + YY_BREAK +case 22: +YY_RULE_SETUP +#line 52 "lexicalStructure.lex" +{if(DEBUG) {printf( "EQUAL_TO: %s (%d)\n", yytext, EQUAL_TO);} else {return EQUAL_TO;}} + YY_BREAK +case 23: +YY_RULE_SETUP +#line 53 "lexicalStructure.lex" +{if(DEBUG) {printf( "ASSIGN: %s (%d)\n", yytext, ASSIGN);} else {return ASSIGN;}} + YY_BREAK +case 24: +YY_RULE_SETUP +#line 54 "lexicalStructure.lex" +{if(DEBUG) {printf( "NOT: %s (%d)\n", yytext, NOT);} else {return NOT;}} + YY_BREAK +case 25: +YY_RULE_SETUP +#line 55 "lexicalStructure.lex" +{if(DEBUG) {printf( "AND: %s (%d)\n", yytext, AND);} else {return AND;}} + YY_BREAK +case 26: +YY_RULE_SETUP +#line 56 "lexicalStructure.lex" +{if(DEBUG) {printf( "OR: %s (%d)\n", yytext, OR);} else {return OR;}} + YY_BREAK +case 27: +YY_RULE_SETUP +#line 57 "lexicalStructure.lex" +{if(DEBUG) {printf( "DOT: %s (%d)\n", yytext, DOT);} else {return DOT;}} + YY_BREAK +case 28: +YY_RULE_SETUP +#line 59 "lexicalStructure.lex" +{if(DEBUG) {printf( "SEMI_COLON: %s (%d)\n", yytext, SEMI_COLON);} else {return SEMI_COLON;}} + YY_BREAK +case 29: +YY_RULE_SETUP +#line 60 "lexicalStructure.lex" +{if(DEBUG) {printf( "COLON: %s (%d)\n", yytext, COLON);} else {return COLON;}} + YY_BREAK +case 30: +YY_RULE_SETUP +#line 61 "lexicalStructure.lex" +{if(DEBUG) {printf( "COMMA: %s (%d)\n", yytext, COMMA);} else {return COMMA;}} + YY_BREAK +case 31: +YY_RULE_SETUP +#line 62 "lexicalStructure.lex" +{if(DEBUG) {printf( "ARROW: %s (%d)\n", yytext, ARROW);} else {return ARROW;}} + YY_BREAK +case 32: +YY_RULE_SETUP +#line 64 "lexicalStructure.lex" +{if(DEBUG) {printf( "C_INTEGER: %s (%d)\n", yytext, C_INTEGER);} else {return C_INTEGER;}} + YY_BREAK +case 33: +YY_RULE_SETUP +#line 65 "lexicalStructure.lex" +{if(DEBUG) {printf( "C_CHARACTER: %s (%d)\n", yytext, C_CHARACTER);} else {return C_CHARACTER;}} + YY_BREAK +case 34: +YY_RULE_SETUP +#line 66 "lexicalStructure.lex" +{if(DEBUG) {printf( "C_STRING: %s (%d)\n", yytext, C_STRING);} else {return C_STRING;}} + YY_BREAK +case 35: +/* rule 35 can match eol */ +YY_RULE_SETUP +#line 67 "lexicalStructure.lex" +{if(DEBUG) {printf( "COMMENT: %s (%d)\n", yytext, COMMENT);} else {return COMMENT;}} + YY_BREAK +case 36: +YY_RULE_SETUP +#line 69 "lexicalStructure.lex" +{if(DEBUG) {printf( "L_PAREN: %s (%d)\n", yytext, L_PAREN);} else {return L_PAREN;}} + YY_BREAK +case 37: +YY_RULE_SETUP +#line 70 "lexicalStructure.lex" +{if(DEBUG) {printf( "R_PAREN: %s (%d)\n", yytext, R_PAREN);} else {return R_PAREN;}} + YY_BREAK +case 38: +YY_RULE_SETUP +#line 72 "lexicalStructure.lex" +{if(DEBUG) {printf( "L_BRACKET: %s (%d)\n", yytext, L_BRACKET);} else {return L_BRACKET;}} + YY_BREAK +case 39: +YY_RULE_SETUP +#line 73 "lexicalStructure.lex" +{if(DEBUG) {printf( "R_BRACKET: %s (%d)\n", yytext, R_BRACKET);} else {return R_BRACKET;}} + YY_BREAK +case 40: +YY_RULE_SETUP +#line 75 "lexicalStructure.lex" +{if(DEBUG) {printf( "L_BRACE: %s (%d)\n", yytext, L_BRACE);} else {return L_BRACE;}} + YY_BREAK +case 41: +YY_RULE_SETUP +#line 76 "lexicalStructure.lex" +{if(DEBUG) {printf( "R_BRACE: %s (%d)\n", yytext, R_BRACE);} else {return R_BRACE;}} + YY_BREAK +case 42: +YY_RULE_SETUP +#line 78 "lexicalStructure.lex" +{if(DEBUG) {printf( "C_TRUE: %s (%d)\n", yytext, C_TRUE);} else {return C_TRUE;}} + YY_BREAK +case 43: +YY_RULE_SETUP +#line 79 "lexicalStructure.lex" +{if(DEBUG) {printf( "C_FALSE: %s (%d)\n", yytext, C_FALSE);} else {return C_FALSE;}} + YY_BREAK +case 44: +YY_RULE_SETUP +#line 80 "lexicalStructure.lex" +{if(DEBUG) {printf( "C_NULL: %s (%d)\n", yytext, C_NULL);} else {return C_NULL;}} + YY_BREAK +case 45: +YY_RULE_SETUP +#line 82 "lexicalStructure.lex" +{if(DEBUG) {printf( "ID: %s (%d)\n", yytext, ID);} else {return ID;}} + YY_BREAK +case 46: +/* rule 46 can match eol */ +YY_RULE_SETUP +#line 84 "lexicalStructure.lex" +{line_number++; column_number = 1;} + YY_BREAK +case 47: +YY_RULE_SETUP +#line 85 "lexicalStructure.lex" +{column_number++;} + YY_BREAK +case 48: +YY_RULE_SETUP +#line 86 "lexicalStructure.lex" +{column_number++;} + YY_BREAK +case 49: +YY_RULE_SETUP +#line 87 "lexicalStructure.lex" +{column_number++; return 1999;} + YY_BREAK +case 50: +YY_RULE_SETUP +#line 89 "lexicalStructure.lex" +ECHO; + YY_BREAK +#line 1094 "lex.yy.c" +case YY_STATE_EOF(INITIAL): + yyterminate(); + + 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_c_buf_p); + 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); + + 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 >= 147 ) + 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 >= 147 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_is_jam = (yy_current_state == 146); + + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_UNPUT + + static void yyunput (int c, char * yy_bp ) +{ + char *yy_cp; + + yy_cp = (yy_c_buf_p); + + /* undo effects of setting up yytext */ + *yy_cp = (yy_hold_char); + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + int number_to_move = (yy_n_chars) + 2; + char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; +} + +#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); + + 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 89 "lexicalStructure.lex" + + diff --git a/runner b/runner new file mode 100755 index 0000000000000000000000000000000000000000..6fa219f4df413b87ee586177c95df0f39c987b44 GIT binary patch literal 31656 zcmeHw3w%>my6;N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lmD=55;?@Yz9z=G(;*7 z7cZr<$<&4Ftd=lXQW892*@6}opKp0R@8{tNUUP+tAXz@{Ro0}lC0=S}QKXXl#P=_t zLxqDfy@<*pC0OAGO-5~LeOZ?!5#*=bLg2+h z4Wivc^zJQst(HZA71uY^M*PbGBVhrn6vm(RtYgK&P$W>iA{Z^M3*#kUVZ2`}OQLcmB^aPUxMJ-xw;i^+%&yl|k#PYM#NtBJ5; zKC2W1EnX2ql#qH%8O6Ns6!ZRE91ihbUmU2CGh$T*tf`o=A*M#gH54wNv_$4;&?tsa zuwu-~wU}yuzDoE%r_ebzmLfQV5P_Z>qM)EU#}-r}t8jv+;>y9L^y#@G3JR8psPSp6 zPb7u5HD-PLdn!j5ngUVlT1BRFKeN6%cT~`=1SPcVUj{mUYB;3wug>Qcl*>-zeBPda zKlJHrUg@jzdjm=a<&o-H>8o?}YS5_4l)kzjpx{}gWD2$@o&(3rEKK=V=jjTbCv~w* zVCS-py@^LhnU``Pm^&9P=6RHsT`-9J!J?Tb|U_VV8;^=C?h>VAZR>iz}k zQ=QrM?*)zOMA z#T9(qrhkvrS8$oF!IhqZ;+)x3ez`wW`@Q@TDrEtco}&KQmcBZ-Q7}&lN@%aYm!-aH ze^x35CDhf8D@k@ssK6^gsEA5mofj&2rLFw-^xw7V({Hg-P;epkmFA%QN6|h7(g&9u zwv2Os^ zd>AwmQTpospVLRuc>kdQ#;4L(kj|&g`o=lXGNEE0|COFH*c-}3Q|YVy^3>5IrK1{^e>MJ|0Gi6X(2$=s0`4^i Y77 Date: Wed, 26 Feb 2025 11:58:46 -0500 Subject: [PATCH 071/105] added more symbol table functions --- grammar.y | 3 ++- runner.c | 3 ++- symbol_table.c | 31 +++++++++++++++++++++++++++++++ symbol_table.h | 10 +++++----- test_keywords.st | 0 test_operators.st | 0 test_real_alpha_2.st | 0 7 files changed, 40 insertions(+), 7 deletions(-) create mode 100644 test_keywords.st create mode 100644 test_operators.st create mode 100644 test_real_alpha_2.st diff --git a/grammar.y b/grammar.y index 0acc0c9..d930f2a 100644 --- a/grammar.y +++ b/grammar.y @@ -4,6 +4,7 @@ // Prologue %{ #include + #include "symbol_table.c" %} %token ID 101 @@ -53,7 +54,7 @@ %token RELEASE 614 %token COMMENT 700 %% -B : '{' E '}'; //Braced Expressions can have braces removed to get regular expressions +B : '{'{CreateScope(cur,line,column)} E '}'; //Braced Expressions can have braces removed to get regular expressions D : '[' l ']'; //Declaration Lists Brackets can be taken out to get a list of Declarations E : Maybe_D U; //An expression can start with an optional D followed by an undeclared segment Maybe_D : D diff --git a/runner.c b/runner.c index 435cd24..a2be6b6 100644 --- a/runner.c +++ b/runner.c @@ -81,7 +81,8 @@ int run(FILE *alpha) { } if(token == 1999){ printf("On line number %d and column number %d we have an invalid character:%s\n",line_number,column_number,yytext); - return -1;} + //return -1; +} column_number += yyleng; } diff --git a/symbol_table.c b/symbol_table.c index e87ebd8..2a7729f 100644 --- a/symbol_table.c +++ b/symbol_table.c @@ -101,6 +101,37 @@ void print_symbol_table(SymbolTable *table, FILE *file_ptr){ } } +SymbolTable * getParent(SymbolTable* st){ + return st->ParentScope; + } + +ListOfTable * getChildren(SymbolTable* st){ + return st->Children_Scope; + } +SymbolTable * getFirstChild(ListOfTable * lt){ + return lt->table; + } +ListOfTable * getRestOfChildren(ListOfTable * lt){ + return lt->next; + } +TableNode * getFirstEntry(SymbolTable * st){ + return st->entries; + } +TableNode * getNextEntry(TableNode * tn){ + return tn->next; + } +char * getType(TableNode * tn){ + return tn->theType; + } +char * getName(TableNode * tn){ + return tn->theName; + } +int getLine(SymbolTable * st){ + return st->line; + } +int getColumn(SymbolTable *st){ + return st->column; + } //uncomment the below main function along with the headers above for a simple standalone test of table and entry creation /* diff --git a/symbol_table.h b/symbol_table.h index 57ae1bc..0d30f59 100644 --- a/symbol_table.h +++ b/symbol_table.h @@ -17,11 +17,11 @@ typedef struct TableNode{ }TableNode; typedef struct SymbolTable{ - TableNode* entries; - struct SymbolTable* Parent_Scope; - struct ListOfTable* Children_Scope; - int Line_Number; - int Column_Number; + TableNode* entries; + struct SymbolTable* Parent_Scope; + struct ListOfTable* Children_Scope; + int Line_Number; + int Column_Number; }SymbolTable; diff --git a/test_keywords.st b/test_keywords.st new file mode 100644 index 0000000..e69de29 diff --git a/test_operators.st b/test_operators.st new file mode 100644 index 0000000..e69de29 diff --git a/test_real_alpha_2.st b/test_real_alpha_2.st new file mode 100644 index 0000000..e69de29 From 046ccf194b8e75a7e306a68f12f5e59c062a9b14 Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Wed, 26 Feb 2025 12:52:29 -0500 Subject: [PATCH 072/105] edited symbol table functions --- grammar.y | 22 +++++++++++++++------- lex.yy.c | 11 +++++------ symbol_table.c | 6 +++--- test_keywords.st | 0 test_operators.st | 0 test_real_alpha_2.st | 0 6 files changed, 23 insertions(+), 16 deletions(-) delete mode 100644 test_keywords.st delete mode 100644 test_operators.st delete mode 100644 test_real_alpha_2.st diff --git a/grammar.y b/grammar.y index d930f2a..172058c 100644 --- a/grammar.y +++ b/grammar.y @@ -54,12 +54,20 @@ %token RELEASE 614 %token COMMENT 700 %% -B : '{'{CreateScope(cur,line,column)} E '}'; //Braced Expressions can have braces removed to get regular expressions -D : '[' l ']'; //Declaration Lists Brackets can be taken out to get a list of Declarations -E : Maybe_D U; //An expression can start with an optional D followed by an undeclared segment -Maybe_D : D - | ; //Either D or not -l : A ';' l; - | ; //a declaration list can either be empty or be an assignment followed by a semi-colon and another list + +start: /*empty for now*/ + ; +// B : '{'{CreateScope(cur,line,column)} E '}'; //Braced Expressions can have braces removed to get regular expressions +// D : '[' l ']'; //Declaration Lists Brackets can be taken out to get a list of Declarations +// E : Maybe_D U; //An expression can start with an optional D followed by an undeclared segment +// Maybe_D : D +// | ; //Either D or not +//l : A ';' l; +// | ; //a declaration list can either be empty or be an assignment followed by a semi-colon and another list %% + +int main() { + return yyparse(); +} + diff --git a/lex.yy.c b/lex.yy.c index c4dad48..49b4eed 100644 --- a/lex.yy.c +++ b/lex.yy.c @@ -1,6 +1,5 @@ -#line 2 "lex.yy.c" -#line 4 "lex.yy.c" +#line 3 "lex.yy.c" #define YY_INT_ALIGNED short int @@ -557,11 +556,11 @@ char *yytext; #ifndef DEBUG #define DEBUG 0 #endif -#line 561 "lex.yy.c" +#line 560 "lex.yy.c" #line 22 "lexicalStructure.lex" /* char can be a newline, tab, an escaped quote, or anything but a single quote, an actual line break, an actual tab, or a backslash by itself (to prevent confusion from escaped quote */ /* similar to above, a string Char (SCHAR) is the same as a CHAR except we cannot have double quotes instead of single quotes. Double quotes need to be escaped in Flex unlike single quotes based on documentation */ -#line 565 "lex.yy.c" +#line 564 "lex.yy.c" #define INITIAL 0 @@ -781,7 +780,7 @@ YY_DECL #line 26 "lexicalStructure.lex" -#line 785 "lex.yy.c" +#line 784 "lex.yy.c" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { @@ -1090,7 +1089,7 @@ YY_RULE_SETUP #line 89 "lexicalStructure.lex" ECHO; YY_BREAK -#line 1094 "lex.yy.c" +#line 1093 "lex.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); diff --git a/symbol_table.c b/symbol_table.c index 2a7729f..11ba544 100644 --- a/symbol_table.c +++ b/symbol_table.c @@ -102,7 +102,7 @@ void print_symbol_table(SymbolTable *table, FILE *file_ptr){ } SymbolTable * getParent(SymbolTable* st){ - return st->ParentScope; + return st->Parent_Scope; } ListOfTable * getChildren(SymbolTable* st){ @@ -127,10 +127,10 @@ char * getName(TableNode * tn){ return tn->theName; } int getLine(SymbolTable * st){ - return st->line; + return st->Line_Number; } int getColumn(SymbolTable *st){ - return st->column; + return st->Column_Number; } //uncomment the below main function along with the headers above for a simple standalone test of table and entry creation diff --git a/test_keywords.st b/test_keywords.st deleted file mode 100644 index e69de29..0000000 diff --git a/test_operators.st b/test_operators.st deleted file mode 100644 index e69de29..0000000 diff --git a/test_real_alpha_2.st b/test_real_alpha_2.st deleted file mode 100644 index e69de29..0000000 From 3ce8cbae59a3d6568f36ad2cbfbf7eed2f8c26f1 Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Wed, 26 Feb 2025 15:57:08 -0500 Subject: [PATCH 073/105] Parser compiles from .y and .lex files --- grammar.y | 10 +- lex.yy.c | 2099 ------------------------------------------ lexicalStructure.lex | 1 + parser | Bin 0 -> 36568 bytes 4 files changed, 8 insertions(+), 2102 deletions(-) delete mode 100644 lex.yy.c create mode 100755 parser diff --git a/grammar.y b/grammar.y index 172058c..2bd520d 100644 --- a/grammar.y +++ b/grammar.y @@ -5,8 +5,10 @@ %{ #include #include "symbol_table.c" + extern int yylex(void); + void yyerror(const char *err); %} - +/* %token ID 101 %token T_INTEGER 201 %token T_ADDRESS 202 @@ -52,7 +54,7 @@ %token DOT 612 %token RESERVE 613 %token RELEASE 614 -%token COMMENT 700 +%token COMMENT 700 */ %% start: /*empty for now*/ @@ -67,7 +69,9 @@ start: /*empty for now*/ %% +void yyerror(const char *err) { + fprintf(stderr, "Error: %s\n", err); +} int main() { return yyparse(); } - diff --git a/lex.yy.c b/lex.yy.c deleted file mode 100644 index 49b4eed..0000000 --- a/lex.yy.c +++ /dev/null @@ -1,2099 +0,0 @@ - -#line 3 "lex.yy.c" - -#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 50 -#define YY_END_OF_BUFFER 51 -/* 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[147] = - { 0, - 0, 0, 51, 49, 47, 46, 48, 24, 49, 20, - 25, 49, 36, 37, 18, 16, 30, 17, 27, 19, - 32, 29, 28, 21, 22, 45, 45, 38, 39, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 40, 26, - 41, 0, 34, 0, 0, 0, 0, 31, 32, 23, - 45, 45, 45, 13, 45, 45, 45, 45, 45, 6, - 45, 45, 45, 45, 45, 45, 45, 33, 0, 0, - 0, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 0, 0, 0, - 35, 0, 45, 45, 45, 8, 45, 45, 45, 45, - - 44, 45, 45, 45, 7, 42, 9, 45, 0, 35, - 0, 0, 45, 45, 45, 45, 43, 45, 45, 45, - 45, 45, 5, 0, 45, 45, 45, 45, 45, 45, - 45, 45, 11, 3, 2, 45, 45, 45, 1, 14, - 15, 45, 12, 10, 4, 0 - } ; - -static const YY_CHAR yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 4, 5, 6, 1, 1, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 19, 20, 21, - 22, 23, 1, 1, 24, 25, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 26, 27, 28, 1, 24, 1, 29, 24, 30, 31, - - 32, 33, 34, 35, 36, 24, 24, 37, 24, 38, - 39, 40, 24, 41, 42, 43, 44, 45, 46, 47, - 48, 24, 49, 50, 51, 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[52] = - { 0, - 1, 2, 3, 1, 1, 1, 1, 1, 2, 1, - 1, 1, 1, 1, 1, 1, 1, 4, 1, 1, - 1, 1, 1, 4, 4, 1, 1, 1, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1 - } ; - -static const flex_int16_t yy_base[156] = - { 0, - 0, 0, 203, 204, 204, 204, 204, 204, 46, 204, - 204, 175, 189, 204, 204, 204, 204, 177, 204, 204, - 181, 176, 204, 204, 204, 0, 158, 204, 204, 22, - 161, 18, 25, 23, 151, 162, 22, 158, 204, 204, - 204, 52, 204, 53, 183, 51, 55, 204, 173, 204, - 0, 151, 158, 0, 159, 145, 143, 148, 146, 0, - 140, 145, 34, 149, 136, 139, 142, 204, 63, 165, - 69, 139, 134, 133, 141, 140, 129, 140, 137, 131, - 135, 134, 121, 126, 131, 130, 124, 71, 73, 75, - 204, 81, 128, 127, 129, 0, 116, 124, 112, 120, - - 0, 124, 111, 110, 0, 0, 0, 118, 86, 204, - 88, 90, 120, 106, 117, 108, 0, 109, 112, 101, - 97, 103, 0, 92, 102, 97, 95, 108, 72, 69, - 75, 63, 0, 0, 0, 58, 51, 34, 0, 0, - 0, 27, 0, 0, 0, 204, 104, 108, 58, 112, - 116, 120, 124, 128, 132 - } ; - -static const flex_int16_t yy_def[156] = - { 0, - 146, 1, 146, 146, 146, 146, 146, 146, 147, 146, - 146, 148, 146, 146, 146, 146, 146, 146, 146, 146, - 146, 146, 146, 146, 146, 149, 149, 146, 146, 149, - 149, 149, 149, 149, 149, 149, 149, 149, 146, 146, - 146, 147, 146, 146, 146, 146, 150, 146, 146, 146, - 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, - 149, 149, 149, 149, 149, 149, 149, 146, 150, 151, - 152, 149, 149, 149, 149, 149, 149, 149, 149, 149, - 149, 149, 149, 149, 149, 149, 149, 150, 153, 154, - 146, 152, 149, 149, 149, 149, 149, 149, 149, 149, - - 149, 149, 149, 149, 149, 149, 149, 149, 155, 146, - 153, 154, 149, 149, 149, 149, 149, 149, 149, 149, - 149, 149, 149, 155, 149, 149, 149, 149, 149, 149, - 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, - 149, 149, 149, 149, 149, 0, 146, 146, 146, 146, - 146, 146, 146, 146, 146 - } ; - -static const flex_int16_t yy_nxt[256] = - { 0, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 4, 26, 27, 28, 4, 29, 30, 31, - 26, 32, 33, 26, 26, 34, 26, 35, 26, 26, - 36, 26, 37, 26, 26, 38, 26, 26, 39, 40, - 41, 43, 53, 58, 56, 60, 64, 43, 42, 45, - 61, 51, 65, 54, 57, 70, 71, 145, 59, 66, - 81, 144, 44, 88, 71, 82, 83, 45, 44, 91, - 92, 88, 71, 110, 111, 88, 71, 143, 45, 142, - 42, 110, 92, 45, 141, 42, 70, 89, 146, 111, - - 88, 71, 70, 89, 42, 42, 140, 42, 45, 139, - 138, 45, 69, 69, 69, 69, 70, 70, 70, 70, - 90, 90, 90, 90, 109, 109, 109, 109, 112, 112, - 112, 112, 124, 124, 124, 124, 137, 136, 135, 134, - 133, 132, 131, 130, 129, 128, 127, 126, 125, 123, - 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, - 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, - 98, 97, 96, 95, 94, 93, 89, 87, 86, 85, - 84, 80, 79, 78, 77, 76, 75, 74, 73, 72, - 49, 68, 67, 63, 62, 55, 52, 50, 49, 48, - - 47, 46, 146, 3, 146, 146, 146, 146, 146, 146, - 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, - 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, - 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, - 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, - 146, 146, 146, 146, 146 - } ; - -static const flex_int16_t yy_chk[256] = - { 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, 1, 1, 1, 1, 1, - 1, 9, 30, 33, 32, 34, 37, 42, 44, 46, - 34, 149, 37, 30, 32, 47, 47, 142, 33, 37, - 63, 138, 9, 69, 69, 63, 63, 46, 42, 71, - 71, 88, 88, 89, 89, 90, 90, 137, 46, 136, - 44, 92, 92, 46, 132, 44, 109, 109, 111, 111, - - 112, 112, 124, 124, 147, 147, 131, 147, 148, 130, - 129, 148, 150, 150, 150, 150, 151, 151, 151, 151, - 152, 152, 152, 152, 153, 153, 153, 153, 154, 154, - 154, 154, 155, 155, 155, 155, 128, 127, 126, 125, - 122, 121, 120, 119, 118, 116, 115, 114, 113, 108, - 104, 103, 102, 100, 99, 98, 97, 95, 94, 93, - 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, - 77, 76, 75, 74, 73, 72, 70, 67, 66, 65, - 64, 62, 61, 59, 58, 57, 56, 55, 53, 52, - 49, 45, 38, 36, 35, 31, 27, 22, 21, 18, - - 13, 12, 3, 146, 146, 146, 146, 146, 146, 146, - 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, - 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, - 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, - 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, - 146, 146, 146, 146, 146 - } ; - -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 "lexicalStructure.lex" -/* Lexical Analysis with Flex (1.6.0) We used some of the code from this manual */ -/* so we placed the citation here. */ -/* definitions */ -#line 8 "lexicalStructure.lex" - #include - #include "typedefs.h" - int line_number = 1, column_number = 1; - #ifndef DEBUG - #define DEBUG 0 - #endif -#line 560 "lex.yy.c" -#line 22 "lexicalStructure.lex" - /* char can be a newline, tab, an escaped quote, or anything but a single quote, an actual line break, an actual tab, or a backslash by itself (to prevent confusion from escaped quote */ - /* similar to above, a string Char (SCHAR) is the same as a CHAR except we cannot have double quotes instead of single quotes. Double quotes need to be escaped in Flex unlike single quotes based on documentation */ -#line 564 "lex.yy.c" - -#define INITIAL 0 - -#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 - - static void yyunput ( int c, char *buf_ptr ); - -#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 \ - 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 26 "lexicalStructure.lex" - - -#line 784 "lex.yy.c" - - 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_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 >= 147 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 204 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - 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 28 "lexicalStructure.lex" -{if(DEBUG) {printf( "T_INTEGER: %s (%d)\n", yytext, T_INTEGER);} else {return T_INTEGER;}} - YY_BREAK -case 2: -YY_RULE_SETUP -#line 29 "lexicalStructure.lex" -{if(DEBUG) {printf( "T_ADDRESS: %s (%d)\n", yytext, T_ADDRESS);} else {return T_ADDRESS;}} - YY_BREAK -case 3: -YY_RULE_SETUP -#line 30 "lexicalStructure.lex" -{if(DEBUG) {printf( "T_BOOLEAN: %s (%d)\n", yytext, T_BOOLEAN);} else {return T_BOOLEAN;}} - YY_BREAK -case 4: -YY_RULE_SETUP -#line 31 "lexicalStructure.lex" -{if(DEBUG) {printf( "T_CHARACTER: %s (%d)\n", yytext, T_CHARACTER);} else {return T_CHARACTER;}} - YY_BREAK -case 5: -YY_RULE_SETUP -#line 33 "lexicalStructure.lex" -{if(DEBUG) {printf( "WHILE: %s (%d)\n", yytext, WHILE);} else {return WHILE;}} - YY_BREAK -case 6: -YY_RULE_SETUP -#line 34 "lexicalStructure.lex" -{if(DEBUG) {printf( "IF: %s (%d)\n", yytext, IF);} else {return IF;}} - YY_BREAK -case 7: -YY_RULE_SETUP -#line 35 "lexicalStructure.lex" -{if(DEBUG) {printf( "THEN: %s (%d)\n", yytext, THEN);} else {return THEN;}} - YY_BREAK -case 8: -YY_RULE_SETUP -#line 36 "lexicalStructure.lex" -{if(DEBUG) {printf( "ELSE: %s (%d)\n", yytext, ELSE);} else {return ELSE;}} - YY_BREAK -case 9: -YY_RULE_SETUP -#line 37 "lexicalStructure.lex" -{if(DEBUG) {printf( "TYPE: %s (%d)\n", yytext, TYPE);} else {return TYPE;}} - YY_BREAK -case 10: -YY_RULE_SETUP -#line 38 "lexicalStructure.lex" -{if(DEBUG) {printf( "FUNCTION: %s (%d)\n", yytext, FUNCTION);} else {return FUNCTION;}} - YY_BREAK -case 11: -YY_RULE_SETUP -#line 39 "lexicalStructure.lex" -{if(DEBUG) {printf( "RETURN: %s (%d)\n", yytext, RETURN);} else {return RETURN;}} - YY_BREAK -case 12: -YY_RULE_SETUP -#line 40 "lexicalStructure.lex" -{if(DEBUG) {printf( "EXTERNAL: %s (%d)\n", yytext, EXTERNAL);} else {return EXTERNAL;}} - YY_BREAK -case 13: -YY_RULE_SETUP -#line 41 "lexicalStructure.lex" -{if(DEBUG) {printf( "AS: %s (%d)\n", yytext, AS);} else {return AS;}} - YY_BREAK -case 14: -YY_RULE_SETUP -#line 43 "lexicalStructure.lex" -{if(DEBUG) {printf( "RELEASE: %s (%d)\n", yytext, RELEASE);} else {return RELEASE;}} - YY_BREAK -case 15: -YY_RULE_SETUP -#line 44 "lexicalStructure.lex" -{if(DEBUG) {printf( "RESERVE: %s (%d)\n", yytext, RESERVE);} else {return RESERVE;}} - YY_BREAK -case 16: -YY_RULE_SETUP -#line 46 "lexicalStructure.lex" -{if(DEBUG) {printf( "ADD: %s (%d)\n", yytext, ADD);} else {return ADD;}} - YY_BREAK -case 17: -YY_RULE_SETUP -#line 47 "lexicalStructure.lex" -{if(DEBUG) {printf( "SUB_OR_NEG: %s (%d)\n", yytext, SUB_OR_NEG);} else {return SUB_OR_NEG;}} - YY_BREAK -case 18: -YY_RULE_SETUP -#line 48 "lexicalStructure.lex" -{if(DEBUG) {printf( "MUL: %s (%d)\n", yytext, MUL);} else {return MUL;}} - YY_BREAK -case 19: -YY_RULE_SETUP -#line 49 "lexicalStructure.lex" -{if(DEBUG) {printf( "DIV: %s (%d)\n", yytext, DIV);} else {return DIV;}} - YY_BREAK -case 20: -YY_RULE_SETUP -#line 50 "lexicalStructure.lex" -{if(DEBUG) {printf( "REM: %s (%d)\n", yytext, REM);} else {return REM;}} - YY_BREAK -case 21: -YY_RULE_SETUP -#line 51 "lexicalStructure.lex" -{if(DEBUG) {printf( "LESS_THAN: %s (%d)\n", yytext, LESS_THAN);} else {return LESS_THAN;}} - YY_BREAK -case 22: -YY_RULE_SETUP -#line 52 "lexicalStructure.lex" -{if(DEBUG) {printf( "EQUAL_TO: %s (%d)\n", yytext, EQUAL_TO);} else {return EQUAL_TO;}} - YY_BREAK -case 23: -YY_RULE_SETUP -#line 53 "lexicalStructure.lex" -{if(DEBUG) {printf( "ASSIGN: %s (%d)\n", yytext, ASSIGN);} else {return ASSIGN;}} - YY_BREAK -case 24: -YY_RULE_SETUP -#line 54 "lexicalStructure.lex" -{if(DEBUG) {printf( "NOT: %s (%d)\n", yytext, NOT);} else {return NOT;}} - YY_BREAK -case 25: -YY_RULE_SETUP -#line 55 "lexicalStructure.lex" -{if(DEBUG) {printf( "AND: %s (%d)\n", yytext, AND);} else {return AND;}} - YY_BREAK -case 26: -YY_RULE_SETUP -#line 56 "lexicalStructure.lex" -{if(DEBUG) {printf( "OR: %s (%d)\n", yytext, OR);} else {return OR;}} - YY_BREAK -case 27: -YY_RULE_SETUP -#line 57 "lexicalStructure.lex" -{if(DEBUG) {printf( "DOT: %s (%d)\n", yytext, DOT);} else {return DOT;}} - YY_BREAK -case 28: -YY_RULE_SETUP -#line 59 "lexicalStructure.lex" -{if(DEBUG) {printf( "SEMI_COLON: %s (%d)\n", yytext, SEMI_COLON);} else {return SEMI_COLON;}} - YY_BREAK -case 29: -YY_RULE_SETUP -#line 60 "lexicalStructure.lex" -{if(DEBUG) {printf( "COLON: %s (%d)\n", yytext, COLON);} else {return COLON;}} - YY_BREAK -case 30: -YY_RULE_SETUP -#line 61 "lexicalStructure.lex" -{if(DEBUG) {printf( "COMMA: %s (%d)\n", yytext, COMMA);} else {return COMMA;}} - YY_BREAK -case 31: -YY_RULE_SETUP -#line 62 "lexicalStructure.lex" -{if(DEBUG) {printf( "ARROW: %s (%d)\n", yytext, ARROW);} else {return ARROW;}} - YY_BREAK -case 32: -YY_RULE_SETUP -#line 64 "lexicalStructure.lex" -{if(DEBUG) {printf( "C_INTEGER: %s (%d)\n", yytext, C_INTEGER);} else {return C_INTEGER;}} - YY_BREAK -case 33: -YY_RULE_SETUP -#line 65 "lexicalStructure.lex" -{if(DEBUG) {printf( "C_CHARACTER: %s (%d)\n", yytext, C_CHARACTER);} else {return C_CHARACTER;}} - YY_BREAK -case 34: -YY_RULE_SETUP -#line 66 "lexicalStructure.lex" -{if(DEBUG) {printf( "C_STRING: %s (%d)\n", yytext, C_STRING);} else {return C_STRING;}} - YY_BREAK -case 35: -/* rule 35 can match eol */ -YY_RULE_SETUP -#line 67 "lexicalStructure.lex" -{if(DEBUG) {printf( "COMMENT: %s (%d)\n", yytext, COMMENT);} else {return COMMENT;}} - YY_BREAK -case 36: -YY_RULE_SETUP -#line 69 "lexicalStructure.lex" -{if(DEBUG) {printf( "L_PAREN: %s (%d)\n", yytext, L_PAREN);} else {return L_PAREN;}} - YY_BREAK -case 37: -YY_RULE_SETUP -#line 70 "lexicalStructure.lex" -{if(DEBUG) {printf( "R_PAREN: %s (%d)\n", yytext, R_PAREN);} else {return R_PAREN;}} - YY_BREAK -case 38: -YY_RULE_SETUP -#line 72 "lexicalStructure.lex" -{if(DEBUG) {printf( "L_BRACKET: %s (%d)\n", yytext, L_BRACKET);} else {return L_BRACKET;}} - YY_BREAK -case 39: -YY_RULE_SETUP -#line 73 "lexicalStructure.lex" -{if(DEBUG) {printf( "R_BRACKET: %s (%d)\n", yytext, R_BRACKET);} else {return R_BRACKET;}} - YY_BREAK -case 40: -YY_RULE_SETUP -#line 75 "lexicalStructure.lex" -{if(DEBUG) {printf( "L_BRACE: %s (%d)\n", yytext, L_BRACE);} else {return L_BRACE;}} - YY_BREAK -case 41: -YY_RULE_SETUP -#line 76 "lexicalStructure.lex" -{if(DEBUG) {printf( "R_BRACE: %s (%d)\n", yytext, R_BRACE);} else {return R_BRACE;}} - YY_BREAK -case 42: -YY_RULE_SETUP -#line 78 "lexicalStructure.lex" -{if(DEBUG) {printf( "C_TRUE: %s (%d)\n", yytext, C_TRUE);} else {return C_TRUE;}} - YY_BREAK -case 43: -YY_RULE_SETUP -#line 79 "lexicalStructure.lex" -{if(DEBUG) {printf( "C_FALSE: %s (%d)\n", yytext, C_FALSE);} else {return C_FALSE;}} - YY_BREAK -case 44: -YY_RULE_SETUP -#line 80 "lexicalStructure.lex" -{if(DEBUG) {printf( "C_NULL: %s (%d)\n", yytext, C_NULL);} else {return C_NULL;}} - YY_BREAK -case 45: -YY_RULE_SETUP -#line 82 "lexicalStructure.lex" -{if(DEBUG) {printf( "ID: %s (%d)\n", yytext, ID);} else {return ID;}} - YY_BREAK -case 46: -/* rule 46 can match eol */ -YY_RULE_SETUP -#line 84 "lexicalStructure.lex" -{line_number++; column_number = 1;} - YY_BREAK -case 47: -YY_RULE_SETUP -#line 85 "lexicalStructure.lex" -{column_number++;} - YY_BREAK -case 48: -YY_RULE_SETUP -#line 86 "lexicalStructure.lex" -{column_number++;} - YY_BREAK -case 49: -YY_RULE_SETUP -#line 87 "lexicalStructure.lex" -{column_number++; return 1999;} - YY_BREAK -case 50: -YY_RULE_SETUP -#line 89 "lexicalStructure.lex" -ECHO; - YY_BREAK -#line 1093 "lex.yy.c" -case YY_STATE_EOF(INITIAL): - yyterminate(); - - 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_c_buf_p); - 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); - - 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 >= 147 ) - 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 >= 147 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - yy_is_jam = (yy_current_state == 146); - - return yy_is_jam ? 0 : yy_current_state; -} - -#ifndef YY_NO_UNPUT - - static void yyunput (int c, char * yy_bp ) -{ - char *yy_cp; - - yy_cp = (yy_c_buf_p); - - /* undo effects of setting up yytext */ - *yy_cp = (yy_hold_char); - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - int number_to_move = (yy_n_chars) + 2; - char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; -} - -#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); - - 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 89 "lexicalStructure.lex" - - diff --git a/lexicalStructure.lex b/lexicalStructure.lex index 64b2863..f4fb603 100644 --- a/lexicalStructure.lex +++ b/lexicalStructure.lex @@ -7,6 +7,7 @@ %{ #include #include "typedefs.h" + #include "grammar.tab.h" int line_number = 1, column_number = 1; #ifndef DEBUG #define DEBUG 0 diff --git a/parser b/parser new file mode 100755 index 0000000000000000000000000000000000000000..6d64eed3fbcd28afb96fef45560f8a51dc9797bd GIT binary patch literal 36568 zcmeHwd3;pW`S+P57s6%&W-uVjfPicX0Rh9NVHp^dB`k5PI82fWi6)senSsO-2@Vm) zOB8XVS}n9%ZL1Y6Dq5F-Ku}SFMMaBkROmY~)JDJ>sde7(bCx@It_khueSh!o_s5%? z&z(xj&mD$`c@bcT>q zQ1OlYvIU=6;I4}VT|u)R`6i=8@H47o;VJ2tEwcVfkI1B#CH1nTo`S8?5eh1Ql27Q& zl=iGpR*xxY)hm>GRyYSX=}?gJpkvudfByeTe%VrQ!%f1D6&{!MQ&8o%1bXC`|MW$_&7yr>W=*}A#j~z7suhZvko>#el1IbXiNrzG)Wfzx^fKxohYYaP(MAb&OJy;*Mvlcy#72^;w`E0`oYTg1^ld_-0LMV*kR>fVFxVe<`sKA<=*mgR)8O0 zIVn&I>Um{Vr02;;jv$r#+{oSIFY=W#Z)Fi|t|>3_d%;9W@@{eG72e`5@DvrZq6&}S zU&W}9G!#r`^A^mXHQPNQef&fNjbfKY(Fy63n0x;6g>ICy^HhX*$J5r^e^g0dH)@0I@Elo+I!`Nf}SboD@AumdSZ>>E4oS_TPNr= zmYK)7CKEkDi16RAiH-srN2`f$H>ixYndqq|x{7Zazo`$ZL&Y)C)p$xg6~{#HPXu|m zr2Vc)Qy)=Bwu!Fh1maz1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fU36MB!*4OGmh{bgVy0C>;Nb4!W;{rI*@vW2x8|phLj{B5C}RtogVE2`sq` z{YlaFW1&3Mm)p}HsX`kGzulDH`bSOayt@_u3{tw)X!FCis z)cq<2CrUb&*Zi=S-vcV$t5W*vewKopB!kLGzEk>gS&!%W#h$s+SNF#h%(6J#lEnW7 z;8`zo`6(kD>OPaa3^eYyseBZ?4YG9aN~P8PD+RN;HQ{4(`6U_u8A1Ex(fX_VX$q?A zTdV(6{U4P2v!p?Fe@;PlKaccD$LhZwpi#M$edGE;UPq|=mJs2Gwf%nvs#)J5^%Tq? zrsIwE-gwpz>AadEKJF zJxg#DRQH9Iyw!jErM`+Ewcnv&@B*bNpd&WP-a(qGsPxsovVzAg^|$8#CyV~dl_20y zkgiY7hl(FXqkRM_q8xUN`(zm Date: Thu, 27 Feb 2025 14:13:19 -0500 Subject: [PATCH 074/105] testing why grammar does not work --- calc.h | 48 +++++++++++++++++++++++++++++++++++++++++++ grammar.y | 17 +++++++++++---- lexicalStructure.lex | 2 +- parser | Bin 36568 -> 36592 bytes testGrammar.y | 41 ++++++++++++++++++++++++++++++++++++ 5 files changed, 103 insertions(+), 5 deletions(-) create mode 100644 calc.h create mode 100644 testGrammar.y diff --git a/calc.h b/calc.h new file mode 100644 index 0000000..2580e93 --- /dev/null +++ b/calc.h @@ -0,0 +1,48 @@ +/* Function type. */ +typedef double (func_t) (double); +/* Data type for links in the chain of symbols. */ +struct symrec +{ + char *name; /* name of symbol */ + int type; /* type of symbol: either VAR or FUN */ + union + { + double var; /* value of a VAR */ + func_t *fun; /* value of a FUN */ + } value; + struct symrec *next; /* link field */ +}; +typedef struct symrec symrec; + +/* The symbol table: a chain of 'struct symrec'. */ +extern symrec *sym_table; + +symrec *putsym (char const *name, int sym_type); +symrec *getsym (char const *name); +struct init +{ + char const *name; + func_t *fun; +}; +struct init const funs[] = +{ + { "atan", atan }, + { "cos", cos }, + { "exp", exp }, + { "ln", log }, + { "sin", sin }, + { "sqrt", sqrt }, + { 0, 0 }, +}; +/* The symbol table: a chain of 'struct symrec'. */ +symrec *sym_table; +/* Put functions in table. */ +static void +init_table (void) +{ + for (int i = 0; funs[i].name; i++) + { + symrec *ptr = putsym (funs[i].name, FUN); + ptr->value.fun = funs[i].fun; + } +} diff --git a/grammar.y b/grammar.y index 2bd520d..0b31edb 100644 --- a/grammar.y +++ b/grammar.y @@ -8,9 +8,9 @@ extern int yylex(void); void yyerror(const char *err); %} -/* + %token ID 101 -%token T_INTEGER 201 +%token T_INTEGER %token T_ADDRESS 202 %token T_BOOLEAN 203 %token T_CHARACTER 204 @@ -54,10 +54,19 @@ %token DOT 612 %token RESERVE 613 %token RELEASE 614 -%token COMMENT 700 */ +%token COMMENT 700 %% -start: /*empty for now*/ +input: /*empty for now*/ + OPTIONAL; + +OPTIONAL_OPTIONAL: + OPTIONAL + | OPTIONAL_OPTIONAL OPTIONAL {printf("expansion\n");}; + +OPTIONAL: + '[' {printf("success");} + |%empty ; // B : '{'{CreateScope(cur,line,column)} E '}'; //Braced Expressions can have braces removed to get regular expressions // D : '[' l ']'; //Declaration Lists Brackets can be taken out to get a list of Declarations diff --git a/lexicalStructure.lex b/lexicalStructure.lex index f4fb603..3bd0332 100644 --- a/lexicalStructure.lex +++ b/lexicalStructure.lex @@ -6,7 +6,7 @@ %option header-file="flex.h" %{ #include - #include "typedefs.h" + //#include "typedefs.h" #include "grammar.tab.h" int line_number = 1, column_number = 1; #ifndef DEBUG diff --git a/parser b/parser index 6d64eed3fbcd28afb96fef45560f8a51dc9797bd..432a493003aad234aab1cddeee6bf7bfb3b18924 100755 GIT binary patch delta 10389 zcmaJ{3tUuH8o&3#RX}h68HeGG4+K#GTuS;N z1toc&XeXC;#;b~GZ>FbYOIWUP+TRP|IXE*(p`rhh=PcOW1FID;_TO;Ar6P+aQkXFf|3ge=xkNb6#<=pC8|3E*g z?;1z$u0<)HxC2Be(yAV!l5Rxm;caw(z%;o#eGp)=_B3=Ev^zzE<-$roLdyE`Jn5@M zO$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EN%F=G+J64jm3tCDs zcrSXg&@v`HRnXlGuNj86nx7MrG!>T~dzKpffE*zY7a$cI{4hFSXi4*D%Lh*{Bigfu zwqmH@KN284Z}15eQIw)oFQ&0Y$@AU+kHxT&{tP45U-$oHar5WE%Tl=H-XU)OI`|ND z_>wWwKN^ak41NGzDq5qI<Mn;bi zuE|D(OuQknj-Sn;YipC`aTL7HA~({&bt&>fnze4U@_Y`xv@TD%l}R_&<;nXgZM{Xg zmqBCKCr3Va-?)s#!eO!6vuNk~yogQMAnf5UEx`GP`W$_~K1E(i@f%Xot{WkY@sZv% zY*OO6tHiGsR1X?_4sG6GiRfp{l6ykx4DDp9*{&%7=g{D4c? zmk(`oW|%VB4T>j|&cMZeV!N@Lg10&3RNApE#guPMbv~WhHk9hN1<7#~tfh4Pk23e5 z#nEIf#c!{bhn27pw`qAwX%D)fCHuK|M_B>+Rb=?hn /* For printf, etc. */ + #include /* For pow, used in the grammar. */ + #include "calc.h" /* Contains definition of 'symrec'. */ + int yylex (void); + void yyerror (char const *); +%} +%define api.value.type union /* Generate YYSTYPE from these types: */ +%token NUM /* Double precision number. */ +%token VAR FUN /* Symbol table pointer: variable/function. */ +%nterm exp +%precedence '=' +%left '-' '+' +%left '*' '/' +%precedence NEG /* negation--unary minus */ +%right '^' /* exponentiation */ +%% /* The grammar follows. */ +input: + %empty +| input line +; +line: + '\n' +| exp '\n' { printf ("%.10g\n", $1); } +| error '\n' { yyerrok; } +; +exp: + NUM +| VAR { $$ = $1->value.var; } +| VAR '=' exp { $$ = $3; $1->value.var = $3; } +| FUN '(' exp ')' { $$ = $1->value.fun ($3); } +| exp '+' exp { $$ = $1 + $3; } +| exp '-' exp { $$ = $1 - $3; } +| exp '*' exp { $$ = $1 * $3; } +| exp '/' exp { $$ = $1 / $3; } +| '-' exp %prec NEG { $$ = -$2; } +| exp '^' exp { $$ = pow ($1, $3); } +| '(' exp ')' { $$ = $2; } +; +/* End of grammar. */ +%% From c85540afdfbbd7b864c97d94b5e93fbd564869d1 Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Thu, 27 Feb 2025 15:22:02 -0500 Subject: [PATCH 075/105] updated testing for parser --- grammar.y | 16 +- lex.yy.c | 2100 +++++++++++++++++++++++++++++++++++++++++++++++++++++ parser | Bin 36592 -> 36592 bytes 3 files changed, 2108 insertions(+), 8 deletions(-) create mode 100644 lex.yy.c diff --git a/grammar.y b/grammar.y index 0b31edb..2015769 100644 --- a/grammar.y +++ b/grammar.y @@ -7,6 +7,8 @@ #include "symbol_table.c" extern int yylex(void); void yyerror(const char *err); + extern char* yytext; + extern int yychar; %} %token ID 101 @@ -59,15 +61,9 @@ input: /*empty for now*/ OPTIONAL; - -OPTIONAL_OPTIONAL: - OPTIONAL - | OPTIONAL_OPTIONAL OPTIONAL {printf("expansion\n");}; OPTIONAL: - '[' {printf("success");} - |%empty - ; + '[' {printf("success");}; // B : '{'{CreateScope(cur,line,column)} E '}'; //Braced Expressions can have braces removed to get regular expressions // D : '[' l ']'; //Declaration Lists Brackets can be taken out to get a list of Declarations // E : Maybe_D U; //An expression can start with an optional D followed by an undeclared segment @@ -82,5 +78,9 @@ void yyerror(const char *err) { fprintf(stderr, "Error: %s\n", err); } int main() { - return yyparse(); + int a; + while (a = yyparse()){ + printf("%d = a: yytext = %s: yychar = %d\n", a, yytext, yychar); + } + return 0; } diff --git a/lex.yy.c b/lex.yy.c new file mode 100644 index 0000000..dca4c08 --- /dev/null +++ b/lex.yy.c @@ -0,0 +1,2100 @@ + +#line 3 "lex.yy.c" + +#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 50 +#define YY_END_OF_BUFFER 51 +/* 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[147] = + { 0, + 0, 0, 51, 49, 47, 46, 48, 24, 49, 20, + 25, 49, 36, 37, 18, 16, 30, 17, 27, 19, + 32, 29, 28, 21, 22, 45, 45, 38, 39, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 40, 26, + 41, 0, 34, 0, 0, 0, 0, 31, 32, 23, + 45, 45, 45, 13, 45, 45, 45, 45, 45, 6, + 45, 45, 45, 45, 45, 45, 45, 33, 0, 0, + 0, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 0, 0, 0, + 35, 0, 45, 45, 45, 8, 45, 45, 45, 45, + + 44, 45, 45, 45, 7, 42, 9, 45, 0, 35, + 0, 0, 45, 45, 45, 45, 43, 45, 45, 45, + 45, 45, 5, 0, 45, 45, 45, 45, 45, 45, + 45, 45, 11, 3, 2, 45, 45, 45, 1, 14, + 15, 45, 12, 10, 4, 0 + } ; + +static const YY_CHAR yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 4, 5, 6, 1, 1, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 19, 20, 21, + 22, 23, 1, 1, 24, 25, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 26, 27, 28, 1, 24, 1, 29, 24, 30, 31, + + 32, 33, 34, 35, 36, 24, 24, 37, 24, 38, + 39, 40, 24, 41, 42, 43, 44, 45, 46, 47, + 48, 24, 49, 50, 51, 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[52] = + { 0, + 1, 2, 3, 1, 1, 1, 1, 1, 2, 1, + 1, 1, 1, 1, 1, 1, 1, 4, 1, 1, + 1, 1, 1, 4, 4, 1, 1, 1, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, + 1 + } ; + +static const flex_int16_t yy_base[156] = + { 0, + 0, 0, 203, 204, 204, 204, 204, 204, 46, 204, + 204, 175, 189, 204, 204, 204, 204, 177, 204, 204, + 181, 176, 204, 204, 204, 0, 158, 204, 204, 22, + 161, 18, 25, 23, 151, 162, 22, 158, 204, 204, + 204, 52, 204, 53, 183, 51, 55, 204, 173, 204, + 0, 151, 158, 0, 159, 145, 143, 148, 146, 0, + 140, 145, 34, 149, 136, 139, 142, 204, 63, 165, + 69, 139, 134, 133, 141, 140, 129, 140, 137, 131, + 135, 134, 121, 126, 131, 130, 124, 71, 73, 75, + 204, 81, 128, 127, 129, 0, 116, 124, 112, 120, + + 0, 124, 111, 110, 0, 0, 0, 118, 86, 204, + 88, 90, 120, 106, 117, 108, 0, 109, 112, 101, + 97, 103, 0, 92, 102, 97, 95, 108, 72, 69, + 75, 63, 0, 0, 0, 58, 51, 34, 0, 0, + 0, 27, 0, 0, 0, 204, 104, 108, 58, 112, + 116, 120, 124, 128, 132 + } ; + +static const flex_int16_t yy_def[156] = + { 0, + 146, 1, 146, 146, 146, 146, 146, 146, 147, 146, + 146, 148, 146, 146, 146, 146, 146, 146, 146, 146, + 146, 146, 146, 146, 146, 149, 149, 146, 146, 149, + 149, 149, 149, 149, 149, 149, 149, 149, 146, 146, + 146, 147, 146, 146, 146, 146, 150, 146, 146, 146, + 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, + 149, 149, 149, 149, 149, 149, 149, 146, 150, 151, + 152, 149, 149, 149, 149, 149, 149, 149, 149, 149, + 149, 149, 149, 149, 149, 149, 149, 150, 153, 154, + 146, 152, 149, 149, 149, 149, 149, 149, 149, 149, + + 149, 149, 149, 149, 149, 149, 149, 149, 155, 146, + 153, 154, 149, 149, 149, 149, 149, 149, 149, 149, + 149, 149, 149, 155, 149, 149, 149, 149, 149, 149, + 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, + 149, 149, 149, 149, 149, 0, 146, 146, 146, 146, + 146, 146, 146, 146, 146 + } ; + +static const flex_int16_t yy_nxt[256] = + { 0, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 4, 26, 27, 28, 4, 29, 30, 31, + 26, 32, 33, 26, 26, 34, 26, 35, 26, 26, + 36, 26, 37, 26, 26, 38, 26, 26, 39, 40, + 41, 43, 53, 58, 56, 60, 64, 43, 42, 45, + 61, 51, 65, 54, 57, 70, 71, 145, 59, 66, + 81, 144, 44, 88, 71, 82, 83, 45, 44, 91, + 92, 88, 71, 110, 111, 88, 71, 143, 45, 142, + 42, 110, 92, 45, 141, 42, 70, 89, 146, 111, + + 88, 71, 70, 89, 42, 42, 140, 42, 45, 139, + 138, 45, 69, 69, 69, 69, 70, 70, 70, 70, + 90, 90, 90, 90, 109, 109, 109, 109, 112, 112, + 112, 112, 124, 124, 124, 124, 137, 136, 135, 134, + 133, 132, 131, 130, 129, 128, 127, 126, 125, 123, + 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, + 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, + 98, 97, 96, 95, 94, 93, 89, 87, 86, 85, + 84, 80, 79, 78, 77, 76, 75, 74, 73, 72, + 49, 68, 67, 63, 62, 55, 52, 50, 49, 48, + + 47, 46, 146, 3, 146, 146, 146, 146, 146, 146, + 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, + 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, + 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, + 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, + 146, 146, 146, 146, 146 + } ; + +static const flex_int16_t yy_chk[256] = + { 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, 1, 1, 1, 1, 1, + 1, 9, 30, 33, 32, 34, 37, 42, 44, 46, + 34, 149, 37, 30, 32, 47, 47, 142, 33, 37, + 63, 138, 9, 69, 69, 63, 63, 46, 42, 71, + 71, 88, 88, 89, 89, 90, 90, 137, 46, 136, + 44, 92, 92, 46, 132, 44, 109, 109, 111, 111, + + 112, 112, 124, 124, 147, 147, 131, 147, 148, 130, + 129, 148, 150, 150, 150, 150, 151, 151, 151, 151, + 152, 152, 152, 152, 153, 153, 153, 153, 154, 154, + 154, 154, 155, 155, 155, 155, 128, 127, 126, 125, + 122, 121, 120, 119, 118, 116, 115, 114, 113, 108, + 104, 103, 102, 100, 99, 98, 97, 95, 94, 93, + 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, + 77, 76, 75, 74, 73, 72, 70, 67, 66, 65, + 64, 62, 61, 59, 58, 57, 56, 55, 53, 52, + 49, 45, 38, 36, 35, 31, 27, 22, 21, 18, + + 13, 12, 3, 146, 146, 146, 146, 146, 146, 146, + 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, + 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, + 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, + 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, + 146, 146, 146, 146, 146 + } ; + +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 "lexicalStructure.lex" +/* Lexical Analysis with Flex (1.6.0) We used some of the code from this manual */ +/* so we placed the citation here. */ +/* definitions */ +#line 8 "lexicalStructure.lex" + #include + //#include "typedefs.h" + #include "grammar.tab.h" + int line_number = 1, column_number = 1; + #ifndef DEBUG + #define DEBUG 0 + #endif +#line 561 "lex.yy.c" +#line 23 "lexicalStructure.lex" + /* char can be a newline, tab, an escaped quote, or anything but a single quote, an actual line break, an actual tab, or a backslash by itself (to prevent confusion from escaped quote */ + /* similar to above, a string Char (SCHAR) is the same as a CHAR except we cannot have double quotes instead of single quotes. Double quotes need to be escaped in Flex unlike single quotes based on documentation */ +#line 565 "lex.yy.c" + +#define INITIAL 0 + +#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 + + static void yyunput ( int c, char *buf_ptr ); + +#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 \ + 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 27 "lexicalStructure.lex" + + +#line 785 "lex.yy.c" + + 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_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 >= 147 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 204 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + 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 29 "lexicalStructure.lex" +{if(DEBUG) {printf( "T_INTEGER: %s (%d)\n", yytext, T_INTEGER);} else {return T_INTEGER;}} + YY_BREAK +case 2: +YY_RULE_SETUP +#line 30 "lexicalStructure.lex" +{if(DEBUG) {printf( "T_ADDRESS: %s (%d)\n", yytext, T_ADDRESS);} else {return T_ADDRESS;}} + YY_BREAK +case 3: +YY_RULE_SETUP +#line 31 "lexicalStructure.lex" +{if(DEBUG) {printf( "T_BOOLEAN: %s (%d)\n", yytext, T_BOOLEAN);} else {return T_BOOLEAN;}} + YY_BREAK +case 4: +YY_RULE_SETUP +#line 32 "lexicalStructure.lex" +{if(DEBUG) {printf( "T_CHARACTER: %s (%d)\n", yytext, T_CHARACTER);} else {return T_CHARACTER;}} + YY_BREAK +case 5: +YY_RULE_SETUP +#line 34 "lexicalStructure.lex" +{if(DEBUG) {printf( "WHILE: %s (%d)\n", yytext, WHILE);} else {return WHILE;}} + YY_BREAK +case 6: +YY_RULE_SETUP +#line 35 "lexicalStructure.lex" +{if(DEBUG) {printf( "IF: %s (%d)\n", yytext, IF);} else {return IF;}} + YY_BREAK +case 7: +YY_RULE_SETUP +#line 36 "lexicalStructure.lex" +{if(DEBUG) {printf( "THEN: %s (%d)\n", yytext, THEN);} else {return THEN;}} + YY_BREAK +case 8: +YY_RULE_SETUP +#line 37 "lexicalStructure.lex" +{if(DEBUG) {printf( "ELSE: %s (%d)\n", yytext, ELSE);} else {return ELSE;}} + YY_BREAK +case 9: +YY_RULE_SETUP +#line 38 "lexicalStructure.lex" +{if(DEBUG) {printf( "TYPE: %s (%d)\n", yytext, TYPE);} else {return TYPE;}} + YY_BREAK +case 10: +YY_RULE_SETUP +#line 39 "lexicalStructure.lex" +{if(DEBUG) {printf( "FUNCTION: %s (%d)\n", yytext, FUNCTION);} else {return FUNCTION;}} + YY_BREAK +case 11: +YY_RULE_SETUP +#line 40 "lexicalStructure.lex" +{if(DEBUG) {printf( "RETURN: %s (%d)\n", yytext, RETURN);} else {return RETURN;}} + YY_BREAK +case 12: +YY_RULE_SETUP +#line 41 "lexicalStructure.lex" +{if(DEBUG) {printf( "EXTERNAL: %s (%d)\n", yytext, EXTERNAL);} else {return EXTERNAL;}} + YY_BREAK +case 13: +YY_RULE_SETUP +#line 42 "lexicalStructure.lex" +{if(DEBUG) {printf( "AS: %s (%d)\n", yytext, AS);} else {return AS;}} + YY_BREAK +case 14: +YY_RULE_SETUP +#line 44 "lexicalStructure.lex" +{if(DEBUG) {printf( "RELEASE: %s (%d)\n", yytext, RELEASE);} else {return RELEASE;}} + YY_BREAK +case 15: +YY_RULE_SETUP +#line 45 "lexicalStructure.lex" +{if(DEBUG) {printf( "RESERVE: %s (%d)\n", yytext, RESERVE);} else {return RESERVE;}} + YY_BREAK +case 16: +YY_RULE_SETUP +#line 47 "lexicalStructure.lex" +{if(DEBUG) {printf( "ADD: %s (%d)\n", yytext, ADD);} else {return ADD;}} + YY_BREAK +case 17: +YY_RULE_SETUP +#line 48 "lexicalStructure.lex" +{if(DEBUG) {printf( "SUB_OR_NEG: %s (%d)\n", yytext, SUB_OR_NEG);} else {return SUB_OR_NEG;}} + YY_BREAK +case 18: +YY_RULE_SETUP +#line 49 "lexicalStructure.lex" +{if(DEBUG) {printf( "MUL: %s (%d)\n", yytext, MUL);} else {return MUL;}} + YY_BREAK +case 19: +YY_RULE_SETUP +#line 50 "lexicalStructure.lex" +{if(DEBUG) {printf( "DIV: %s (%d)\n", yytext, DIV);} else {return DIV;}} + YY_BREAK +case 20: +YY_RULE_SETUP +#line 51 "lexicalStructure.lex" +{if(DEBUG) {printf( "REM: %s (%d)\n", yytext, REM);} else {return REM;}} + YY_BREAK +case 21: +YY_RULE_SETUP +#line 52 "lexicalStructure.lex" +{if(DEBUG) {printf( "LESS_THAN: %s (%d)\n", yytext, LESS_THAN);} else {return LESS_THAN;}} + YY_BREAK +case 22: +YY_RULE_SETUP +#line 53 "lexicalStructure.lex" +{if(DEBUG) {printf( "EQUAL_TO: %s (%d)\n", yytext, EQUAL_TO);} else {return EQUAL_TO;}} + YY_BREAK +case 23: +YY_RULE_SETUP +#line 54 "lexicalStructure.lex" +{if(DEBUG) {printf( "ASSIGN: %s (%d)\n", yytext, ASSIGN);} else {return ASSIGN;}} + YY_BREAK +case 24: +YY_RULE_SETUP +#line 55 "lexicalStructure.lex" +{if(DEBUG) {printf( "NOT: %s (%d)\n", yytext, NOT);} else {return NOT;}} + YY_BREAK +case 25: +YY_RULE_SETUP +#line 56 "lexicalStructure.lex" +{if(DEBUG) {printf( "AND: %s (%d)\n", yytext, AND);} else {return AND;}} + YY_BREAK +case 26: +YY_RULE_SETUP +#line 57 "lexicalStructure.lex" +{if(DEBUG) {printf( "OR: %s (%d)\n", yytext, OR);} else {return OR;}} + YY_BREAK +case 27: +YY_RULE_SETUP +#line 58 "lexicalStructure.lex" +{if(DEBUG) {printf( "DOT: %s (%d)\n", yytext, DOT);} else {return DOT;}} + YY_BREAK +case 28: +YY_RULE_SETUP +#line 60 "lexicalStructure.lex" +{if(DEBUG) {printf( "SEMI_COLON: %s (%d)\n", yytext, SEMI_COLON);} else {return SEMI_COLON;}} + YY_BREAK +case 29: +YY_RULE_SETUP +#line 61 "lexicalStructure.lex" +{if(DEBUG) {printf( "COLON: %s (%d)\n", yytext, COLON);} else {return COLON;}} + YY_BREAK +case 30: +YY_RULE_SETUP +#line 62 "lexicalStructure.lex" +{if(DEBUG) {printf( "COMMA: %s (%d)\n", yytext, COMMA);} else {return COMMA;}} + YY_BREAK +case 31: +YY_RULE_SETUP +#line 63 "lexicalStructure.lex" +{if(DEBUG) {printf( "ARROW: %s (%d)\n", yytext, ARROW);} else {return ARROW;}} + YY_BREAK +case 32: +YY_RULE_SETUP +#line 65 "lexicalStructure.lex" +{if(DEBUG) {printf( "C_INTEGER: %s (%d)\n", yytext, C_INTEGER);} else {return C_INTEGER;}} + YY_BREAK +case 33: +YY_RULE_SETUP +#line 66 "lexicalStructure.lex" +{if(DEBUG) {printf( "C_CHARACTER: %s (%d)\n", yytext, C_CHARACTER);} else {return C_CHARACTER;}} + YY_BREAK +case 34: +YY_RULE_SETUP +#line 67 "lexicalStructure.lex" +{if(DEBUG) {printf( "C_STRING: %s (%d)\n", yytext, C_STRING);} else {return C_STRING;}} + YY_BREAK +case 35: +/* rule 35 can match eol */ +YY_RULE_SETUP +#line 68 "lexicalStructure.lex" +{if(DEBUG) {printf( "COMMENT: %s (%d)\n", yytext, COMMENT);} else {return COMMENT;}} + YY_BREAK +case 36: +YY_RULE_SETUP +#line 70 "lexicalStructure.lex" +{if(DEBUG) {printf( "L_PAREN: %s (%d)\n", yytext, L_PAREN);} else {return L_PAREN;}} + YY_BREAK +case 37: +YY_RULE_SETUP +#line 71 "lexicalStructure.lex" +{if(DEBUG) {printf( "R_PAREN: %s (%d)\n", yytext, R_PAREN);} else {return R_PAREN;}} + YY_BREAK +case 38: +YY_RULE_SETUP +#line 73 "lexicalStructure.lex" +{if(DEBUG) {printf( "L_BRACKET: %s (%d)\n", yytext, L_BRACKET);} else {return L_BRACKET;}} + YY_BREAK +case 39: +YY_RULE_SETUP +#line 74 "lexicalStructure.lex" +{if(DEBUG) {printf( "R_BRACKET: %s (%d)\n", yytext, R_BRACKET);} else {return R_BRACKET;}} + YY_BREAK +case 40: +YY_RULE_SETUP +#line 76 "lexicalStructure.lex" +{if(DEBUG) {printf( "L_BRACE: %s (%d)\n", yytext, L_BRACE);} else {return L_BRACE;}} + YY_BREAK +case 41: +YY_RULE_SETUP +#line 77 "lexicalStructure.lex" +{if(DEBUG) {printf( "R_BRACE: %s (%d)\n", yytext, R_BRACE);} else {return R_BRACE;}} + YY_BREAK +case 42: +YY_RULE_SETUP +#line 79 "lexicalStructure.lex" +{if(DEBUG) {printf( "C_TRUE: %s (%d)\n", yytext, C_TRUE);} else {return C_TRUE;}} + YY_BREAK +case 43: +YY_RULE_SETUP +#line 80 "lexicalStructure.lex" +{if(DEBUG) {printf( "C_FALSE: %s (%d)\n", yytext, C_FALSE);} else {return C_FALSE;}} + YY_BREAK +case 44: +YY_RULE_SETUP +#line 81 "lexicalStructure.lex" +{if(DEBUG) {printf( "C_NULL: %s (%d)\n", yytext, C_NULL);} else {return C_NULL;}} + YY_BREAK +case 45: +YY_RULE_SETUP +#line 83 "lexicalStructure.lex" +{if(DEBUG) {printf( "ID: %s (%d)\n", yytext, ID);} else {return ID;}} + YY_BREAK +case 46: +/* rule 46 can match eol */ +YY_RULE_SETUP +#line 85 "lexicalStructure.lex" +{line_number++; column_number = 1;} + YY_BREAK +case 47: +YY_RULE_SETUP +#line 86 "lexicalStructure.lex" +{column_number++;} + YY_BREAK +case 48: +YY_RULE_SETUP +#line 87 "lexicalStructure.lex" +{column_number++;} + YY_BREAK +case 49: +YY_RULE_SETUP +#line 88 "lexicalStructure.lex" +{column_number++; return 1999;} + YY_BREAK +case 50: +YY_RULE_SETUP +#line 90 "lexicalStructure.lex" +ECHO; + YY_BREAK +#line 1094 "lex.yy.c" +case YY_STATE_EOF(INITIAL): + yyterminate(); + + 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_c_buf_p); + 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); + + 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 >= 147 ) + 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 >= 147 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_is_jam = (yy_current_state == 146); + + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_UNPUT + + static void yyunput (int c, char * yy_bp ) +{ + char *yy_cp; + + yy_cp = (yy_c_buf_p); + + /* undo effects of setting up yytext */ + *yy_cp = (yy_hold_char); + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + int number_to_move = (yy_n_chars) + 2; + char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; +} + +#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); + + 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 90 "lexicalStructure.lex" + + diff --git a/parser b/parser index 432a493003aad234aab1cddeee6bf7bfb3b18924..d8cc1d741f18e0e6e768cac2bbd19e597fd2efc8 100755 GIT binary patch delta 9604 zcmaJ_3s_ZE+TLfwMlcan4woYeq6jE*69N8oLzstI> zz0PiZO>KQmJ?v@nDv4M4Q^NY0V!bMZgjUI>n37HV*(THNe!Fr7=R)RCzxTVCeLL#g z=`+8W5^=G5dR_mwf4I@!ShmeA)<<0(!%pA2` z)OU3z! zq=wCt8EPHdFnM#Z2vkq$wgr1*F>?b;qd^o1E?LKPE7Jux5Rine<>i;wWPmkMny!Rbafbl#>bdPcBAvvZ4im2jBd z%>ikK5#gYOj|z{`-8`x?Qg}mk^GIR#>t?p;nVz~9ygUL)_S#Hm&_C{wdgj@Dq-a?XsFIFJ>*u?20^u90U-F>rCfA2wPFU) z+FPV!f(Tq=D0+BuWNY(T@q(_ zBCY|339c088NxNWhbxWpc;fc*apD6#n)K8&YkW}A(Q%L+Rn9wpK;7&qviz_F+UZ7% zYdIw1#2bkU?~p+^S1)00QDI(}g|=@A3mK6yuYhY>j)--IrWCiU1#wlJ7lUt}Dm)Xr zdzv$#J2HcthP&}f!i87gC9G~_AgdkW>2-fG8MK>=*u?Ty2Rdf+#J zj5r%;Wm#)F27M@xG4~OnKjk4=lGo)tp6F;E^NAke^{UV|=dp>=NxesrhI|X#*rsTU zSE?|E<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w$1}pKo(`<9;f=c7LS4@?Eluq$8ZDj>|oNxMAkxn{u>e;6GtPWh!T)`DF-}NcJ V)_J04t;|`!)@0gVSyvHZ`ab~#xXl0n From f355de059f6a8608b0c1edd2d66e42941628049e Mon Sep 17 00:00:00 2001 From: Meyer Simon Date: Thu, 27 Feb 2025 16:11:13 -0500 Subject: [PATCH 076/105] added some test files nothing is working t#34 --- library.alpha | 30 ++++++++++++++++++++++++++++++ simple.alpha | 4 ++++ 2 files changed, 34 insertions(+) create mode 100644 library.alpha create mode 100644 simple.alpha diff --git a/library.alpha b/library.alpha new file mode 100644 index 0000000..9bacd6c --- /dev/null +++ b/library.alpha @@ -0,0 +1,30 @@ +(* At compiler start-up your program should create symbol table entries for the four primitive types: + Boolean (1 byte) + character (1 byte) + integer (4 bytes) + address (8 bytes) +You should #include this file at the start of your alpha file. +Some useful types are defined below. +*) +type string: 1 -> character +type BooleanXBoolean: [Boolean: x, y] +type characterXcharacter: [character: x, y] +type integerXinteger: [integer: x, y] + +type Boolean2Boolean: Boolean -> Boolean +type integer2integer: integer -> integer +type character2integer: character -> integer +type Boolean2integer: Boolean -> integer +type string2integer: string -> integer +type integerXinteger2integer: integerXinteger -> integer +type integerXinteger2Boolean: integerXinteger -> Boolean +type characterXcharacter2Boolean: characterXcharacter -> Boolean +type BooleanXBoolean2Boolean: BooleanXBoolean -> Boolean +type integer2address: integer -> address +type address2integer: address -> integer +external function printInteger: integer2integer +external function printCharacter: character2integer +external function printBoolean: Boolean2integer +external function reserve: integer2address +external function release: address2integer +function entry: string2integer diff --git a/simple.alpha b/simple.alpha new file mode 100644 index 0000000..13f3c9f --- /dev/null +++ b/simple.alpha @@ -0,0 +1,4 @@ +#include "library.alpha" +entry(arg) := { + return 0; +} From 77596a9d96d29e46dcea21e591f19b08d44f2a9f Mon Sep 17 00:00:00 2001 From: Meyer Simon Date: Thu, 27 Feb 2025 17:02:17 -0500 Subject: [PATCH 077/105] got it to workgit add grammar.ygit add grammar.ygit add grammar.ygit add grammar.ygit add grammar.ygit add grammar.ygit add grammar.y! t#34 --- grammar.y | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grammar.y b/grammar.y index 2015769..0ce008e 100644 --- a/grammar.y +++ b/grammar.y @@ -63,7 +63,7 @@ input: /*empty for now*/ OPTIONAL; OPTIONAL: - '[' {printf("success");}; + L_BRACKET {printf("success");}; // B : '{'{CreateScope(cur,line,column)} E '}'; //Braced Expressions can have braces removed to get regular expressions // D : '[' l ']'; //Declaration Lists Brackets can be taken out to get a list of Declarations // E : Maybe_D U; //An expression can start with an optional D followed by an undeclared segment @@ -76,7 +76,7 @@ OPTIONAL: void yyerror(const char *err) { fprintf(stderr, "Error: %s\n", err); -} +} int main() { int a; while (a = yyparse()){ From fad44e21ea5f6994c63175a933fb880dfea67c42 Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Thu, 27 Feb 2025 17:58:01 -0500 Subject: [PATCH 078/105] added print table functionality to main in grammar.y with custom EOF input in '!' --- grammar.y | 22 ++++++++++++---------- parser | Bin 36592 -> 36648 bytes symbol_table.c | 10 ++++++++++ 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/grammar.y b/grammar.y index 0ce008e..c267eeb 100644 --- a/grammar.y +++ b/grammar.y @@ -8,7 +8,9 @@ extern int yylex(void); void yyerror(const char *err); extern char* yytext; - extern int yychar; + extern int yychar; + SymbolTable * st; + %} %token ID 101 @@ -59,28 +61,28 @@ %token COMMENT 700 %% -input: /*empty for now*/ +start: /*empty for now*/ OPTIONAL; OPTIONAL: L_BRACKET {printf("success");}; -// B : '{'{CreateScope(cur,line,column)} E '}'; //Braced Expressions can have braces removed to get regular expressions -// D : '[' l ']'; //Declaration Lists Brackets can be taken out to get a list of Declarations -// E : Maybe_D U; //An expression can start with an optional D followed by an undeclared segment -// Maybe_D : D -// | ; //Either D or not -//l : A ';' l; -// | ; //a declaration list can either be empty or be an assignment followed by a semi-colon and another list +// %% void yyerror(const char *err) { fprintf(stderr, "Error: %s\n", err); } + int main() { + st=CreateScope(NULL,1,1); int a; - while (a = yyparse()){ + while ((a = yyparse()) != EOF){ printf("%d = a: yytext = %s: yychar = %d\n", a, yytext, yychar); + if(yytext[0] == '!'){ + print_symbol_table(getAncestor(st),stdout); + break; + } } return 0; } diff --git a/parser b/parser index d8cc1d741f18e0e6e768cac2bbd19e597fd2efc8..3a559de4d69ab532788655642731e6d46596d7d6 100755 GIT binary patch delta 10114 zcmZu%3wTXe+TLd;I}$_^awIvTNstR7kwio!B*Bs6o`|@#E-9+Cw5Fuhzc?X+V<&A` zbs4nPnNgh5>d@)*sUqLPYZh8(~T@?Pe=X46_1lNck@|u<=OO!d z>P&UWf7q0PudDqBu=fU=?Kk~ajllHk+FP>~rMTfqVLRt>FGX=^cC>Zvb^I-hQ=Y)WkQQ~E8T;lB=IOqB6Y1N*&l|DJy_R5 zXDi-{Z42h`hkk5fTDCeXg?*70st!$|)L4C5LcrWv7_we+6~tF+u%EH2%me$}5F z%t-H~R`h3!(}x5u?cZ!dhd(fkI#W3tlo`W*O^=Q6fYNWjr@!Cf%3^1NqvQah>HIJ6 z{QG2Cf-r99T9H*K+B+OpFPVbZgGEI`w(JDC5>|j zB=Flk-EI*!Btd_Up;!Xv||(w-Es6@x?77yHp1nQpSr21kWtz=CEV-BcK< zm;41i@O+}U4fDz97IH7iJ#3r4kg+jVWmbo2+Mt<0ApuFY}A zecl4^(((EGeZQw3=i3}N^K8ZS!CzuT%3=C*1XXd)yNB2gttX~7P$9-KyA+D!t?+JO5M^Is&+gjmC+lorZzy=+9Pa9rC-S>$gE0xjBu2wt~EfyldEl&c3X1jZ8JnGJ$$?s&7=I1NCs+tGMi%VVn2YT<0%X}t@xEZdP2vzS(hPw-Cb4}FRNAxV=;H_DM<`j z*PcAXN7vlrr}!ohjKqnNY=;#eRBx-(p}izqn2xnt!TYjx+&%8iV9-@Rzct@@(iW@6 z=u0qEnt>yD>g%2=A8!TS0H*4}22K6bG7L?~gmCLU&h2w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`s`s#)|@Q;gMGV+CD<2~_E}qKDlL7zn_Bw$y027Lu6mX3TVL;? ze%Y7(UhnI@QZB|yc1j;%Dq-Fm6S{265vg2wjg5r*@@%2HFsszD(QY#BW8RzXCO_ub WJivR(8sT!3UEDmtParent_Scope, x); } + +SymbolTable * getAncestor(SymbolTable * table){ + if(table->Parent_Scope == NULL){ + //if table has no parent, return itself + return table; + } else { + //call function recursively to grab ancestor + return getAncestor(table->Parent_Scope); + } +} void print_symbol_table(SymbolTable *table, FILE *file_ptr){ if(table->Parent_Scope == NULL){ fprintf(file_ptr, "%-17s: %-6s : %-6s : %-21s: %-28s\n", "NAME", "SCOPE", "PARENT", "TYPE", "Extra annotation"); From d609dd2dca2da6a5af3adad67a568e0dc307fb81 Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Thu, 27 Feb 2025 20:03:50 -0500 Subject: [PATCH 079/105] added skeleton rules and grammar to bison file --- grammar.y | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++--- parser | Bin 36648 -> 40856 bytes 2 files changed, 119 insertions(+), 6 deletions(-) diff --git a/grammar.y b/grammar.y index c267eeb..adb4aa7 100644 --- a/grammar.y +++ b/grammar.y @@ -10,7 +10,8 @@ extern char* yytext; extern int yychar; SymbolTable * st; - + char* cur_value; + char* cur_type; %} %token ID 101 @@ -61,12 +62,122 @@ %token COMMENT 700 %% -start: /*empty for now*/ - OPTIONAL; +program: + prototype_or_definition_list; -OPTIONAL: - L_BRACKET {printf("success");}; +prototype_or_definition_list: + prototype prototype_or_definition_list + | definition prototype_or_definition_list + | prototype + | definition + ; +prototype: + L_PAREN EXTERNAL R_PAREN FUNCTION ID COLON ID; +definition: + TYPE ID COLON dblock + | TYPE ID COLON constant ARROW ID + | TYPE ID COLON ID ARROW ID + | ID parameter ASSIGN sblock + ; + +parameter: + L_PAREN ID R_PAREN + | AS L_PAREN idlist R_PAREN + ; + +idlist: + ID COMMA idlist + |ID + ; + +sblock: + L_BRACE {st = CreateScope(st,1,1);} statement_list {st = getParent(st);} R_BRACE + | L_BRACE {st = CreateScope(st,1,1);} dblock statement_list {st = getParent(st);} R_BRACE + ; + +dblock: + L_BRACKET declaration_list R_BRACKET; + +declaration_list: + declaration {CreateEntry(st,cur_type,cur_value);} SEMI_COLON declaration_list + | declaration {CreateEntry(st,cur_type,cur_value);} + ; + +declaration: + ID COLON ID {cur_value = strdup($1);cur_type = strdup($3);}; + +statement_list: + compound_statement statement_list + | compound_statement + | simple_statement SEMI_COLON statement_list + | simple_statement SEMI_COLON + ; + +compound_statement: + WHILE L_PAREN expression R_PAREN sblock + | IF L_PAREN expression R_PAREN THEN sblock ELSE sblock + | sblock + ; + +simple_statement: + assignable ASSIGN expression + | RETURN expression + ; + +assignable: + ID + | assignable ablock + | assignable DOT ID + ; + +expression: + constant + | UnaryOperator expression + | assignable + | expression binaryOperator expression + | L_PAREN expression R_PAREN + | memOp assignable + ; + +ablock: + L_PAREN argument_list R_PAREN; + +argument_list: + expression COMMA argument_list + | expression + ; + +UnaryOperator: + SUB_OR_NEG + | NOT + ; + +memOp: + RESERVE + | RELEASE + ; + +binaryOperator: + ADD + | SUB_OR_NEG + | MUL + | DIV + | REM + | AND + | OR + | LESS_THAN + | EQUAL_TO + ; + +constant: + C_STRING + | C_INTEGER + | C_NULL + | C_CHARACTER + | C_TRUE + | C_FALSE + ; // %% @@ -75,11 +186,13 @@ void yyerror(const char *err) { } int main() { + cur_value[1] = ""; + cur_type[1] = ""; st=CreateScope(NULL,1,1); int a; while ((a = yyparse()) != EOF){ printf("%d = a: yytext = %s: yychar = %d\n", a, yytext, yychar); - if(yytext[0] == '!'){ + if(yytext[0] == '?'){ print_symbol_table(getAncestor(st),stdout); break; } diff --git a/parser b/parser index 3a559de4d69ab532788655642731e6d46596d7d6..05d2da9e80dd27dbbb7f6f3bb90bc8855f15ec55 100755 GIT binary patch delta 13761 zcmZ`=34Bw|svbm3yf)+-r-RXJR!$|0e;^pXuRT+~ns=CTgZ3E8ri z%a;0%_(0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{1Av|pf%iWwGY~H%Fm#}3J&1ZVS61IDDzUR9^+Cw5nGrO@lJIE;n zWhu+uGQfOB#4Q!=%)c^nh From 078b059d1c34eceb01a0819b1e722d7a8fb981f2 Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Thu, 27 Feb 2025 20:28:39 -0500 Subject: [PATCH 080/105] parser compiling --- grammar.y | 11 ++++++++--- parser | Bin 40856 -> 40856 bytes 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/grammar.y b/grammar.y index adb4aa7..f9f14e8 100644 --- a/grammar.y +++ b/grammar.y @@ -14,7 +14,12 @@ char* cur_type; %} -%token ID 101 +%union { + int integ; + char * words; +} + +%token ID 101 %token T_INTEGER %token T_ADDRESS 202 %token T_BOOLEAN 203 @@ -186,8 +191,8 @@ void yyerror(const char *err) { } int main() { - cur_value[1] = ""; - cur_type[1] = ""; + cur_value = NULL; + cur_type = NULL; st=CreateScope(NULL,1,1); int a; while ((a = yyparse()) != EOF){ diff --git a/parser b/parser index 05d2da9e80dd27dbbb7f6f3bb90bc8855f15ec55..cb59b833bc9d5254ff75b3e6fa3d5e61bcbefe06 100755 GIT binary patch delta 8886 zcmZ`<3tUvyy5DQ49j{hIE6 z0~F1WKzDDYQK|bP0o}b_@&wS`9*n&167<)h>UFOHCLB1~@y8W~hz*gNOW05i;a{(U zX|h=o1B9Gwr3C?ZYK@j7xYm_lsfbC6YCUBzE{}>3s!3gALrYP2Dk7KUd(bt77 zNsn=Y@$^mR>|!uznNJO=8|#I%UZd@)3)A4$<%!UAudf3!b$2ZR*DeBzwfG6LZ%DsJ zso)vwMUwQB8s?)P@l{iT=N_^Wu?%HDTwqS6PZ`V z6hyK^7sxCLGgfk0TF?kh5eQOAWihv9{-Mg|>bhJ<&bghqW%kO@fZ|^!JLIqZoFP}ldma)U+UP&Qqss{6T7r7fe-|g z`bm6nVvduBhNw<8$ckbuc?~ivgvpnHS)Y9ly&*(|duvX>eU4BsDh%R|`_I8C&d6)8 zP?Qa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0Ah$v>Z# zrrzRJU@zlwPo}GrcxUwGd@%aKya4@fUV?ry--iBsehB>+{NLzT@VM#e>Q>$v{R%!9 z{W@NNel#zc-b|g#-va&wKZt$|uR=eF$IeJsd+-kEJMw|(Tk>h>Q@DlxF8TO;HQa>JBkggu#9nc@*1JR!-omTL(OPyFcW`1`~-N;ujN^HDkm7H;C=J|Zn zqC{T4$eFyu=Fq)Gf8&9uN>gPQzq}|h*>{KDGdA}CZ{bNy{?g{6I>leH%`NA{JbQVr zC!RMib|zQcVIv0X<51$2S9ssz#N?7(sk_p)kzsRvd^WhhWJz*eJG_xLw}5W~_d>qp z_Of;7+T0p`6x@UO08D?)Y~95+cOX~2iRuqL*}GYNiSGk`fuHhbsIz$N;sI*k(qW71 zscH-#vn0K-C^49*j~O;bQWkJ)NrpO+f4pRlx`$^jO-x>U$K+;0vI!=q^GQoHuxhK( zuj2cbPC#w6uo9DR^b;{DX%Z;k+4A@DVctJSJAj zFSA6HW9;(H$$8j<^j9WgEy_T;2FMDbZhX4Qo From 046cb4b171e2e659193910deb749b63a8da29c88 Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Fri, 28 Feb 2025 11:50:18 -0500 Subject: [PATCH 081/105] solved shift-reduce errors --- grammar.y | 26 ++++++++++++++++++++++---- parser | Bin 40856 -> 40856 bytes 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/grammar.y b/grammar.y index f9f14e8..ca54a25 100644 --- a/grammar.y +++ b/grammar.y @@ -18,6 +18,22 @@ int integ; char * words; } +//precedence order +%precedence RESERVE +%precedence RELEASE +%precedence DOT +%precedence SUB_OR_NEG +%precedence NOT +%left MUL +%left DIV +%left REM +%left ADD +//need subtraction only here +%left LESS_THAN +%left EQUAL_TO +%left AND +%left OR +%left ASSIGN %token ID 101 %token T_INTEGER @@ -50,7 +66,7 @@ %token COLON 508 %token COMMA 509 %token ARROW 510 -%token ADD 601 +/* %token ADD 601 %token SUB_OR_NEG 602 %token MUL 603 %token DIV 604 @@ -63,8 +79,10 @@ %token OR 611 %token DOT 612 %token RESERVE 613 -%token RELEASE 614 +%token RELEASE 614 */ %token COMMENT 700 + + %% program: @@ -140,7 +158,7 @@ expression: constant | UnaryOperator expression | assignable - | expression binaryOperator expression + | constant binaryOperator expression | L_PAREN expression R_PAREN | memOp assignable ; @@ -197,7 +215,7 @@ int main() { int a; while ((a = yyparse()) != EOF){ printf("%d = a: yytext = %s: yychar = %d\n", a, yytext, yychar); - if(yytext[0] == '?'){ + if(yytext[0] == '!'){ print_symbol_table(getAncestor(st),stdout); break; } diff --git a/parser b/parser index cb59b833bc9d5254ff75b3e6fa3d5e61bcbefe06..02e2648389b3dc49b093d9cc710c25095f792e19 100755 GIT binary patch delta 8853 zcmZ`<34B!5)qii2mjx0g6EaLD+e{KNla-K_Oh`xq3`|5IKmq~TWD{hOB@wXFF@_++ z14S>jP^rtOepW?Vn-;+$1O&o1EG;UV3bwTqf=XpEVB~%O^X|)LzrNq^-2b^}yXUU& z&P%rL*KOUe`$LczT$LlJPZcwWnZa{nd2LQ(xtJ*${O9m$Co+%jy9melFWTN%Ket!j z?lsfze7COpP{^6o#*Kbs_2Q()%i+-h;{4a!B1Q2yyK9~Q4y8Jp@ez1VQA^Qx6s7ecSX|~7pL2^NT^4uI zOsm5sH#AXC>wRG^S$GioopasVPj1-Up?$bZ?on4p%Mo;Kvn*|1s!o1QzAQC>Z zaK$GvG44oNT7rt&LM#igrpy>c4o#v*8cOm_Qsy8Ugl6AfnAd;wBpURqEt91PXd9Z` zdRgkFa77utpB4s#h16$QPWj z%Bih9cTu-hcOjQ|xJax`>LwnV%e*lr787r^26uJcCI5;>Uv0NoYj-W18gEaJ!5ZD{ zs#nK9sAH03Gxu zRTTEx;J$8IN?wfEa#fpaQ|Lc2GJJLJMrMNV8(3{V_VG=9+`TH7=bsZ?_17a^%~CIT z&;vG5W4rd(e$x1gZm3K2@*?blNpk3QAXa)TtYznQHFb~L){ti2QYBi#_V@{Q`dva% zd~Kpjj(tq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16:21 -0500 Subject: [PATCH 082/105] added an alpha file all on one line --- tests/test_real_alpha_file_oneline.alpha | 1 + 1 file changed, 1 insertion(+) create mode 100644 tests/test_real_alpha_file_oneline.alpha diff --git a/tests/test_real_alpha_file_oneline.alpha b/tests/test_real_alpha_file_oneline.alpha new file mode 100644 index 0000000..423b6e3 --- /dev/null +++ b/tests/test_real_alpha_file_oneline.alpha @@ -0,0 +1 @@ +type rec: [integer: x; integer: y] type T1: integer -> integer type T2: rec -> integer function foo : T1 function bar1 : T2 function bar2 : T2 foo(x) := { return x * x; } bar1(a) := { return a.x * a.y; } bar2 as (r,s) := { return r * s; } entry(arg) := { [ integer: result ; rec: w] result := foo(5); w := reserve(w); (* see types.alpha – reserve returns a value of type address, which can be assigned to array and record variables *) w.x := 5; w.y := 7; result := bar1(w); (* pass w (a rec type value) to bar1 *) result := bar2(5,7); (* implicitly build a rec type value, assign 5 and 7 to fields x and y, but call them r and s *) return 0; } From 32e123beb715cab5f03c2773c4edba2f6e17796a Mon Sep 17 00:00:00 2001 From: Meyer Simon Date: Fri, 28 Feb 2025 12:21:36 -0500 Subject: [PATCH 083/105] forgot to remove the comments --- tests/test_real_alpha_file_oneline.alpha | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_real_alpha_file_oneline.alpha b/tests/test_real_alpha_file_oneline.alpha index 423b6e3..01f115e 100644 --- a/tests/test_real_alpha_file_oneline.alpha +++ b/tests/test_real_alpha_file_oneline.alpha @@ -1 +1 @@ -type rec: [integer: x; integer: y] type T1: integer -> integer type T2: rec -> integer function foo : T1 function bar1 : T2 function bar2 : T2 foo(x) := { return x * x; } bar1(a) := { return a.x * a.y; } bar2 as (r,s) := { return r * s; } entry(arg) := { [ integer: result ; rec: w] result := foo(5); w := reserve(w); (* see types.alpha – reserve returns a value of type address, which can be assigned to array and record variables *) w.x := 5; w.y := 7; result := bar1(w); (* pass w (a rec type value) to bar1 *) result := bar2(5,7); (* implicitly build a rec type value, assign 5 and 7 to fields x and y, but call them r and s *) return 0; } +type rec: [integer: x; integer: y] type T1: integer -> integer type T2: rec -> integer function foo : T1 function bar1 : T2 function bar2 : T2 foo(x) := { return x * x; } bar1(a) := { return a.x * a.y; } bar2 as (r,s) := { return r * s; } entry(arg) := { [ integer: result ; rec: w] result := foo(5); w := reserve(w); w.x := 5; w.y := 7; result := bar1(w); result := bar2(5,7); return 0; } From 2808a75dc9be9c397cd48f3c113566ef24b6729f Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Fri, 28 Feb 2025 14:03:53 -0500 Subject: [PATCH 084/105] edited some grammar rules. Still running into syntax errors --- .Makefile.swp | Bin 0 -> 12288 bytes Makefile | 7 + grammar.y | 42 +- lex.yy.c | 2100 ------------------------------------------------- parser | Bin 40856 -> 0 bytes 5 files changed, 38 insertions(+), 2111 deletions(-) create mode 100644 .Makefile.swp delete mode 100644 lex.yy.c delete mode 100755 parser diff --git a/.Makefile.swp b/.Makefile.swp new file mode 100644 index 0000000000000000000000000000000000000000..731dce035acfa5772ee102a56adbe2804c3e8404 GIT binary patch literal 12288 zcmeI2y>HV%7>5s72$T;&2PBpQiqryjN-0uhsY7W?RjEvTRst2rxqMK^w$2wIs`ywK zkeFD2e}KZk!hi$=A3H2;?0{7M02UbdonxnU;?M|*0rW1P*w1(6@Z-{^FZcJdpfEbBo7a0eLYCIc(eazQ!@T3#VVHM9F*iV<0Uy9y@B%D@$KVdQ z1TKO}V1Oea2R4J1?Kls-2T#Fma0{FV2f+aNv5m1e;5B##9)XA81}K9PxC|`N2fp?p zA3Ov#Fai3(x2Q6Bcfk_yz&w}&k&l0H zJ!#5hfDDiUGC&5%z~3{FlQnLX_#rb?EdIMJ?OM&2rm_oWC9Ba%8V{MuUrY{4uDHIM zKQK6bVR|Tu=}@C#t~t?Xjw@`>!hbntzM0I8P;oP_M5w~(ePK~FuKBVUnzkEM?6yn; zW2e*oK*;Dx%g%hA+tIxgw!08@y)cq}N@_NLo~|GI>|ubgS_@n;S5+v(%_zE~;N}Ul zo;m|(Jq+OEiBuWXJ*Su4-^)yy>Ap@KQ!WcnS9iu=6kdw&%T8+2PXiLl-C7qM*+hNV9>051q^kD^MW)#qx zhv6huIPq+Ck8!vatMGUW)t#N3o4ycPXjMHhsGC@F9MxNOZ1=R1bw|~uFcD%bS(Gdv z%@L!?&QECHsZ~kVNALSi*6LtQ0$YYcuBuL*!{X?gp;K{=uca84TjRWWQLy-mvBnve bTDLbhdK9V;P)}!pT8s{ASFG7t*>Tt}gkE>x literal 0 HcmV?d00001 diff --git a/Makefile b/Makefile index 05aff7a..8f3879c 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,13 @@ FLEX := flex LEX := lexicalStructure.lex EXE := alpha CFLAGS := +YACC := bison + +parser : lex.yy.c grammar.tab.c + $(CC) -o parser lex.yy.c grammar.tab.c + +grammar.tab.c: grammar.y + $(YACC) -d grammar.y compiler: lex.yy.c runner.o runner diff --git a/grammar.y b/grammar.y index ca54a25..e10b99f 100644 --- a/grammar.y +++ b/grammar.y @@ -12,6 +12,9 @@ SymbolTable * st; char* cur_value; char* cur_type; + int token_tracker; + extern int line_number; + extern int column_number; %} %union { @@ -100,6 +103,8 @@ prototype: definition: TYPE ID COLON dblock | TYPE ID COLON constant ARROW ID + | TYPE ID COLON types ARROW ID + | FUNCTION ID COLON ID | TYPE ID COLON ID ARROW ID | ID parameter ASSIGN sblock ; @@ -115,20 +120,22 @@ idlist: ; sblock: - L_BRACE {st = CreateScope(st,1,1);} statement_list {st = getParent(st);} R_BRACE - | L_BRACE {st = CreateScope(st,1,1);} dblock statement_list {st = getParent(st);} R_BRACE + L_BRACE /*{st = CreateScope(st,1,1);}*/ statement_list /*{st = getParent(st);}*/ R_BRACE + | L_BRACE /*{st = CreateScope(st,1,1);}*/ dblock statement_list /*{st = getParent(st);}*/ R_BRACE ; dblock: L_BRACKET declaration_list R_BRACKET; declaration_list: - declaration {CreateEntry(st,cur_type,cur_value);} SEMI_COLON declaration_list - | declaration {CreateEntry(st,cur_type,cur_value);} + declaration /*{CreateEntry(st,cur_type,cur_value);}*/ SEMI_COLON declaration_list + | declaration //{CreateEntry(st,cur_type,cur_value);} ; declaration: - ID COLON ID {cur_value = strdup($1);cur_type = strdup($3);}; + ID COLON ID //{cur_value = strdup($1);cur_type = strdup($3);} + | types COLON ID + ; statement_list: compound_statement statement_list @@ -201,22 +208,35 @@ constant: | C_TRUE | C_FALSE ; + +types: + T_STRING + | T_INTEGER + | T_ADDRESS + | T_CHARACTER + | T_BOOLEAN + ; // %% void yyerror(const char *err) { - fprintf(stderr, "Error: %s\n", err); + fprintf(stderr, "ERROR: %s at token %s at line number %d,column number %d\n", err,yytext,line_number,column_number); } int main() { - cur_value = NULL; - cur_type = NULL; + //cur_value = NULL; + //cur_type = NULL; + + token_tracker = 1; st=CreateScope(NULL,1,1); int a; while ((a = yyparse()) != EOF){ - printf("%d = a: yytext = %s: yychar = %d\n", a, yytext, yychar); - if(yytext[0] == '!'){ - print_symbol_table(getAncestor(st),stdout); + token_tracker++; + //printf("%d = a: yytext = %s: yychar = %d, token number: %d\n", a, yytext, yychar,token_tracker); + if(yytext[0] == '\n'){ + FILE* f = fdopen(1,"w"); + print_symbol_table(getAncestor(st),f); + fclose(f); break; } } diff --git a/lex.yy.c b/lex.yy.c deleted file mode 100644 index dca4c08..0000000 --- a/lex.yy.c +++ /dev/null @@ -1,2100 +0,0 @@ - -#line 3 "lex.yy.c" - -#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 50 -#define YY_END_OF_BUFFER 51 -/* 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[147] = - { 0, - 0, 0, 51, 49, 47, 46, 48, 24, 49, 20, - 25, 49, 36, 37, 18, 16, 30, 17, 27, 19, - 32, 29, 28, 21, 22, 45, 45, 38, 39, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 40, 26, - 41, 0, 34, 0, 0, 0, 0, 31, 32, 23, - 45, 45, 45, 13, 45, 45, 45, 45, 45, 6, - 45, 45, 45, 45, 45, 45, 45, 33, 0, 0, - 0, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 0, 0, 0, - 35, 0, 45, 45, 45, 8, 45, 45, 45, 45, - - 44, 45, 45, 45, 7, 42, 9, 45, 0, 35, - 0, 0, 45, 45, 45, 45, 43, 45, 45, 45, - 45, 45, 5, 0, 45, 45, 45, 45, 45, 45, - 45, 45, 11, 3, 2, 45, 45, 45, 1, 14, - 15, 45, 12, 10, 4, 0 - } ; - -static const YY_CHAR yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 4, 5, 6, 1, 1, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 19, 20, 21, - 22, 23, 1, 1, 24, 25, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 26, 27, 28, 1, 24, 1, 29, 24, 30, 31, - - 32, 33, 34, 35, 36, 24, 24, 37, 24, 38, - 39, 40, 24, 41, 42, 43, 44, 45, 46, 47, - 48, 24, 49, 50, 51, 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[52] = - { 0, - 1, 2, 3, 1, 1, 1, 1, 1, 2, 1, - 1, 1, 1, 1, 1, 1, 1, 4, 1, 1, - 1, 1, 1, 4, 4, 1, 1, 1, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1 - } ; - -static const flex_int16_t yy_base[156] = - { 0, - 0, 0, 203, 204, 204, 204, 204, 204, 46, 204, - 204, 175, 189, 204, 204, 204, 204, 177, 204, 204, - 181, 176, 204, 204, 204, 0, 158, 204, 204, 22, - 161, 18, 25, 23, 151, 162, 22, 158, 204, 204, - 204, 52, 204, 53, 183, 51, 55, 204, 173, 204, - 0, 151, 158, 0, 159, 145, 143, 148, 146, 0, - 140, 145, 34, 149, 136, 139, 142, 204, 63, 165, - 69, 139, 134, 133, 141, 140, 129, 140, 137, 131, - 135, 134, 121, 126, 131, 130, 124, 71, 73, 75, - 204, 81, 128, 127, 129, 0, 116, 124, 112, 120, - - 0, 124, 111, 110, 0, 0, 0, 118, 86, 204, - 88, 90, 120, 106, 117, 108, 0, 109, 112, 101, - 97, 103, 0, 92, 102, 97, 95, 108, 72, 69, - 75, 63, 0, 0, 0, 58, 51, 34, 0, 0, - 0, 27, 0, 0, 0, 204, 104, 108, 58, 112, - 116, 120, 124, 128, 132 - } ; - -static const flex_int16_t yy_def[156] = - { 0, - 146, 1, 146, 146, 146, 146, 146, 146, 147, 146, - 146, 148, 146, 146, 146, 146, 146, 146, 146, 146, - 146, 146, 146, 146, 146, 149, 149, 146, 146, 149, - 149, 149, 149, 149, 149, 149, 149, 149, 146, 146, - 146, 147, 146, 146, 146, 146, 150, 146, 146, 146, - 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, - 149, 149, 149, 149, 149, 149, 149, 146, 150, 151, - 152, 149, 149, 149, 149, 149, 149, 149, 149, 149, - 149, 149, 149, 149, 149, 149, 149, 150, 153, 154, - 146, 152, 149, 149, 149, 149, 149, 149, 149, 149, - - 149, 149, 149, 149, 149, 149, 149, 149, 155, 146, - 153, 154, 149, 149, 149, 149, 149, 149, 149, 149, - 149, 149, 149, 155, 149, 149, 149, 149, 149, 149, - 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, - 149, 149, 149, 149, 149, 0, 146, 146, 146, 146, - 146, 146, 146, 146, 146 - } ; - -static const flex_int16_t yy_nxt[256] = - { 0, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 4, 26, 27, 28, 4, 29, 30, 31, - 26, 32, 33, 26, 26, 34, 26, 35, 26, 26, - 36, 26, 37, 26, 26, 38, 26, 26, 39, 40, - 41, 43, 53, 58, 56, 60, 64, 43, 42, 45, - 61, 51, 65, 54, 57, 70, 71, 145, 59, 66, - 81, 144, 44, 88, 71, 82, 83, 45, 44, 91, - 92, 88, 71, 110, 111, 88, 71, 143, 45, 142, - 42, 110, 92, 45, 141, 42, 70, 89, 146, 111, - - 88, 71, 70, 89, 42, 42, 140, 42, 45, 139, - 138, 45, 69, 69, 69, 69, 70, 70, 70, 70, - 90, 90, 90, 90, 109, 109, 109, 109, 112, 112, - 112, 112, 124, 124, 124, 124, 137, 136, 135, 134, - 133, 132, 131, 130, 129, 128, 127, 126, 125, 123, - 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, - 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, - 98, 97, 96, 95, 94, 93, 89, 87, 86, 85, - 84, 80, 79, 78, 77, 76, 75, 74, 73, 72, - 49, 68, 67, 63, 62, 55, 52, 50, 49, 48, - - 47, 46, 146, 3, 146, 146, 146, 146, 146, 146, - 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, - 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, - 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, - 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, - 146, 146, 146, 146, 146 - } ; - -static const flex_int16_t yy_chk[256] = - { 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, 1, 1, 1, 1, 1, - 1, 9, 30, 33, 32, 34, 37, 42, 44, 46, - 34, 149, 37, 30, 32, 47, 47, 142, 33, 37, - 63, 138, 9, 69, 69, 63, 63, 46, 42, 71, - 71, 88, 88, 89, 89, 90, 90, 137, 46, 136, - 44, 92, 92, 46, 132, 44, 109, 109, 111, 111, - - 112, 112, 124, 124, 147, 147, 131, 147, 148, 130, - 129, 148, 150, 150, 150, 150, 151, 151, 151, 151, - 152, 152, 152, 152, 153, 153, 153, 153, 154, 154, - 154, 154, 155, 155, 155, 155, 128, 127, 126, 125, - 122, 121, 120, 119, 118, 116, 115, 114, 113, 108, - 104, 103, 102, 100, 99, 98, 97, 95, 94, 93, - 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, - 77, 76, 75, 74, 73, 72, 70, 67, 66, 65, - 64, 62, 61, 59, 58, 57, 56, 55, 53, 52, - 49, 45, 38, 36, 35, 31, 27, 22, 21, 18, - - 13, 12, 3, 146, 146, 146, 146, 146, 146, 146, - 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, - 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, - 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, - 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, - 146, 146, 146, 146, 146 - } ; - -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 "lexicalStructure.lex" -/* Lexical Analysis with Flex (1.6.0) We used some of the code from this manual */ -/* so we placed the citation here. */ -/* definitions */ -#line 8 "lexicalStructure.lex" - #include - //#include "typedefs.h" - #include "grammar.tab.h" - int line_number = 1, column_number = 1; - #ifndef DEBUG - #define DEBUG 0 - #endif -#line 561 "lex.yy.c" -#line 23 "lexicalStructure.lex" - /* char can be a newline, tab, an escaped quote, or anything but a single quote, an actual line break, an actual tab, or a backslash by itself (to prevent confusion from escaped quote */ - /* similar to above, a string Char (SCHAR) is the same as a CHAR except we cannot have double quotes instead of single quotes. Double quotes need to be escaped in Flex unlike single quotes based on documentation */ -#line 565 "lex.yy.c" - -#define INITIAL 0 - -#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 - - static void yyunput ( int c, char *buf_ptr ); - -#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 \ - 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 27 "lexicalStructure.lex" - - -#line 785 "lex.yy.c" - - 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_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 >= 147 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 204 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - 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 29 "lexicalStructure.lex" -{if(DEBUG) {printf( "T_INTEGER: %s (%d)\n", yytext, T_INTEGER);} else {return T_INTEGER;}} - YY_BREAK -case 2: -YY_RULE_SETUP -#line 30 "lexicalStructure.lex" -{if(DEBUG) {printf( "T_ADDRESS: %s (%d)\n", yytext, T_ADDRESS);} else {return T_ADDRESS;}} - YY_BREAK -case 3: -YY_RULE_SETUP -#line 31 "lexicalStructure.lex" -{if(DEBUG) {printf( "T_BOOLEAN: %s (%d)\n", yytext, T_BOOLEAN);} else {return T_BOOLEAN;}} - YY_BREAK -case 4: -YY_RULE_SETUP -#line 32 "lexicalStructure.lex" -{if(DEBUG) {printf( "T_CHARACTER: %s (%d)\n", yytext, T_CHARACTER);} else {return T_CHARACTER;}} - YY_BREAK -case 5: -YY_RULE_SETUP -#line 34 "lexicalStructure.lex" -{if(DEBUG) {printf( "WHILE: %s (%d)\n", yytext, WHILE);} else {return WHILE;}} - YY_BREAK -case 6: -YY_RULE_SETUP -#line 35 "lexicalStructure.lex" -{if(DEBUG) {printf( "IF: %s (%d)\n", yytext, IF);} else {return IF;}} - YY_BREAK -case 7: -YY_RULE_SETUP -#line 36 "lexicalStructure.lex" -{if(DEBUG) {printf( "THEN: %s (%d)\n", yytext, THEN);} else {return THEN;}} - YY_BREAK -case 8: -YY_RULE_SETUP -#line 37 "lexicalStructure.lex" -{if(DEBUG) {printf( "ELSE: %s (%d)\n", yytext, ELSE);} else {return ELSE;}} - YY_BREAK -case 9: -YY_RULE_SETUP -#line 38 "lexicalStructure.lex" -{if(DEBUG) {printf( "TYPE: %s (%d)\n", yytext, TYPE);} else {return TYPE;}} - YY_BREAK -case 10: -YY_RULE_SETUP -#line 39 "lexicalStructure.lex" -{if(DEBUG) {printf( "FUNCTION: %s (%d)\n", yytext, FUNCTION);} else {return FUNCTION;}} - YY_BREAK -case 11: -YY_RULE_SETUP -#line 40 "lexicalStructure.lex" -{if(DEBUG) {printf( "RETURN: %s (%d)\n", yytext, RETURN);} else {return RETURN;}} - YY_BREAK -case 12: -YY_RULE_SETUP -#line 41 "lexicalStructure.lex" -{if(DEBUG) {printf( "EXTERNAL: %s (%d)\n", yytext, EXTERNAL);} else {return EXTERNAL;}} - YY_BREAK -case 13: -YY_RULE_SETUP -#line 42 "lexicalStructure.lex" -{if(DEBUG) {printf( "AS: %s (%d)\n", yytext, AS);} else {return AS;}} - YY_BREAK -case 14: -YY_RULE_SETUP -#line 44 "lexicalStructure.lex" -{if(DEBUG) {printf( "RELEASE: %s (%d)\n", yytext, RELEASE);} else {return RELEASE;}} - YY_BREAK -case 15: -YY_RULE_SETUP -#line 45 "lexicalStructure.lex" -{if(DEBUG) {printf( "RESERVE: %s (%d)\n", yytext, RESERVE);} else {return RESERVE;}} - YY_BREAK -case 16: -YY_RULE_SETUP -#line 47 "lexicalStructure.lex" -{if(DEBUG) {printf( "ADD: %s (%d)\n", yytext, ADD);} else {return ADD;}} - YY_BREAK -case 17: -YY_RULE_SETUP -#line 48 "lexicalStructure.lex" -{if(DEBUG) {printf( "SUB_OR_NEG: %s (%d)\n", yytext, SUB_OR_NEG);} else {return SUB_OR_NEG;}} - YY_BREAK -case 18: -YY_RULE_SETUP -#line 49 "lexicalStructure.lex" -{if(DEBUG) {printf( "MUL: %s (%d)\n", yytext, MUL);} else {return MUL;}} - YY_BREAK -case 19: -YY_RULE_SETUP -#line 50 "lexicalStructure.lex" -{if(DEBUG) {printf( "DIV: %s (%d)\n", yytext, DIV);} else {return DIV;}} - YY_BREAK -case 20: -YY_RULE_SETUP -#line 51 "lexicalStructure.lex" -{if(DEBUG) {printf( "REM: %s (%d)\n", yytext, REM);} else {return REM;}} - YY_BREAK -case 21: -YY_RULE_SETUP -#line 52 "lexicalStructure.lex" -{if(DEBUG) {printf( "LESS_THAN: %s (%d)\n", yytext, LESS_THAN);} else {return LESS_THAN;}} - YY_BREAK -case 22: -YY_RULE_SETUP -#line 53 "lexicalStructure.lex" -{if(DEBUG) {printf( "EQUAL_TO: %s (%d)\n", yytext, EQUAL_TO);} else {return EQUAL_TO;}} - YY_BREAK -case 23: -YY_RULE_SETUP -#line 54 "lexicalStructure.lex" -{if(DEBUG) {printf( "ASSIGN: %s (%d)\n", yytext, ASSIGN);} else {return ASSIGN;}} - YY_BREAK -case 24: -YY_RULE_SETUP -#line 55 "lexicalStructure.lex" -{if(DEBUG) {printf( "NOT: %s (%d)\n", yytext, NOT);} else {return NOT;}} - YY_BREAK -case 25: -YY_RULE_SETUP -#line 56 "lexicalStructure.lex" -{if(DEBUG) {printf( "AND: %s (%d)\n", yytext, AND);} else {return AND;}} - YY_BREAK -case 26: -YY_RULE_SETUP -#line 57 "lexicalStructure.lex" -{if(DEBUG) {printf( "OR: %s (%d)\n", yytext, OR);} else {return OR;}} - YY_BREAK -case 27: -YY_RULE_SETUP -#line 58 "lexicalStructure.lex" -{if(DEBUG) {printf( "DOT: %s (%d)\n", yytext, DOT);} else {return DOT;}} - YY_BREAK -case 28: -YY_RULE_SETUP -#line 60 "lexicalStructure.lex" -{if(DEBUG) {printf( "SEMI_COLON: %s (%d)\n", yytext, SEMI_COLON);} else {return SEMI_COLON;}} - YY_BREAK -case 29: -YY_RULE_SETUP -#line 61 "lexicalStructure.lex" -{if(DEBUG) {printf( "COLON: %s (%d)\n", yytext, COLON);} else {return COLON;}} - YY_BREAK -case 30: -YY_RULE_SETUP -#line 62 "lexicalStructure.lex" -{if(DEBUG) {printf( "COMMA: %s (%d)\n", yytext, COMMA);} else {return COMMA;}} - YY_BREAK -case 31: -YY_RULE_SETUP -#line 63 "lexicalStructure.lex" -{if(DEBUG) {printf( "ARROW: %s (%d)\n", yytext, ARROW);} else {return ARROW;}} - YY_BREAK -case 32: -YY_RULE_SETUP -#line 65 "lexicalStructure.lex" -{if(DEBUG) {printf( "C_INTEGER: %s (%d)\n", yytext, C_INTEGER);} else {return C_INTEGER;}} - YY_BREAK -case 33: -YY_RULE_SETUP -#line 66 "lexicalStructure.lex" -{if(DEBUG) {printf( "C_CHARACTER: %s (%d)\n", yytext, C_CHARACTER);} else {return C_CHARACTER;}} - YY_BREAK -case 34: -YY_RULE_SETUP -#line 67 "lexicalStructure.lex" -{if(DEBUG) {printf( "C_STRING: %s (%d)\n", yytext, C_STRING);} else {return C_STRING;}} - YY_BREAK -case 35: -/* rule 35 can match eol */ -YY_RULE_SETUP -#line 68 "lexicalStructure.lex" -{if(DEBUG) {printf( "COMMENT: %s (%d)\n", yytext, COMMENT);} else {return COMMENT;}} - YY_BREAK -case 36: -YY_RULE_SETUP -#line 70 "lexicalStructure.lex" -{if(DEBUG) {printf( "L_PAREN: %s (%d)\n", yytext, L_PAREN);} else {return L_PAREN;}} - YY_BREAK -case 37: -YY_RULE_SETUP -#line 71 "lexicalStructure.lex" -{if(DEBUG) {printf( "R_PAREN: %s (%d)\n", yytext, R_PAREN);} else {return R_PAREN;}} - YY_BREAK -case 38: -YY_RULE_SETUP -#line 73 "lexicalStructure.lex" -{if(DEBUG) {printf( "L_BRACKET: %s (%d)\n", yytext, L_BRACKET);} else {return L_BRACKET;}} - YY_BREAK -case 39: -YY_RULE_SETUP -#line 74 "lexicalStructure.lex" -{if(DEBUG) {printf( "R_BRACKET: %s (%d)\n", yytext, R_BRACKET);} else {return R_BRACKET;}} - YY_BREAK -case 40: -YY_RULE_SETUP -#line 76 "lexicalStructure.lex" -{if(DEBUG) {printf( "L_BRACE: %s (%d)\n", yytext, L_BRACE);} else {return L_BRACE;}} - YY_BREAK -case 41: -YY_RULE_SETUP -#line 77 "lexicalStructure.lex" -{if(DEBUG) {printf( "R_BRACE: %s (%d)\n", yytext, R_BRACE);} else {return R_BRACE;}} - YY_BREAK -case 42: -YY_RULE_SETUP -#line 79 "lexicalStructure.lex" -{if(DEBUG) {printf( "C_TRUE: %s (%d)\n", yytext, C_TRUE);} else {return C_TRUE;}} - YY_BREAK -case 43: -YY_RULE_SETUP -#line 80 "lexicalStructure.lex" -{if(DEBUG) {printf( "C_FALSE: %s (%d)\n", yytext, C_FALSE);} else {return C_FALSE;}} - YY_BREAK -case 44: -YY_RULE_SETUP -#line 81 "lexicalStructure.lex" -{if(DEBUG) {printf( "C_NULL: %s (%d)\n", yytext, C_NULL);} else {return C_NULL;}} - YY_BREAK -case 45: -YY_RULE_SETUP -#line 83 "lexicalStructure.lex" -{if(DEBUG) {printf( "ID: %s (%d)\n", yytext, ID);} else {return ID;}} - YY_BREAK -case 46: -/* rule 46 can match eol */ -YY_RULE_SETUP -#line 85 "lexicalStructure.lex" -{line_number++; column_number = 1;} - YY_BREAK -case 47: -YY_RULE_SETUP -#line 86 "lexicalStructure.lex" -{column_number++;} - YY_BREAK -case 48: -YY_RULE_SETUP -#line 87 "lexicalStructure.lex" -{column_number++;} - YY_BREAK -case 49: -YY_RULE_SETUP -#line 88 "lexicalStructure.lex" -{column_number++; return 1999;} - YY_BREAK -case 50: -YY_RULE_SETUP -#line 90 "lexicalStructure.lex" -ECHO; - YY_BREAK -#line 1094 "lex.yy.c" -case YY_STATE_EOF(INITIAL): - yyterminate(); - - 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_c_buf_p); - 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); - - 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 >= 147 ) - 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 >= 147 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - yy_is_jam = (yy_current_state == 146); - - return yy_is_jam ? 0 : yy_current_state; -} - -#ifndef YY_NO_UNPUT - - static void yyunput (int c, char * yy_bp ) -{ - char *yy_cp; - - yy_cp = (yy_c_buf_p); - - /* undo effects of setting up yytext */ - *yy_cp = (yy_hold_char); - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - int number_to_move = (yy_n_chars) + 2; - char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; -} - -#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); - - 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 90 "lexicalStructure.lex" - - diff --git a/parser b/parser deleted file mode 100755 index 02e2648389b3dc49b093d9cc710c25095f792e19..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 40856 zcmeHwdwf*Ywf~+Zhaj&c$Ut}xDB+oq@G{{U9s`2{hDQ_?9fo8=qDdxBW+bshz#*3L z5Jg3$)mClmN3T^c_tsi!Q3HxWB@%9}MWtHoG#=P zRD7en0>Nh%SUghD6*TLSZya@k?`VjJXQf|`%JwTgB9mUW)XSE73U)|GD5(5NKA|gD z+OxuJ@F*#0)hm^HR=7l{F$Jj%N^3s~6#w6pS0MG0iiI63{7|+}K~>&r=#gLk-jpf@ z*U0j^>xWj^4+_fS+0^o~O|xc9EicY2FRKjJWY*-)%A7SLtJ;?}ja#OAIdD--En8K{ zV5X61syh?5i@dT&yg`yr@_B3i*!i=!Sk7=xJ;ibL;_vq~;ZvXJa`f{-Xj}lFzot zha^4ULT7GwQH{r4Qda3HFT2^xO3KQ;l|EMCDKGaGfr(*Sv4y2mD19 zRjj1SUsf3?VVk{yB39w8sP+cHD)t2fti*0IQnueMM7tD(cM~v|Bw*f1kbg-AMl{XHnPo^;BpX(jV?ZfhDeb-MK1@Fv zdkZ+x29=fdrxoZunSX}!6Ir{=2ZxniKy~;Mc}i+MRPplgg@Qgou6K&QQPO)`;zH$5 z-YN8GE>v|TN~?)Z^QuY_6McXp0(O|_gH7~K6MdM8uHv2Mf0}z$QgKamH6IgC#Wm5* z6LPM!pA0&U8I|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4?oHKv#=)3{HXj=z&}eLOyEQxjv8qtLOUh$y zCi)8WJxSfKZ|5PJv4H54wt;)Kf4?3aaDVp-UiL_3>RcAL0X$jj?*Wyby(xY5d`?0B-z|YpbtK;@ zeRMxQ8)$>LLTV;bupLDGLdjvERQTC1d zkW>(n)bkOM6LnQM!3S}f^&L`ALH?a6lY(R$#XM%wuaY->3MzSJLgf|QZ_(c_^%cyQ z?e9+i*A{(sAFtr9Y^5onDpyfowCJnn*$Vbof)ZNC&k?Dw;zymcD3~bEag`Z|LL_Vk zq$VnTbuO;phnDtR%YWCRAHi}#Nx`i&@Jva?k0Q}I#Q7{rGd}l8Dk*&-WeMKtyWgpRo_6uOK~# zG3y)Wj@yNfb^cd+%3?n#6U``pkJQ^P;86jLPltgCBu$oY2~##=yWq>mLWUOAm692% z*byA@>Dn&fF6vyQk+^6sRP|T$&jp~Vx&t**%N+tetsE~os$3;V!?i2@gZBxEVHO2T Gmi-^SJbnZK From 2695334db91d5df680d6128aa91821b783bcfc8c Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Fri, 28 Feb 2025 15:42:43 -0500 Subject: [PATCH 085/105] added print statements to gramamr rules to check for debugging --- grammar.y | 65 ++++++++++++++++++++++++++++++++++++++++-------------- parser | Bin 0 -> 40984 bytes 2 files changed, 49 insertions(+), 16 deletions(-) create mode 100755 parser diff --git a/grammar.y b/grammar.y index e10b99f..bf8e417 100644 --- a/grammar.y +++ b/grammar.y @@ -39,7 +39,7 @@ %left ASSIGN %token ID 101 -%token T_INTEGER +%token T_INTEGER 201 %token T_ADDRESS 202 %token T_BOOLEAN 203 %token T_CHARACTER 204 @@ -120,20 +120,51 @@ idlist: ; sblock: - L_BRACE /*{st = CreateScope(st,1,1);}*/ statement_list /*{st = getParent(st);}*/ R_BRACE - | L_BRACE /*{st = CreateScope(st,1,1);}*/ dblock statement_list /*{st = getParent(st);}*/ R_BRACE + L_BRACE {st = CreateScope(st,1,1);} statement_list {st = getParent(st);} R_BRACE + | L_BRACE {st = CreateScope(st,1,1);} dblock statement_list {st = getParent(st);} R_BRACE ; dblock: L_BRACKET declaration_list R_BRACKET; declaration_list: - declaration /*{CreateEntry(st,cur_type,cur_value);}*/ SEMI_COLON declaration_list - | declaration //{CreateEntry(st,cur_type,cur_value);} + declaration + {printf( + "declaration list a rule encountered"); + //CreateEntry(st,cur_type,cur_value); + } + SEMI_COLON declaration_list + | declaration + {printf( + "declaration rule b encountered"); + //CreateEntry(st,cur_type,cur_value); + } ; declaration: - ID COLON ID //{cur_value = strdup($1);cur_type = strdup($3);} + ID COLON ID { + printf("declaration rule encountered"); +// if(cur_value != NULL){ +// char* delete1 = cur_value; + printf("delete1 var assigned to cur_value"); +// free(delete1); + printf("delete1 var freed"); +// } +// if(cur_type != NULL){ +// char* delete2 = cur_type; +// free(delete2);} +// int len = strlen($1); + printf("length determined"); +// cur_value = malloc(len + 1); + printf("space allocated"); +// strcpy(cur_value, $1); + printf("string copied over"); + +// len = strlen($3); +// cur_type = malloc(len + 1); +// strcpy(cur_type, $3); +// printf("value var is %s type var is %s\n",cur_value,cur_type); + } | types COLON ID ; @@ -220,25 +251,27 @@ types: %% void yyerror(const char *err) { - fprintf(stderr, "ERROR: %s at token %s at line number %d,column number %d\n", err,yytext,line_number,column_number); + // fprintf(stderr, "ERROR: %s at token %s at line number %d,column number %d\n", err,yytext,line_number,column_number); } int main() { - //cur_value = NULL; - //cur_type = NULL; + char *str = strdup("taco"); + cur_value = NULL; + cur_type = NULL; token_tracker = 1; st=CreateScope(NULL,1,1); - int a; - while ((a = yyparse()) != EOF){ - token_tracker++; + //int a; + yyparse(); + //while ((a = yyparse() != EOF){ + // token_tracker++; //printf("%d = a: yytext = %s: yychar = %d, token number: %d\n", a, yytext, yychar,token_tracker); - if(yytext[0] == '\n'){ + //if(yytext[0] == '\n'){ FILE* f = fdopen(1,"w"); print_symbol_table(getAncestor(st),f); fclose(f); - break; - } - } + // break; + //} + //} return 0; } diff --git a/parser b/parser new file mode 100755 index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)e zn2&3bpnG{rU){e`aFG;NOTS+`9#?__AeL)3 z^wo7u1qUlZ39bF-HL0)SM_tcR@EUdDMe5rnRNx&TR7It)uFETU+){sQ{(rFO7nBOi z3I-@}O^1pfMWX8=LvYGr$GFd!QYR#=@+z(1-yufVo|V3O-XQ%O>VFMgie06z?pN5Q zewVDjs)ou}wIf|`ArYmoo;OIj8AKdi0vNwaUqQN0X4Yp-Qgpk3*70BIDT9NcOf;3h zy3R3L>K|5u651{4RGEL4g|77FWk7>VWu?OmRqP0k_;qd Date: Fri, 28 Feb 2025 17:42:47 -0500 Subject: [PATCH 086/105] Updated header --- symbol_table.c | 261 +++++++++++++++++++++++-------------------------- symbol_table.h | 55 ++++++----- 2 files changed, 157 insertions(+), 159 deletions(-) diff --git a/symbol_table.c b/symbol_table.c index 1a2e375..48a7a42 100644 --- a/symbol_table.c +++ b/symbol_table.c @@ -1,156 +1,143 @@ +#include "symbol_table.h" + #include #include #include -#include "symbol_table.h" - -SymbolTable* CreateScope(SymbolTable* ParentScope, int Line, int Column){ - SymbolTable* table = (SymbolTable*)malloc(sizeof(SymbolTable)); - table->Line_Number = Line; - table->Column_Number = Column; - table->Parent_Scope = ParentScope; - table->Children_Scope = NULL; - table->entries = NULL; - if(ParentScope != NULL){ - if(ParentScope->Children_Scope == NULL){ - ListOfTable* newEntry = (ListOfTable*)malloc(sizeof(ListOfTable)); - newEntry->next = NULL; - //newEntry->prev = NULL; - newEntry->table = table; - ParentScope->Children_Scope = newEntry; - } else{ - ListOfTable* newEntry = (ListOfTable*)malloc(sizeof(ListOfTable)); - //newEntry->prev = NULL; - newEntry->table= table; - ListOfTable* oldEntry = ParentScope->Children_Scope; - ParentScope->Children_Scope = newEntry; - newEntry->next = oldEntry; - } - } - return table; - } - - -TableNode* CreateEntry(SymbolTable* table, char* typeOf, char* id){ - TableNode* newEntry = (TableNode*)malloc(sizeof(TableNode)); - newEntry->theType = typeOf; - newEntry->theName = id; - if(table->entries == NULL){ - table->entries = newEntry; - return newEntry; - } else{ - TableNode* oldEntry = table->entries; - table->entries = newEntry; - newEntry->next = oldEntry; - return newEntry; - } -} -TableNode * table_lookup(SymbolTable * table, char * x){ - TableNode * entrie = table->entries; - for(; entrie != NULL; entrie = entrie->next){ - if (!strcmp(entrie->theName, x)){ - return entrie; - } - } - return NULL; -} -TableNode * look_up(SymbolTable * table, char * x){ - if(table == NULL){ - return NULL; - } - TableNode * ret = table_lookup(table, x); - if (ret != NULL){ - return ret; - } - return look_up(table->Parent_Scope, x); +SymbolTable* CreateScope(SymbolTable* ParentScope, int Line, int Column) { + SymbolTable* table = (SymbolTable*)malloc(sizeof(SymbolTable)); + table->Line_Number = Line; + table->Column_Number = Column; + table->Parent_Scope = ParentScope; + table->Children_Scope = NULL; + table->entries = NULL; + if (ParentScope != NULL) { + if (ParentScope->Children_Scope == NULL) { + ListOfTable* newEntry = (ListOfTable*)malloc(sizeof(ListOfTable)); + newEntry->next = NULL; + // newEntry->prev = NULL; + newEntry->table = table; + ParentScope->Children_Scope = newEntry; + } else { + ListOfTable* newEntry = (ListOfTable*)malloc(sizeof(ListOfTable)); + // newEntry->prev = NULL; + newEntry->table = table; + ListOfTable* oldEntry = ParentScope->Children_Scope; + ParentScope->Children_Scope = newEntry; + newEntry->next = oldEntry; + } + } + return table; } -SymbolTable * getAncestor(SymbolTable * table){ - if(table->Parent_Scope == NULL){ - //if table has no parent, return itself - return table; - } else { - //call function recursively to grab ancestor - return getAncestor(table->Parent_Scope); - } +TableNode* CreateEntry(SymbolTable* table, char* typeOf, char* id) { + TableNode* newEntry = (TableNode*)malloc(sizeof(TableNode)); + newEntry->theType = typeOf; + newEntry->theName = id; + if (table->entries == NULL) { + table->entries = newEntry; + return newEntry; + } else { + TableNode* oldEntry = table->entries; + table->entries = newEntry; + newEntry->next = oldEntry; + return newEntry; + } } -void print_symbol_table(SymbolTable *table, FILE *file_ptr){ - if(table->Parent_Scope == NULL){ - fprintf(file_ptr, "%-17s: %-6s : %-6s : %-21s: %-28s\n", "NAME", "SCOPE", "PARENT", "TYPE", "Extra annotation"); - } - TableNode * entrie = table->entries; - fprintf(file_ptr, "-----------------:--------:--------:----------------------:-----------------------------\n"); - int parant_scope = 0; - int current_scope = 0; - if(table->Parent_Scope != NULL){ - parant_scope = table->Parent_Scope->Line_Number*1000 + table->Parent_Scope->Column_Number; - current_scope = table->Line_Number*1000 + table->Column_Number; - } else { - current_scope = 1001; - } - - for(; entrie != NULL; entrie = entrie->next){ - if (parant_scope == 0){ - fprintf(file_ptr, "%-17s: %06d : : %-21s: %-28s\n", - entrie->theName, current_scope, - entrie->theType, "Extra annotation"); - } else { - fprintf(file_ptr, "%-17s: %06d : %06d : %-21s: %-28s\n", - entrie->theName, current_scope, parant_scope, - entrie->theType, "Extra annotation"); - } - } - if (table->Children_Scope != NULL){ - ListOfTable* node = table->Children_Scope; - for(; node != NULL; node = node->next){ - print_symbol_table(node->table, file_ptr); - } - } - if (table->Parent_Scope == NULL) { - fprintf(file_ptr, "-----------------:--------:--------:----------------------:-----------------------------\n"); - } +TableNode* table_lookup(SymbolTable* table, char* x) { + TableNode* entrie = table->entries; + for (; entrie != NULL; entrie = entrie->next) { + if (!strcmp(entrie->theName, x)) { + return entrie; + } + } + return NULL; +} +TableNode* look_up(SymbolTable* table, char* x) { + if (table == NULL) { + return NULL; + } + TableNode* ret = table_lookup(table, x); + if (ret != NULL) { + return ret; + } + return look_up(table->Parent_Scope, x); } -SymbolTable * getParent(SymbolTable* st){ - return st->Parent_Scope; - } +void print_symbol_table(SymbolTable* table, FILE* file_ptr) { + if (table->Parent_Scope == NULL) { + fprintf(file_ptr, "%-17s: %-6s : %-6s : %-21s: %-28s\n", "NAME", "SCOPE", + "PARENT", "TYPE", "Extra annotation"); + } + TableNode* entrie = table->entries; + fprintf(file_ptr, + "-----------------:--------:--------:----------------------:---------" + "--------------------\n"); + int parant_scope = 0; + int current_scope = 0; + if (table->Parent_Scope != NULL) { + parant_scope = table->Parent_Scope->Line_Number * 1000 + + table->Parent_Scope->Column_Number; + current_scope = table->Line_Number * 1000 + table->Column_Number; + } else { + current_scope = 1001; + } -ListOfTable * getChildren(SymbolTable* st){ - return st->Children_Scope; - } -SymbolTable * getFirstChild(ListOfTable * lt){ - return lt->table; - } -ListOfTable * getRestOfChildren(ListOfTable * lt){ - return lt->next; - } -TableNode * getFirstEntry(SymbolTable * st){ - return st->entries; - } -TableNode * getNextEntry(TableNode * tn){ - return tn->next; - } -char * getType(TableNode * tn){ - return tn->theType; - } -char * getName(TableNode * tn){ - return tn->theName; - } -int getLine(SymbolTable * st){ - return st->Line_Number; - } -int getColumn(SymbolTable *st){ - return st->Column_Number; - } -//uncomment the below main function along with the headers above for a simple standalone test of table and entry creation + for (; entrie != NULL; entrie = entrie->next) { + if (parant_scope == 0) { + fprintf(file_ptr, "%-17s: %06d : : %-21s: %-28s\n", + entrie->theName, current_scope, entrie->theType, + "Extra annotation"); + } else { + fprintf(file_ptr, "%-17s: %06d : %06d : %-21s: %-28s\n", entrie->theName, + current_scope, parant_scope, entrie->theType, "Extra annotation"); + } + } + if (table->Children_Scope != NULL) { + ListOfTable* node = table->Children_Scope; + for (; node != NULL; node = node->next) { + print_symbol_table(node->table, file_ptr); + } + } + if (table->Parent_Scope == NULL) { + fprintf(file_ptr, + "-----------------:--------:--------:----------------------:-------" + "----------------------\n"); + } +} + +SymbolTable* getAncestor(SymbolTable* table) { + if (table->Parent_Scope == NULL) { + // if table has no parent, return itself + return table; + } else { + // call function recursively to grab ancestor + return getAncestor(table->Parent_Scope); + } +} + +SymbolTable* getParent(SymbolTable* st) { return st->Parent_Scope; } + +ListOfTable* getChildren(SymbolTable* st) { return st->Children_Scope; } +SymbolTable* getFirstChild(ListOfTable* lt) { return lt->table; } +ListOfTable* getRestOfChildren(ListOfTable* lt) { return lt->next; } +TableNode* getFirstEntry(SymbolTable* st) { return st->entries; } +TableNode* getNextEntry(TableNode* tn) { return tn->next; } +char* getType(TableNode* tn) { return tn->theType; } +char* getName(TableNode* tn) { return tn->theName; } +int getLine(SymbolTable* st) { return st->Line_Number; } +int getColumn(SymbolTable* st) { return st->Column_Number; } +// uncomment the below main function along with the headers above for a simple +// standalone test of table and entry creation /* int main(){ char* String = "STRING"; char* X = "X"; SymbolTable* Second = CreateScope(NULL, 2,2); - printf("Line number is %d, Column number of scope is %d\n",Second->Line_Number,Second->Column_Number); - TableNode* First_Entry = CreateEntry(Second,String,X); + printf("Line number is %d, Column number of scope is +%d\n",Second->Line_Number,Second->Column_Number); TableNode* First_Entry = +CreateEntry(Second,String,X); printf("The type of the first entry is %s\n",First_Entry->theType); return 0; diff --git a/symbol_table.h b/symbol_table.h index 0d30f59..0ef5c8a 100644 --- a/symbol_table.h +++ b/symbol_table.h @@ -3,30 +3,41 @@ #include #include -typedef struct ListOfTable{ - struct SymbolTable* table; - //struct ListOfTable* prev; - struct ListOfTable* next; +typedef struct ListOfTable { + struct SymbolTable* table; + // struct ListOfTable* prev; + struct ListOfTable* next; -}ListOfTable; +} ListOfTable; -typedef struct TableNode{ - char* theType; - char* theName; - struct TableNode* next; -}TableNode; +typedef struct TableNode { + char* theType; + char* theName; + struct TableNode* next; +} TableNode; -typedef struct SymbolTable{ - TableNode* entries; - struct SymbolTable* Parent_Scope; - struct ListOfTable* Children_Scope; - int Line_Number; - int Column_Number; -}SymbolTable; +typedef struct SymbolTable { + TableNode* entries; + struct SymbolTable* Parent_Scope; + struct ListOfTable* Children_Scope; + int Line_Number; + int Column_Number; +} SymbolTable; - -TableNode* CreateEntry(SymbolTable* table, char* typeOf, char* id); SymbolTable* CreateScope(SymbolTable* ParentScope, int Line, int Column); -TableNode * table_lookup(SymbolTable * table, char * x); -TableNode * look_up(SymbolTable * table, char * x); -void print_symbol_table(SymbolTable *table, FILE *file_ptr); +TableNode* CreateEntry(SymbolTable* table, char* typeOf, char* id); +TableNode* table_lookup(SymbolTable* table, char* x); +TableNode* look_up(SymbolTable* table, char* x); +void print_symbol_table(SymbolTable* table, FILE* file_ptr); + +SymbolTable* getAncestor(SymbolTable* table); +SymbolTable* getParent(SymbolTable* st); +ListOfTable* getChildren(SymbolTable* st); +SymbolTable* getFirstChild(ListOfTable* lt); +ListOfTable* getRestOfChildren(ListOfTable* lt); +TableNode* getFirstEntry(SymbolTable* st); +TableNode* getNextEntry(TableNode* tn); +char* getType(TableNode* tn); +char* getName(TableNode* tn); +int getLine(SymbolTable* st); +int getColumn(SymbolTable* st); \ No newline at end of file From 63212a3d63e85a97ca1f78f28274337cfdaff1d4 Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Fri, 28 Feb 2025 18:16:44 -0500 Subject: [PATCH 087/105] entries are working but not freeing memory so potential for leaks --- .Makefile.swp | Bin 12288 -> 0 bytes grammar.y | 28 +++++++++++++++------------- lexicalStructure.lex | 4 +++- parser | Bin 40984 -> 0 bytes 4 files changed, 18 insertions(+), 14 deletions(-) delete mode 100644 .Makefile.swp delete mode 100755 parser diff --git a/.Makefile.swp b/.Makefile.swp deleted file mode 100644 index 731dce035acfa5772ee102a56adbe2804c3e8404..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI2y>HV%7>5s72$T;&2PBpQiqryjN-0uhsY7W?RjEvTRst2rxqMK^w$2wIs`ywK zkeFD2e}KZk!hi$=A3H2;?0{7M02UbdonxnU;?M|*0rW1P*w1(6@Z-{^FZcJdpfEbBo7a0eLYCIc(eazQ!@T3#VVHM9F*iV<0Uy9y@B%D@$KVdQ z1TKO}V1Oea2R4J1?Kls-2T#Fma0{FV2f+aNv5m1e;5B##9)XA81}K9PxC|`N2fp?p zA3Ov#Fai3(x2Q6Bcfk_yz&w}&k&l0H zJ!#5hfDDiUGC&5%z~3{FlQnLX_#rb?EdIMJ?OM&2rm_oWC9Ba%8V{MuUrY{4uDHIM zKQK6bVR|Tu=}@C#t~t?Xjw@`>!hbntzM0I8P;oP_M5w~(ePK~FuKBVUnzkEM?6yn; zW2e*oK*;Dx%g%hA+tIxgw!08@y)cq}N@_NLo~|GI>|ubgS_@n;S5+v(%_zE~;N}Ul zo;m|(Jq+OEiBuWXJ*Su4-^)yy>Ap@KQ!WcnS9iu=6kdw&%T8+2PXiLl-C7qM*+hNV9>051q^kD^MW)#qx zhv6huIPq+Ck8!vatMGUW)t#N3o4ycPXjMHhsGC@F9MxNOZ1=R1bw|~uFcD%bS(Gdv z%@L!?&QECHsZ~kVNALSi*6LtQ0$YYcuBuL*!{X?gp;K{=uca84TjRWWQLy-mvBnve bTDLbhdK9V;P)}!pT8s{ASFG7t*>Tt}gkE>x diff --git a/grammar.y b/grammar.y index bf8e417..2302167 100644 --- a/grammar.y +++ b/grammar.y @@ -10,8 +10,8 @@ extern char* yytext; extern int yychar; SymbolTable * st; - char* cur_value; - char* cur_type; + //char* cur_value; + //char* cur_type; int token_tracker; extern int line_number; extern int column_number; @@ -120,8 +120,8 @@ idlist: ; sblock: - L_BRACE {st = CreateScope(st,1,1);} statement_list {st = getParent(st);} R_BRACE - | L_BRACE {st = CreateScope(st,1,1);} dblock statement_list {st = getParent(st);} R_BRACE + L_BRACE {st = CreateScope(st,2,2);} statement_list {st = getParent(st);} R_BRACE + | L_BRACE {st = CreateScope(st,2,2);} dblock statement_list {st = getParent(st);} R_BRACE ; dblock: @@ -143,22 +143,24 @@ declaration_list: declaration: ID COLON ID { - printf("declaration rule encountered"); + + CreateEntry(st,strdup($1),strdup($3)); +// printf("declaration rule encountered"); // if(cur_value != NULL){ // char* delete1 = cur_value; - printf("delete1 var assigned to cur_value"); +// printf("delete1 var assigned to cur_value"); // free(delete1); - printf("delete1 var freed"); +// printf("delete1 var freed"); // } // if(cur_type != NULL){ // char* delete2 = cur_type; // free(delete2);} // int len = strlen($1); - printf("length determined"); +// printf("length determined"); // cur_value = malloc(len + 1); - printf("space allocated"); +// printf("space allocated"); // strcpy(cur_value, $1); - printf("string copied over"); +// printf("string copied over"); // len = strlen($3); // cur_type = malloc(len + 1); @@ -255,9 +257,9 @@ void yyerror(const char *err) { } int main() { - char *str = strdup("taco"); - cur_value = NULL; - cur_type = NULL; + //char *str = strdup("taco"); + //cur_value = NULL; + //cur_type = NULL; token_tracker = 1; st=CreateScope(NULL,1,1); diff --git a/lexicalStructure.lex b/lexicalStructure.lex index 3bd0332..5f1f8ec 100644 --- a/lexicalStructure.lex +++ b/lexicalStructure.lex @@ -12,6 +12,8 @@ #ifndef DEBUG #define DEBUG 0 #endif + + %} STARCOM [^\*]|\*+[^\)\*]+ @@ -79,7 +81,7 @@ SCHAR \\n|\\t|\\\"|[^\"\n\\] "false" {if(DEBUG) {printf( "C_FALSE: %s (%d)\n", yytext, C_FALSE);} else {return C_FALSE;}} "null" {if(DEBUG) {printf( "C_NULL: %s (%d)\n", yytext, C_NULL);} else {return C_NULL;}} -{ID} {if(DEBUG) {printf( "ID: %s (%d)\n", yytext, ID);} else {return ID;}} +{ID} {if(DEBUG) {printf( "ID: %s (%d)\n", yytext, ID);} else {yylval.words = strdup(yytext); return ID;}} \n {line_number++; column_number = 1;} \t {column_number++;} diff --git a/parser b/parser deleted file mode 100755 index 414407a4dbe4de88595d639d6eff1860f4fbd916..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 40984 zcmeHwdwf*Y_3zH(KtLb~WFR1q5qU#G0s#^b2#o35h0|IGK?|je;S{ zc#K3u#agZU(`u`>{*+qU`bZEBzG`UswY0Urri$&vpiL2LRAlaV?Z=rjhlJXDf4BGk zk(1Avwf1`Lz1Lp*bzZsIv3f;(TpUwJ0$ap*YM7wpOUA~1N`kR`mdgg?cN`nb`hlE? zGhec;@L0THD3~PW5&%grosb^jXhCKQsuB_;z21(t^8`mhmLk%mrx7aCR`}9vA*Z0? z8~GIoKC{3>;{;tnvmW^-rB3iu8e`!gS?^;KDm`)+>Di^8UFs>=B^{xl@+bL(&Rl8F z3bVkYLqV%vsnoN=p6U*;@snaX9yNinr@Z4rZ+ zW}>O)jNdNO${z93B%kD`ZcE+#!4=QEnb>~wkJnC0)29r$yM$z@+@wP?bdWt+L?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UTB^C|StBs785@F=K z2IY6TwpL(-;em-z7w(cJL_w;3u2OepF}jTh&$0W_fEL44ReG$R9(?yyMPnly0lVr_ z*hMh7g7m^_Z7sbeY7B026yd{T30_34^u<^vcTgDmy_Hl|@hrdUN)_CzR{15B9&|9D zpIljhvf_U$BTrvdY?hb`s4Tq95L^e9OG}Kb5Y6T2U@@je7g>*Y0uZIe_>B!lmupKk zAOA3b!yxZLBKD{U^Q>xkOk(b#s+5#R-9Yr!2nUkFOACw~@2U(|Y{7d60pB&=N*YEz z*B}MKLh2@>fne8LQx+SMCENUE0ZRvRq5I20%)^6A8Rw%!FJpwiIA{$x3R~5O2G7+F+UJObAiHfM38;h4B}}t5_yp zjP+)2tqf*X`OzHyK&^?iC5WiWC@YqvB}-Rj&>Dk_m%6JSo+~woH){PU4;$>)%8O`6|xE^cp*+K z1r7aNsjpxb37HPH9#o{cK+O83QeVLdN>DO&tTS9_c;`_D?tgZ`WryUM|SD* zC_mKwKn2xxb8JueVJ*KKRJs?a^ws@B14;&!k^HRm(}B}bhLftS^ws@G1=amVlBI)e zn2&3bpnG{rU){e`aFG;NOTS+`9#?__AeL)3 z^wo7u1qUlZ39bF-HL0)SM_tcR@EUdDMe5rnRNx&TR7It)uFETU+){sQ{(rFO7nBOi z3I-@}O^1pfMWX8=LvYGr$GFd!QYR#=@+z(1-yufVo|V3O-XQ%O>VFMgie06z?pN5Q zewVDjs)ou}wIf|`ArYmoo;OIj8AKdi0vNwaUqQN0X4Yp-Qgpk3*70BIDT9NcOf;3h zy3R3L>K|5u651{4RGEL4g|77FWk7>VWu?OmRqP0k_;qd Date: Tue, 4 Mar 2025 16:14:01 -0500 Subject: [PATCH 088/105] Fixed formatting in lex; Updated Makefile t#30 --- .gitignore | 1 - Makefile | 25 ++-- src/grammar.y | 2 +- src/lexicalStructure.lex | 123 ++++++++--------- src/runner.c | 290 ++++++++++++++++++++------------------- src/runner.h | 34 +++-- 6 files changed, 240 insertions(+), 235 deletions(-) diff --git a/.gitignore b/.gitignore index 9110e5c..e6bdaa4 100644 --- a/.gitignore +++ b/.gitignore @@ -6,5 +6,4 @@ grammar.tab.c grammar.tab.h .vscode out -src tmp \ No newline at end of file diff --git a/Makefile b/Makefile index 44c2969..07d1d87 100644 --- a/Makefile +++ b/Makefile @@ -5,8 +5,7 @@ EXE := alpha CFLAGS := YACC := bison -compiler: tmp/grammar.tab.c tmp/lex.yy.c tmp/runner.o tmp/symbol_table.o - $(CC) $(CFLAGS) -o $(EXE) tmp/runner.o tmp/lex.yy.c tmp/symbol_table.o +compiler: runner tmp/grammar.tab.c: src/grammar.y mkdir -p tmp @@ -14,7 +13,7 @@ tmp/grammar.tab.c: src/grammar.y mv grammar.tab.c tmp/ mv grammar.tab.h tmp/ -tmp/lex.yy.c: src/lexicalStructure.lex +tmp/lex.yy.c: src/lexicalStructure.lex tmp/grammar.tab.c $(FLEX) -o tmp/lex.yy.c $(LEX) mv flex.h tmp/ @@ -25,21 +24,17 @@ tmp/symbol_table.o: src/symbol_table.c src/symbol_table.h $(CC) $(CFLAGS) -o tmp/symbol_table.o -c src/symbol_table.c parser : tmp/lex.yy.c tmp/grammar.tab.c - $(CC) -o parser tmp/lex.yy.c tmp/grammar.tab.c src/symbol_table.c + $(CC) -o parser tmp/lex.yy.c tmp/grammar.tab.c runner: tmp/lex.yy.c tmp/runner.o tmp/symbol_table.o $(CC) $(CFLAGS) -o $(EXE) tmp/runner.o tmp/lex.yy.c tmp/symbol_table.o - - - - - - debug: CFLAGS += -DDEBUG=1 debug: clean compiler -test: +test: test-s1 test-s2 + +test-s1: ./$(EXE) -tok ./tests/sprint1/test_comment_fix1.alpha ./$(EXE) -tok ./tests/sprint1/test_comment_fix2.alpha ./$(EXE) -tok ./tests/sprint1/test_comment_issues.alpha @@ -55,6 +50,11 @@ test: ./$(EXE) -tok ./tests/sprint1/test_simple_literals.alpha ./$(EXE) -tok ./tests/sprint1/test_variables.alpha +test-s2: + ./$(EXE) -tok ./tests/sprint2/alpha/test_library.alpha + ./$(EXE) -tok ./tests/sprint2/alpha/test_one_line.alpha + ./$(EXE) -tok ./tests/sprint2/alpha/test_simple.alpha + clean: rm -f *.o rm -f lex.yy.c @@ -65,4 +65,5 @@ clean: rm -f grammar.tab.h rm -f *.st rm -rf out - rm -rf tmp \ No newline at end of file + rm -rf tmp + rm -f parser \ No newline at end of file diff --git a/src/grammar.y b/src/grammar.y index 2302167..0645a4a 100644 --- a/src/grammar.y +++ b/src/grammar.y @@ -4,7 +4,7 @@ // Prologue %{ #include - #include "symbol_table.c" + #include "../src/symbol_table.c" extern int yylex(void); void yyerror(const char *err); extern char* yytext; diff --git a/src/lexicalStructure.lex b/src/lexicalStructure.lex index 5f1f8ec..79ccaea 100644 --- a/src/lexicalStructure.lex +++ b/src/lexicalStructure.lex @@ -1,91 +1,84 @@ -/* Lexical Analysis with Flex (1.6.0) We used some of the code from this manual */ -/* so we placed the citation here. */ -/* definitions */ +/* Lexical Analyzer with Flex (1.6.0) */ %option noyywrap %option header-file="flex.h" %{ - #include - //#include "typedefs.h" - #include "grammar.tab.h" - int line_number = 1, column_number = 1; - #ifndef DEBUG - #define DEBUG 0 - #endif - - + #include + //#include "typedefs.h" + #include "grammar.tab.h" + int line_number = 1, column_number = 1; + #ifndef DEBUG + #define DEBUG 0 + #endif %} STARCOM [^\*]|\*+[^\)\*]+ PARENCOM [^\)]|[^\*\)]+\)+ +COMMENT \(\*{STARCOM}*\*\)|\(\*{PARENCOM}*\*\) ID [A-Za-z_][0-9A-Za-z_]* DIGIT [0-9] CHAR \\n|\\t|\\'|[^'\n\t\\]|\\\\ - /* char can be a newline, tab, an escaped quote, or anything but a single quote, an actual line break, an actual tab, or a backslash by itself (to prevent confusion from escaped quote */ SCHAR \\n|\\t|\\\"|[^\"\n\\] - /* similar to above, a string Char (SCHAR) is the same as a CHAR except we cannot have double quotes instead of single quotes. Double quotes need to be escaped in Flex unlike single quotes based on documentation */ %% -"integer" {if(DEBUG) {printf( "T_INTEGER: %s (%d)\n", yytext, T_INTEGER);} else {return T_INTEGER;}} -"address" {if(DEBUG) {printf( "T_ADDRESS: %s (%d)\n", yytext, T_ADDRESS);} else {return T_ADDRESS;}} -"Boolean" {if(DEBUG) {printf( "T_BOOLEAN: %s (%d)\n", yytext, T_BOOLEAN);} else {return T_BOOLEAN;}} -"character" {if(DEBUG) {printf( "T_CHARACTER: %s (%d)\n", yytext, T_CHARACTER);} else {return T_CHARACTER;}} +"integer" {if(DEBUG) {printf( "T_INTEGER: %s (%d)\n", yytext, T_INTEGER);} else {return T_INTEGER;}} +"address" {if(DEBUG) {printf( "T_ADDRESS: %s (%d)\n", yytext, T_ADDRESS);} else {return T_ADDRESS;}} +"Boolean" {if(DEBUG) {printf( "T_BOOLEAN: %s (%d)\n", yytext, T_BOOLEAN);} else {return T_BOOLEAN;}} +"character" {if(DEBUG) {printf( "T_CHARACTER: %s (%d)\n", yytext, T_CHARACTER);} else {return T_CHARACTER;}} -"while" {if(DEBUG) {printf( "WHILE: %s (%d)\n", yytext, WHILE);} else {return WHILE;}} -"if" {if(DEBUG) {printf( "IF: %s (%d)\n", yytext, IF);} else {return IF;}} -"then" {if(DEBUG) {printf( "THEN: %s (%d)\n", yytext, THEN);} else {return THEN;}} -"else" {if(DEBUG) {printf( "ELSE: %s (%d)\n", yytext, ELSE);} else {return ELSE;}} -"type" {if(DEBUG) {printf( "TYPE: %s (%d)\n", yytext, TYPE);} else {return TYPE;}} -"function" {if(DEBUG) {printf( "FUNCTION: %s (%d)\n", yytext, FUNCTION);} else {return FUNCTION;}} -"return" {if(DEBUG) {printf( "RETURN: %s (%d)\n", yytext, RETURN);} else {return RETURN;}} -"external" {if(DEBUG) {printf( "EXTERNAL: %s (%d)\n", yytext, EXTERNAL);} else {return EXTERNAL;}} -"as" {if(DEBUG) {printf( "AS: %s (%d)\n", yytext, AS);} else {return AS;}} +"while" {if(DEBUG) {printf( "WHILE: %s (%d)\n", yytext, WHILE);} else {return WHILE;}} +"if" {if(DEBUG) {printf( "IF: %s (%d)\n", yytext, IF);} else {return IF;}} +"then" {if(DEBUG) {printf( "THEN: %s (%d)\n", yytext, THEN);} else {return THEN;}} +"else" {if(DEBUG) {printf( "ELSE: %s (%d)\n", yytext, ELSE);} else {return ELSE;}} +"type" {if(DEBUG) {printf( "TYPE: %s (%d)\n", yytext, TYPE);} else {return TYPE;}} +"function" {if(DEBUG) {printf( "FUNCTION: %s (%d)\n", yytext, FUNCTION);} else {return FUNCTION;}} +"return" {if(DEBUG) {printf( "RETURN: %s (%d)\n", yytext, RETURN);} else {return RETURN;}} +"external" {if(DEBUG) {printf( "EXTERNAL: %s (%d)\n", yytext, EXTERNAL);} else {return EXTERNAL;}} +"as" {if(DEBUG) {printf( "AS: %s (%d)\n", yytext, AS);} else {return AS;}} -"release" {if(DEBUG) {printf( "RELEASE: %s (%d)\n", yytext, RELEASE);} else {return RELEASE;}} -"reserve" {if(DEBUG) {printf( "RESERVE: %s (%d)\n", yytext, RESERVE);} else {return RESERVE;}} +"release" {if(DEBUG) {printf( "RELEASE: %s (%d)\n", yytext, RELEASE);} else {return RELEASE;}} +"reserve" {if(DEBUG) {printf( "RESERVE: %s (%d)\n", yytext, RESERVE);} else {return RESERVE;}} -"+" {if(DEBUG) {printf( "ADD: %s (%d)\n", yytext, ADD);} else {return ADD;}} -"-" {if(DEBUG) {printf( "SUB_OR_NEG: %s (%d)\n", yytext, SUB_OR_NEG);} else {return SUB_OR_NEG;}} -"*" {if(DEBUG) {printf( "MUL: %s (%d)\n", yytext, MUL);} else {return MUL;}} -"/" {if(DEBUG) {printf( "DIV: %s (%d)\n", yytext, DIV);} else {return DIV;}} -"%" {if(DEBUG) {printf( "REM: %s (%d)\n", yytext, REM);} else {return REM;}} -"<" {if(DEBUG) {printf( "LESS_THAN: %s (%d)\n", yytext, LESS_THAN);} else {return LESS_THAN;}} -"=" {if(DEBUG) {printf( "EQUAL_TO: %s (%d)\n", yytext, EQUAL_TO);} else {return EQUAL_TO;}} -":=" {if(DEBUG) {printf( "ASSIGN: %s (%d)\n", yytext, ASSIGN);} else {return ASSIGN;}} -"!" {if(DEBUG) {printf( "NOT: %s (%d)\n", yytext, NOT);} else {return NOT;}} -"&" {if(DEBUG) {printf( "AND: %s (%d)\n", yytext, AND);} else {return AND;}} -"|" {if(DEBUG) {printf( "OR: %s (%d)\n", yytext, OR);} else {return OR;}} -"." {if(DEBUG) {printf( "DOT: %s (%d)\n", yytext, DOT);} else {return DOT;}} +"+" {if(DEBUG) {printf( "ADD: %s (%d)\n", yytext, ADD);} else {return ADD;}} +"-" {if(DEBUG) {printf( "SUB_OR_NEG: %s (%d)\n", yytext, SUB_OR_NEG);} else {return SUB_OR_NEG;}} +"*" {if(DEBUG) {printf( "MUL: %s (%d)\n", yytext, MUL);} else {return MUL;}} +"/" {if(DEBUG) {printf( "DIV: %s (%d)\n", yytext, DIV);} else {return DIV;}} +"%" {if(DEBUG) {printf( "REM: %s (%d)\n", yytext, REM);} else {return REM;}} +"<" {if(DEBUG) {printf( "LESS_THAN: %s (%d)\n", yytext, LESS_THAN);} else {return LESS_THAN;}} +"=" {if(DEBUG) {printf( "EQUAL_TO: %s (%d)\n", yytext, EQUAL_TO);} else {return EQUAL_TO;}} +":=" {if(DEBUG) {printf( "ASSIGN: %s (%d)\n", yytext, ASSIGN);} else {return ASSIGN;}} +"!" {if(DEBUG) {printf( "NOT: %s (%d)\n", yytext, NOT);} else {return NOT;}} +"&" {if(DEBUG) {printf( "AND: %s (%d)\n", yytext, AND);} else {return AND;}} +"|" {if(DEBUG) {printf( "OR: %s (%d)\n", yytext, OR);} else {return OR;}} +"." {if(DEBUG) {printf( "DOT: %s (%d)\n", yytext, DOT);} else {return DOT;}} -";" {if(DEBUG) {printf( "SEMI_COLON: %s (%d)\n", yytext, SEMI_COLON);} else {return SEMI_COLON;}} -":" {if(DEBUG) {printf( "COLON: %s (%d)\n", yytext, COLON);} else {return COLON;}} -"," {if(DEBUG) {printf( "COMMA: %s (%d)\n", yytext, COMMA);} else {return COMMA;}} -"->" {if(DEBUG) {printf( "ARROW: %s (%d)\n", yytext, ARROW);} else {return ARROW;}} +";" {if(DEBUG) {printf( "SEMI_COLON: %s (%d)\n", yytext, SEMI_COLON);} else {return SEMI_COLON;}} +":" {if(DEBUG) {printf( "COLON: %s (%d)\n", yytext, COLON);} else {return COLON;}} +"," {if(DEBUG) {printf( "COMMA: %s (%d)\n", yytext, COMMA);} else {return COMMA;}} +"->" {if(DEBUG) {printf( "ARROW: %s (%d)\n", yytext, ARROW);} else {return ARROW;}} -{DIGIT}+ {if(DEBUG) {printf( "C_INTEGER: %s (%d)\n", yytext, C_INTEGER);} else {return C_INTEGER;}} -'{CHAR}' {if(DEBUG) {printf( "C_CHARACTER: %s (%d)\n", yytext, C_CHARACTER);} else {return C_CHARACTER;}} -\"{SCHAR}*\" {if(DEBUG) {printf( "C_STRING: %s (%d)\n", yytext, C_STRING);} else {return C_STRING;}} -\(\*{STARCOM}*\*\)|\(\*{PARENCOM}*\*\) {if(DEBUG) {printf( "COMMENT: %s (%d)\n", yytext, COMMENT);} else {return COMMENT;}} +{DIGIT}+ {if(DEBUG) {printf( "C_INTEGER: %s (%d)\n", yytext, C_INTEGER);} else {return C_INTEGER;}} +'{CHAR}' {if(DEBUG) {printf( "C_CHARACTER: %s (%d)\n", yytext, C_CHARACTER);} else {return C_CHARACTER;}} +\"{SCHAR}*\" {if(DEBUG) {printf( "C_STRING: %s (%d)\n", yytext, C_STRING);} else {return C_STRING;}} +{COMMENT} {if(DEBUG) {printf( "COMMENT: %s (%d)\n", yytext, COMMENT);} else {return COMMENT;}} -"(" {if(DEBUG) {printf( "L_PAREN: %s (%d)\n", yytext, L_PAREN);} else {return L_PAREN;}} -")" {if(DEBUG) {printf( "R_PAREN: %s (%d)\n", yytext, R_PAREN);} else {return R_PAREN;}} +"(" {if(DEBUG) {printf( "L_PAREN: %s (%d)\n", yytext, L_PAREN);} else {return L_PAREN;}} +")" {if(DEBUG) {printf( "R_PAREN: %s (%d)\n", yytext, R_PAREN);} else {return R_PAREN;}} +"[" {if(DEBUG) {printf( "L_BRACKET: %s (%d)\n", yytext, L_BRACKET);} else {return L_BRACKET;}} +"]" {if(DEBUG) {printf( "R_BRACKET: %s (%d)\n", yytext, R_BRACKET);} else {return R_BRACKET;}} +"{" {if(DEBUG) {printf( "L_BRACE: %s (%d)\n", yytext, L_BRACE);} else {return L_BRACE;}} +"}" {if(DEBUG) {printf( "R_BRACE: %s (%d)\n", yytext, R_BRACE);} else {return R_BRACE;}} -"[" {if(DEBUG) {printf( "L_BRACKET: %s (%d)\n", yytext, L_BRACKET);} else {return L_BRACKET;}} -"]" {if(DEBUG) {printf( "R_BRACKET: %s (%d)\n", yytext, R_BRACKET);} else {return R_BRACKET;}} +"true" {if(DEBUG) {printf( "C_TRUE: %s (%d)\n", yytext, C_TRUE);} else {return C_TRUE;}} +"false" {if(DEBUG) {printf( "C_FALSE: %s (%d)\n", yytext, C_FALSE);} else {return C_FALSE;}} +"null" {if(DEBUG) {printf( "C_NULL: %s (%d)\n", yytext, C_NULL);} else {return C_NULL;}} -"{" {if(DEBUG) {printf( "L_BRACE: %s (%d)\n", yytext, L_BRACE);} else {return L_BRACE;}} -"}" {if(DEBUG) {printf( "R_BRACE: %s (%d)\n", yytext, R_BRACE);} else {return R_BRACE;}} +{ID} {if(DEBUG) {printf( "ID: %s (%d)\n", yytext, ID);} else {/*yylval.words = strdup(yytext);*/ return ID;}} -"true" {if(DEBUG) {printf( "C_TRUE: %s (%d)\n", yytext, C_TRUE);} else {return C_TRUE;}} -"false" {if(DEBUG) {printf( "C_FALSE: %s (%d)\n", yytext, C_FALSE);} else {return C_FALSE;}} -"null" {if(DEBUG) {printf( "C_NULL: %s (%d)\n", yytext, C_NULL);} else {return C_NULL;}} - -{ID} {if(DEBUG) {printf( "ID: %s (%d)\n", yytext, ID);} else {yylval.words = strdup(yytext); return ID;}} - -\n {line_number++; column_number = 1;} -\t {column_number++;} -" " {column_number++;} -. {column_number++; return 1999;} +\n {line_number++; column_number = 1;} +\t {column_number++;} +" " {column_number++;} +. {column_number++; return 1999;} %% diff --git a/src/runner.c b/src/runner.c index 6e0a61b..49f50f8 100644 --- a/src/runner.c +++ b/src/runner.c @@ -1,177 +1,183 @@ -//#include "symbol_table.h" +// #include "symbol_table.h" #include "runner.h" int main(int argc, char *argv[]) { - if (argc == 1) { - fprintf(stderr, "INVALID INPUT: Include a .alpha file or use -help for more inputs \n"); - return -1; - } else if (argc == 2) { - //can be either -help or .alpha file - if (is_help(argv[1])) { - return 0; - } else if (is_alpha_file(argv[1], strlen(argv[1])) == 0) { - //run flex for now - no_flag = SET_FLAG; //no argument but valid input - alpha_file = fopen(argv[1], "r"); + if (argc == 1) { + fprintf( + stderr, + "INVALID INPUT: Include a .alpha file or use -help for more inputs \n"); + return -1; + } else if (argc == 2) { + // can be either -help or .alpha file + if (is_help(argv[1])) { + return 0; + } else if (is_alpha_file(argv[1], strlen(argv[1])) == 0) { + // run flex for now + no_flag = SET_FLAG; // no argument but valid input + alpha_file = fopen(argv[1], "r"); - } else { - fprintf(stderr, "INVALID INPUT: Include a .alpha file or use -help for more inputs\n"); - return -1; - } } else { - //last input must be .alpha - if (is_alpha_file(argv[argc - 1], strlen(argv[argc - 1])) != 0) { - fprintf(stderr, "INVALID INPUT: Include a .alpha file at end of input or use -help for more inputs \n"); - return -1; - } else { - //now check that other args are valid (flags will not be null if flag is present) - for (int i = 1; i < argc - 1; i++) { - if (check_flag(argv[i], argv[argc - 1]) != 0) { - fprintf(stderr, "INVALID FLAG(S): Use -help to view valid inputs \n"); - return -1; - } - } - alpha_file = fopen(argv[argc - 1], "r"); - } + fprintf(stderr, + "INVALID INPUT: Include a .alpha file or use -help for more " + "inputs\n"); + return -1; } - return run(alpha_file); + } else { + // last input must be .alpha + if (is_alpha_file(argv[argc - 1], strlen(argv[argc - 1])) != 0) { + fprintf(stderr, + "INVALID INPUT: Include a .alpha file at end of input or use " + "-help for more inputs \n"); + return -1; + } else { + // now check that other args are valid (flags will not be null if flag is + // present) + for (int i = 1; i < argc - 1; i++) { + if (check_flag(argv[i], argv[argc - 1]) != 0) { + fprintf(stderr, "INVALID FLAG(S): Use -help to view valid inputs \n"); + return -1; + } + } + alpha_file = fopen(argv[argc - 1], "r"); + } + } + return run(alpha_file); } -int check_flag(char *arg, char* alpha) { - if (strcmp("-tok", arg) == 0) { - if (tok_flag == NULL) { - return new_file(arg, alpha); - } - fprintf(stderr, "FLAGS REPEAT\n"); - return -1; - } else if (strcmp("-st", arg) == 0) { - if (st_flag == NULL) { - return new_file(arg, alpha); - } - fprintf(stderr, "FLAGS REPEAT\n"); - return -1; - } else { - fprintf(stderr, "INVALID FLAG: Use -help for valid inputs\n"); - return -1; +int check_flag(char *arg, char *alpha) { + if (strcmp("-tok", arg) == 0) { + if (tok_flag == NULL) { + return new_file(arg, alpha); } + fprintf(stderr, "FLAGS REPEAT\n"); + return -1; + } else if (strcmp("-st", arg) == 0) { + if (st_flag == NULL) { + return new_file(arg, alpha); + } + fprintf(stderr, "FLAGS REPEAT\n"); + return -1; + } else { + fprintf(stderr, "INVALID FLAG: Use -help for valid inputs\n"); + return -1; + } } - int run(FILE *alpha) { - int token; - //check that file exists - if (alpha == NULL) { - fprintf(stderr, "INPUT FILE NOT FOUND\n"); - return -1; - } - yyin = alpha; - while (0 != (token = yylex())) { - if (tok_flag != NULL) { - fprintf(tok_flag, "%d %d %3d \"%s\"\n", line_number, column_number, token, yytext); - } - if(token == COMMENT){ - for (int i = 0; i < yyleng; i++) { - if(yytext[i] == '\n'){ - line_number++; - column_number = 0; - } - column_number++; - } - continue; - } - if(token == 1999){ - printf("On line number %d and column number %d we have an invalid character:%s\n",line_number,column_number,yytext); - //return -1; -} - column_number += yyleng; - } - - if (st_flag != NULL) { - //output symbol table, file pointer is - //print_symbol_table(top,st_flag); - } - - if (yyin != NULL) { - fclose(yyin); - } - + int token; + // check that file exists + if (alpha == NULL) { + fprintf(stderr, "INPUT FILE NOT FOUND\n"); + return -1; + } + yyin = alpha; + while (0 != (token = yylex())) { if (tok_flag != NULL) { - fclose(tok_flag); + fprintf(tok_flag, "%d %d %3d \"%s\"\n", line_number, column_number, token, + yytext); } + if (token == COMMENT) { + for (int i = 0; i < yyleng; i++) { + if (yytext[i] == '\n') { + line_number++; + column_number = 0; + } + column_number++; + } + continue; + } + if (token == 1999) { + printf( + "On line number %d and column number %d we have an invalid " + "character:%s\n", + line_number, column_number, yytext); + // return -1; + } + column_number += yyleng; + } - return 0; + if (st_flag != NULL) { + // output symbol table, file pointer is + // print_symbol_table(top,st_flag); + } + + if (yyin != NULL) { + fclose(yyin); + } + + if (tok_flag != NULL) { + fclose(tok_flag); + } + + return 0; } - - -bool is_help(char * input) { - if (strcmp(input, "-help") == 0) { - printf("%s", HELP); - return true; - } - return false; +bool is_help(char *input) { + if (strcmp(input, "-help") == 0) { + printf("%s", HELP); + return true; + } + return false; } int new_file(char *arg, char *alpha) { - int type_len; - const char *basename = alpha; - const char *slash = strchr(alpha, '/'); + int type_len; + const char *basename = alpha; + const char *slash = strchr(alpha, '/'); - while (slash != NULL) { - basename = slash + 1; - slash = strchr(basename, '/'); - } - - mkdir("./out", 0777); + while (slash != NULL) { + basename = slash + 1; + slash = strchr(basename, '/'); + } - char *new_basename = calloc(strlen(basename) + 5, sizeof(char)); - strcpy(new_basename, "./out/"); - strcat(new_basename, basename); - basename = new_basename; + mkdir("./out", 0777); - if (strcmp(arg, "-tok") == 0) { - type_len = TOK_LEN; - } else if (strcmp(arg, "-st") == 0) { - type_len = ST_LEN; - } else { - fprintf(stderr, "INVALID FLAG: Use -help to view valid inputs\n"); - return -1; - } + char *new_basename = calloc(strlen(basename) + 5, sizeof(char)); + strcpy(new_basename, "./out/"); + strcat(new_basename, basename); + basename = new_basename; + if (strcmp(arg, "-tok") == 0) { + type_len = TOK_LEN; + } else if (strcmp(arg, "-st") == 0) { + type_len = ST_LEN; + } else { + fprintf(stderr, "INVALID FLAG: Use -help to view valid inputs\n"); + return -1; + } - // calculate lengths - int basename_len = strlen(basename); - char *file_name = calloc(basename_len - ALPHA_OFFSET + type_len + 2, sizeof(char)); + // calculate lengths + int basename_len = strlen(basename); + char *file_name = + calloc(basename_len - ALPHA_OFFSET + type_len + 2, sizeof(char)); - //coy filename and add extension - strncpy(file_name, basename, basename_len - ALPHA_OFFSET); - strcat(file_name, "."); - strcat(file_name, arg + 1); + // coy filename and add extension + strncpy(file_name, basename, basename_len - ALPHA_OFFSET); + strcat(file_name, "."); + strcat(file_name, arg + 1); - - if (strcmp(arg, "-tok") == 0) { - tok_flag = fopen(file_name, "w"); - } else if (strcmp(arg, "-st") == 0) { - st_flag = fopen(file_name, "w"); - } - return 0; + if (strcmp(arg, "-tok") == 0) { + tok_flag = fopen(file_name, "w"); + } else if (strcmp(arg, "-st") == 0) { + st_flag = fopen(file_name, "w"); + } + return 0; } - int is_alpha_file(char *alpha, int file_len) { - if (strcmp(".alpha", alpha + sizeof(char) * (file_len - ALPHA_OFFSET)) != 0) { - return -1; //not alpha file - } - return 0; //is alpha file + if (strcmp(".alpha", alpha + sizeof(char) * (file_len - ALPHA_OFFSET)) != 0) { + return -1; // not alpha file + } + return 0; // is alpha file } -void enter_scope(int line, int column){ - curr = CreateScope(curr, line, column); +void enter_scope(int line, int column) { + curr = CreateScope(curr, line, column); } void exit_scope() { - if(curr->Parent_Scope == NULL){ - printf("Can't close top"); - return; - } - curr = curr->Parent_Scope; + if (curr->Parent_Scope == NULL) { + printf("Can't close top"); + return; + } + curr = curr->Parent_Scope; } diff --git a/src/runner.h b/src/runner.h index 63d6fd2..7c0d83a 100644 --- a/src/runner.h +++ b/src/runner.h @@ -1,29 +1,35 @@ #define ALPHA_OFFSET 6 #define TOK_LEN 3 #define ST_LEN 2 -#define HELP "HELP:\nHow to run the alpha compiler:\n./alpha [options] program\nValid options:\n-tok output the token number, token, line number, and column number for each of the tokens to the .tok file\n-st output the symbol table for the program to the .st file\n-help print this message and exit the alpha compiler\n" -//use to set flags for arg types +#define HELP \ + "HELP:\nHow to run the alpha compiler:\n./alpha [options] program\nValid " \ + "options:\n-tok output the token number, token, line number, and column " \ + "number for each of the tokens to the .tok file\n-st output the symbol " \ + "table for the program to the .st file\n-help print this message and exit " \ + "the alpha compiler\n" +// use to set flags for arg types #define SET_FLAG 1 -#include +#include #include #include -#include "../tmp/flex.h" -#include "typedefs.h" -#include -#include "symbol_table.h" +#include #include +#include "../tmp/flex.h" +#include "symbol_table.h" +#include "typedefs.h" + extern int line_number, column_number; extern char *yytext; extern FILE *yyin; int arg; -SymbolTable * top; -SymbolTable * curr; +SymbolTable *top; +SymbolTable *curr; // int main(int argc, char* argv[]); -char *is_tok(int argc, char* argv[]); +char *is_tok(int argc, char *argv[]); // int is_alpha_file(char *file, int file_len); void enter_scope(int, int); void exit_scope(void); @@ -33,9 +39,9 @@ FILE *tok_flag = NULL; FILE *st_flag = NULL; int no_flag = 0; -int main(int argc, char* argv[]); +int main(int argc, char *argv[]); int new_file(char *arg, char *alpha); int is_alpha_file(char *alpha, int file_len); -bool is_help(char * input); -int run(FILE*alpha); -int check_flag(char * arg, char* alpha); +bool is_help(char *input); +int run(FILE *alpha); +int check_flag(char *arg, char *alpha); From 4d674eb8b740047a5cb059e5a1ca8ce95707c50f Mon Sep 17 00:00:00 2001 From: Scarlett Date: Wed, 5 Mar 2025 12:30:33 -0500 Subject: [PATCH 089/105] Testing update with check.sh --- Makefile | 30 +++++++---------- check.sh | 27 ++++++++++++++++ src/grammar.y | 4 +-- src/lexicalStructure.lex | 8 +++-- src/runner.c | 32 ++++++++----------- src/runner.h | 8 +++-- .../expected/sp1_comment_fix1.expected | 1 + .../sp1_comment_fix1.alpha} | 0 .../sp1_comment_fix2.alpha} | 0 .../sp1_comment_issues.alpha} | 0 .../sp1_comments.alpha} | 0 .../sp1_general_token.alpha} | 0 .../sp1_keywords.alpha} | 0 .../sp1_operators.alpha} | 0 .../sp1_other_punc.alpha} | 0 .../sp1_punc_grouping.alpha} | 0 .../sp1_real_alpha_file1.alpha} | 0 .../sp1_real_alpha_file2.alpha} | 0 .../sp1_simple_int.alpha} | 0 .../sp1_simple_literals.alpha} | 0 .../sp1_variables.alpha} | 0 tests/sprint2/test/sp2_library.alpha | 30 +++++++++++++++++ tests/sprint2/test/sp2_one_line.alpha | 1 + tests/sprint2/test/sp2_simple.alpha | 4 +++ 24 files changed, 101 insertions(+), 44 deletions(-) create mode 100755 check.sh create mode 100644 tests/sprint1/expected/sp1_comment_fix1.expected rename tests/sprint1/{test_comment_fix1.alpha => test/sp1_comment_fix1.alpha} (100%) rename tests/sprint1/{test_comment_fix2.alpha => test/sp1_comment_fix2.alpha} (100%) rename tests/sprint1/{test_comment_issues.alpha => test/sp1_comment_issues.alpha} (100%) rename tests/sprint1/{test_comments.alpha => test/sp1_comments.alpha} (100%) rename tests/sprint1/{test_general_token.alpha => test/sp1_general_token.alpha} (100%) rename tests/sprint1/{test_keywords.alpha => test/sp1_keywords.alpha} (100%) rename tests/sprint1/{test_operators.alpha => test/sp1_operators.alpha} (100%) rename tests/sprint1/{test_other_punc.alpha => test/sp1_other_punc.alpha} (100%) rename tests/sprint1/{test_punc_grouping.alpha => test/sp1_punc_grouping.alpha} (100%) rename tests/sprint1/{test_real_alpha_file1.alpha => test/sp1_real_alpha_file1.alpha} (100%) rename tests/sprint1/{test_real_alpha_file2.alpha => test/sp1_real_alpha_file2.alpha} (100%) rename tests/sprint1/{test_simple_int.alpha => test/sp1_simple_int.alpha} (100%) rename tests/sprint1/{test_simple_literals.alpha => test/sp1_simple_literals.alpha} (100%) rename tests/sprint1/{test_variables.alpha => test/sp1_variables.alpha} (100%) create mode 100644 tests/sprint2/test/sp2_library.alpha create mode 100644 tests/sprint2/test/sp2_one_line.alpha create mode 100644 tests/sprint2/test/sp2_simple.alpha diff --git a/Makefile b/Makefile index 07d1d87..256aad2 100644 --- a/Makefile +++ b/Makefile @@ -3,9 +3,12 @@ FLEX := flex LEX := src/lexicalStructure.lex EXE := alpha CFLAGS := -YACC := bison +YACC := bison -compiler: runner +TESTS-S1 := $(wildcard tests/sprint1/test/*.alpha) +TESTS-S2 := $(wildcard tests/sprint2/test/*.alpha) + +compiler: clean runner tmp/grammar.tab.c: src/grammar.y mkdir -p tmp @@ -35,25 +38,14 @@ debug: clean compiler test: test-s1 test-s2 test-s1: - ./$(EXE) -tok ./tests/sprint1/test_comment_fix1.alpha - ./$(EXE) -tok ./tests/sprint1/test_comment_fix2.alpha - ./$(EXE) -tok ./tests/sprint1/test_comment_issues.alpha - ./$(EXE) -tok ./tests/sprint1/test_comments.alpha - ./$(EXE) -tok ./tests/sprint1/test_general_token.alpha - ./$(EXE) -tok ./tests/sprint1/test_keywords.alpha - ./$(EXE) -tok ./tests/sprint1/test_operators.alpha - ./$(EXE) -tok ./tests/sprint1/test_other_punc.alpha - ./$(EXE) -tok ./tests/sprint1/test_punc_grouping.alpha - ./$(EXE) -tok ./tests/sprint1/test_real_alpha_file1.alpha - ./$(EXE) -tok ./tests/sprint1/test_real_alpha_file2.alpha - ./$(EXE) -tok ./tests/sprint1/test_simple_int.alpha - ./$(EXE) -tok ./tests/sprint1/test_simple_literals.alpha - ./$(EXE) -tok ./tests/sprint1/test_variables.alpha + chmod +x ./check.sh + $(foreach test, $(TESTS-S1), ./$(EXE) -tok $(test);) + ./check.sh test-s2: - ./$(EXE) -tok ./tests/sprint2/alpha/test_library.alpha - ./$(EXE) -tok ./tests/sprint2/alpha/test_one_line.alpha - ./$(EXE) -tok ./tests/sprint2/alpha/test_simple.alpha + chmod +x ./check.sh + $(foreach test, $(TESTS-S2), ./$(EXE) -tok $(test);) + ./check.sh clean: rm -f *.o diff --git a/check.sh b/check.sh new file mode 100755 index 0000000..b8b138c --- /dev/null +++ b/check.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +# Diff-Check Tool # +# Checks if outputed TOK = exp # +# The Translators - Spring 2025 # + +TOK_DIR="out" + +if [[ ! -d "$TOK_DIR" ]]; then + echo "Directory $TOK_DIR does not exist." + exit 1 +fi + +echo -e "\n" +for file in "$TOK_DIR"/*; do + filename=$(basename -- "$file") + filename="${filename%.*}" + num=${filename:2:1} + exp="./tests/sprint$num/expected/$filename.expected" + + if [[ -f "$exp" ]]; then + echo -e "--------------------------------------------" + echo -e "Checking $file...\n" + diff --color=always "$file" "$exp" + echo -e "--------------------------------------------\n" + fi +done \ No newline at end of file diff --git a/src/grammar.y b/src/grammar.y index 0645a4a..db116e7 100644 --- a/src/grammar.y +++ b/src/grammar.y @@ -1,5 +1,5 @@ -/* Syntax Analyzer with Bison (3.8.1) */ -/* (referenced Bison manual for file boilerplate [3.1]) */ +/* Syntax Analyzer with Bison (3.8.1) */ +/* The Translators - Spring 2025 */ // Prologue %{ diff --git a/src/lexicalStructure.lex b/src/lexicalStructure.lex index 79ccaea..7a5f113 100644 --- a/src/lexicalStructure.lex +++ b/src/lexicalStructure.lex @@ -1,15 +1,17 @@ -/* Lexical Analyzer with Flex (1.6.0) */ +/* Lexical Analyzer with Flex (1.6.0) */ +/* The Translators - Spring 2025 */ %option noyywrap %option header-file="flex.h" + %{ #include - //#include "typedefs.h" #include "grammar.tab.h" - int line_number = 1, column_number = 1; #ifndef DEBUG #define DEBUG 0 #endif + + int line_number = 1, column_number = 1; %} STARCOM [^\*]|\*+[^\)\*]+ diff --git a/src/runner.c b/src/runner.c index 49f50f8..7ee5d58 100644 --- a/src/runner.c +++ b/src/runner.c @@ -1,37 +1,32 @@ -// #include "symbol_table.h" +/* Runner File - Compiles alpha Compiler */ +/* The Translators - Spring 2025 */ + #include "runner.h" int main(int argc, char *argv[]) { if (argc == 1) { fprintf( - stderr, - "INVALID INPUT: Include a .alpha file or use -help for more inputs \n"); + stderr, INVALID); return -1; - } else if (argc == 2) { - // can be either -help or .alpha file + } + + else if (argc == 2) { if (is_help(argv[1])) { return 0; } else if (is_alpha_file(argv[1], strlen(argv[1])) == 0) { - // run flex for now - no_flag = SET_FLAG; // no argument but valid input + no_flag = SET_FLAG; alpha_file = fopen(argv[1], "r"); - } else { - fprintf(stderr, - "INVALID INPUT: Include a .alpha file or use -help for more " - "inputs\n"); + fprintf(stderr, INVALID); return -1; } - } else { - // last input must be .alpha + } + + else { if (is_alpha_file(argv[argc - 1], strlen(argv[argc - 1])) != 0) { - fprintf(stderr, - "INVALID INPUT: Include a .alpha file at end of input or use " - "-help for more inputs \n"); + fprintf(stderr, INVALID); return -1; } else { - // now check that other args are valid (flags will not be null if flag is - // present) for (int i = 1; i < argc - 1; i++) { if (check_flag(argv[i], argv[argc - 1]) != 0) { fprintf(stderr, "INVALID FLAG(S): Use -help to view valid inputs \n"); @@ -117,6 +112,7 @@ bool is_help(char *input) { printf("%s", HELP); return true; } + return false; } diff --git a/src/runner.h b/src/runner.h index 7c0d83a..2c516bf 100644 --- a/src/runner.h +++ b/src/runner.h @@ -1,3 +1,6 @@ +/* Runner File - Compiles alpha Compiler */ +/* The Translators - Spring 2025 */ + #define ALPHA_OFFSET 6 #define TOK_LEN 3 #define ST_LEN 2 @@ -7,8 +10,9 @@ "number for each of the tokens to the .tok file\n-st output the symbol " \ "table for the program to the .st file\n-help print this message and exit " \ "the alpha compiler\n" -// use to set flags for arg types -#define SET_FLAG 1 +#define SET_FLAG 1 // Used to set flags for arg types +#define INVALID \ + "INVALID INPUT: Include a .alpha file or use -help for more inputs \n" #include #include diff --git a/tests/sprint1/expected/sp1_comment_fix1.expected b/tests/sprint1/expected/sp1_comment_fix1.expected new file mode 100644 index 0000000..07d66e1 --- /dev/null +++ b/tests/sprint1/expected/sp1_comment_fix1.expected @@ -0,0 +1 @@ + daskmskdfm \ No newline at end of file diff --git a/tests/sprint1/test_comment_fix1.alpha b/tests/sprint1/test/sp1_comment_fix1.alpha similarity index 100% rename from tests/sprint1/test_comment_fix1.alpha rename to tests/sprint1/test/sp1_comment_fix1.alpha diff --git a/tests/sprint1/test_comment_fix2.alpha b/tests/sprint1/test/sp1_comment_fix2.alpha similarity index 100% rename from tests/sprint1/test_comment_fix2.alpha rename to tests/sprint1/test/sp1_comment_fix2.alpha diff --git a/tests/sprint1/test_comment_issues.alpha b/tests/sprint1/test/sp1_comment_issues.alpha similarity index 100% rename from tests/sprint1/test_comment_issues.alpha rename to tests/sprint1/test/sp1_comment_issues.alpha diff --git a/tests/sprint1/test_comments.alpha b/tests/sprint1/test/sp1_comments.alpha similarity index 100% rename from tests/sprint1/test_comments.alpha rename to tests/sprint1/test/sp1_comments.alpha diff --git a/tests/sprint1/test_general_token.alpha b/tests/sprint1/test/sp1_general_token.alpha similarity index 100% rename from tests/sprint1/test_general_token.alpha rename to tests/sprint1/test/sp1_general_token.alpha diff --git a/tests/sprint1/test_keywords.alpha b/tests/sprint1/test/sp1_keywords.alpha similarity index 100% rename from tests/sprint1/test_keywords.alpha rename to tests/sprint1/test/sp1_keywords.alpha diff --git a/tests/sprint1/test_operators.alpha b/tests/sprint1/test/sp1_operators.alpha similarity index 100% rename from tests/sprint1/test_operators.alpha rename to tests/sprint1/test/sp1_operators.alpha diff --git a/tests/sprint1/test_other_punc.alpha b/tests/sprint1/test/sp1_other_punc.alpha similarity index 100% rename from tests/sprint1/test_other_punc.alpha rename to tests/sprint1/test/sp1_other_punc.alpha diff --git a/tests/sprint1/test_punc_grouping.alpha b/tests/sprint1/test/sp1_punc_grouping.alpha similarity index 100% rename from tests/sprint1/test_punc_grouping.alpha rename to tests/sprint1/test/sp1_punc_grouping.alpha diff --git a/tests/sprint1/test_real_alpha_file1.alpha b/tests/sprint1/test/sp1_real_alpha_file1.alpha similarity index 100% rename from tests/sprint1/test_real_alpha_file1.alpha rename to tests/sprint1/test/sp1_real_alpha_file1.alpha diff --git a/tests/sprint1/test_real_alpha_file2.alpha b/tests/sprint1/test/sp1_real_alpha_file2.alpha similarity index 100% rename from tests/sprint1/test_real_alpha_file2.alpha rename to tests/sprint1/test/sp1_real_alpha_file2.alpha diff --git a/tests/sprint1/test_simple_int.alpha b/tests/sprint1/test/sp1_simple_int.alpha similarity index 100% rename from tests/sprint1/test_simple_int.alpha rename to tests/sprint1/test/sp1_simple_int.alpha diff --git a/tests/sprint1/test_simple_literals.alpha b/tests/sprint1/test/sp1_simple_literals.alpha similarity index 100% rename from tests/sprint1/test_simple_literals.alpha rename to tests/sprint1/test/sp1_simple_literals.alpha diff --git a/tests/sprint1/test_variables.alpha b/tests/sprint1/test/sp1_variables.alpha similarity index 100% rename from tests/sprint1/test_variables.alpha rename to tests/sprint1/test/sp1_variables.alpha diff --git a/tests/sprint2/test/sp2_library.alpha b/tests/sprint2/test/sp2_library.alpha new file mode 100644 index 0000000..9bacd6c --- /dev/null +++ b/tests/sprint2/test/sp2_library.alpha @@ -0,0 +1,30 @@ +(* At compiler start-up your program should create symbol table entries for the four primitive types: + Boolean (1 byte) + character (1 byte) + integer (4 bytes) + address (8 bytes) +You should #include this file at the start of your alpha file. +Some useful types are defined below. +*) +type string: 1 -> character +type BooleanXBoolean: [Boolean: x, y] +type characterXcharacter: [character: x, y] +type integerXinteger: [integer: x, y] + +type Boolean2Boolean: Boolean -> Boolean +type integer2integer: integer -> integer +type character2integer: character -> integer +type Boolean2integer: Boolean -> integer +type string2integer: string -> integer +type integerXinteger2integer: integerXinteger -> integer +type integerXinteger2Boolean: integerXinteger -> Boolean +type characterXcharacter2Boolean: characterXcharacter -> Boolean +type BooleanXBoolean2Boolean: BooleanXBoolean -> Boolean +type integer2address: integer -> address +type address2integer: address -> integer +external function printInteger: integer2integer +external function printCharacter: character2integer +external function printBoolean: Boolean2integer +external function reserve: integer2address +external function release: address2integer +function entry: string2integer diff --git a/tests/sprint2/test/sp2_one_line.alpha b/tests/sprint2/test/sp2_one_line.alpha new file mode 100644 index 0000000..01f115e --- /dev/null +++ b/tests/sprint2/test/sp2_one_line.alpha @@ -0,0 +1 @@ +type rec: [integer: x; integer: y] type T1: integer -> integer type T2: rec -> integer function foo : T1 function bar1 : T2 function bar2 : T2 foo(x) := { return x * x; } bar1(a) := { return a.x * a.y; } bar2 as (r,s) := { return r * s; } entry(arg) := { [ integer: result ; rec: w] result := foo(5); w := reserve(w); w.x := 5; w.y := 7; result := bar1(w); result := bar2(5,7); return 0; } diff --git a/tests/sprint2/test/sp2_simple.alpha b/tests/sprint2/test/sp2_simple.alpha new file mode 100644 index 0000000..13f3c9f --- /dev/null +++ b/tests/sprint2/test/sp2_simple.alpha @@ -0,0 +1,4 @@ +#include "library.alpha" +entry(arg) := { + return 0; +} From 45940c0500b4048b273165385c7661f7b15b74aa Mon Sep 17 00:00:00 2001 From: Scarlett Date: Wed, 5 Mar 2025 12:54:30 -0500 Subject: [PATCH 090/105] quick update #30 --- .gitignore | 3 ++- Makefile | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index e6bdaa4..8cf77d3 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ grammar.tab.c grammar.tab.h .vscode out -tmp \ No newline at end of file +tmp +parser \ No newline at end of file diff --git a/Makefile b/Makefile index 256aad2..d742a62 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ tmp/runner.o: src/runner.c src/runner.h tmp/flex.h tmp/symbol_table.o: src/symbol_table.c src/symbol_table.h $(CC) $(CFLAGS) -o tmp/symbol_table.o -c src/symbol_table.c -parser : tmp/lex.yy.c tmp/grammar.tab.c +parser : clean tmp/lex.yy.c tmp/grammar.tab.c $(CC) -o parser tmp/lex.yy.c tmp/grammar.tab.c runner: tmp/lex.yy.c tmp/runner.o tmp/symbol_table.o From c2f28b68369af66d8eafc709381699595063fd8c Mon Sep 17 00:00:00 2001 From: Scarlett Date: Wed, 5 Mar 2025 14:01:34 -0500 Subject: [PATCH 091/105] Combined binaries (parser + alpha) --- Makefile | 6 ++-- src/grammar.y | 6 ++-- src/lexicalStructure.lex | 4 +-- src/runner.c | 65 +++++++++++++++++++++++----------------- src/runner.h | 3 +- 5 files changed, 47 insertions(+), 37 deletions(-) diff --git a/Makefile b/Makefile index d742a62..fe8f769 100644 --- a/Makefile +++ b/Makefile @@ -26,11 +26,8 @@ tmp/runner.o: src/runner.c src/runner.h tmp/flex.h tmp/symbol_table.o: src/symbol_table.c src/symbol_table.h $(CC) $(CFLAGS) -o tmp/symbol_table.o -c src/symbol_table.c -parser : clean tmp/lex.yy.c tmp/grammar.tab.c - $(CC) -o parser tmp/lex.yy.c tmp/grammar.tab.c - runner: tmp/lex.yy.c tmp/runner.o tmp/symbol_table.o - $(CC) $(CFLAGS) -o $(EXE) tmp/runner.o tmp/lex.yy.c tmp/symbol_table.o + $(CC) $(CFLAGS) -o $(EXE) tmp/runner.o tmp/grammar.tab.c tmp/lex.yy.c debug: CFLAGS += -DDEBUG=1 debug: clean compiler @@ -46,6 +43,7 @@ test-s2: chmod +x ./check.sh $(foreach test, $(TESTS-S2), ./$(EXE) -tok $(test);) ./check.sh + $(foreach test, $(TESTS-S2), ./$(EXE) $(test);) clean: rm -f *.o diff --git a/src/grammar.y b/src/grammar.y index db116e7..4f65856 100644 --- a/src/grammar.y +++ b/src/grammar.y @@ -253,10 +253,10 @@ types: %% void yyerror(const char *err) { - // fprintf(stderr, "ERROR: %s at token %s at line number %d,column number %d\n", err,yytext,line_number,column_number); + fprintf(stderr, "ERROR: %s at token %s at line number %d,column number %d\n", err,yytext,line_number,column_number); } -int main() { +/* int main() { //char *str = strdup("taco"); //cur_value = NULL; //cur_type = NULL; @@ -276,4 +276,4 @@ int main() { //} //} return 0; -} +} */ diff --git a/src/lexicalStructure.lex b/src/lexicalStructure.lex index 7a5f113..bf05e1d 100644 --- a/src/lexicalStructure.lex +++ b/src/lexicalStructure.lex @@ -6,7 +6,7 @@ %{ #include - #include "grammar.tab.h" + #include "../tmp/grammar.tab.h" #ifndef DEBUG #define DEBUG 0 #endif @@ -76,7 +76,7 @@ SCHAR \\n|\\t|\\\"|[^\"\n\\] "false" {if(DEBUG) {printf( "C_FALSE: %s (%d)\n", yytext, C_FALSE);} else {return C_FALSE;}} "null" {if(DEBUG) {printf( "C_NULL: %s (%d)\n", yytext, C_NULL);} else {return C_NULL;}} -{ID} {if(DEBUG) {printf( "ID: %s (%d)\n", yytext, ID);} else {/*yylval.words = strdup(yytext);*/ return ID;}} +{ID} {if(DEBUG) {printf( "ID: %s (%d)\n", yytext, ID);} else {yylval.words = strdup(yytext); return ID;}} \n {line_number++; column_number = 1;} \t {column_number++;} diff --git a/src/runner.c b/src/runner.c index 7ee5d58..85e9495 100644 --- a/src/runner.c +++ b/src/runner.c @@ -5,8 +5,7 @@ int main(int argc, char *argv[]) { if (argc == 1) { - fprintf( - stderr, INVALID); + fprintf(stderr, INVALID); return -1; } @@ -60,35 +59,46 @@ int check_flag(char *arg, char *alpha) { int run(FILE *alpha) { int token; - // check that file exists + curr = CreateScope(NULL, 1, 1); + + // If file is not found if (alpha == NULL) { fprintf(stderr, "INPUT FILE NOT FOUND\n"); return -1; } yyin = alpha; - while (0 != (token = yylex())) { - if (tok_flag != NULL) { - fprintf(tok_flag, "%d %d %3d \"%s\"\n", line_number, column_number, token, - yytext); - } - if (token == COMMENT) { - for (int i = 0; i < yyleng; i++) { - if (yytext[i] == '\n') { - line_number++; - column_number = 0; - } - column_number++; + + // TOK FLAG + if (tok_flag != NULL) { + while (0 != (token = yylex())) { + if (tok_flag != NULL) { + fprintf(tok_flag, "%d %d %3d \"%s\"\n", line_number, column_number, + token, yytext); } - continue; + if (token == COMMENT) { + for (int i = 0; i < yyleng; i++) { + if (yytext[i] == '\n') { + line_number++; + column_number = 0; + } + column_number++; + } + continue; + } + if (token == 1999) { + printf( + "On line number %d and column number %d we have an invalid " + "character:%s\n", + line_number, column_number, yytext); + } + column_number += yyleng; } - if (token == 1999) { - printf( - "On line number %d and column number %d we have an invalid " - "character:%s\n", - line_number, column_number, yytext); - // return -1; + fclose(tok_flag); + + if (yyin != NULL) { + fclose(yyin); } - column_number += yyleng; + return 0; } if (st_flag != NULL) { @@ -96,14 +106,15 @@ int run(FILE *alpha) { // print_symbol_table(top,st_flag); } + yyparse(); + FILE *f = fdopen(1, "w"); + print_symbol_table(getAncestor(curr), f); + fclose(f); + if (yyin != NULL) { fclose(yyin); } - if (tok_flag != NULL) { - fclose(tok_flag); - } - return 0; } diff --git a/src/runner.h b/src/runner.h index 2c516bf..daff88c 100644 --- a/src/runner.h +++ b/src/runner.h @@ -22,7 +22,8 @@ #include "../tmp/flex.h" #include "symbol_table.h" -#include "typedefs.h" +//#include "typedefs.h" +#include "../tmp/grammar.tab.h" extern int line_number, column_number; extern char *yytext; From f819a68ef7226931f220c3f160b2c3fea413d1ae Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Wed, 5 Mar 2025 15:02:30 -0500 Subject: [PATCH 092/105] runner and parser together add entries ok --- src/grammar.y | 389 ++++++++++++++------------ src/lexicalStructure.lex | 2 +- src/runner.c | 10 +- src/runner.h | 2 +- tests/sprint2/test/sp2_one_line.alpha | 2 +- 5 files changed, 211 insertions(+), 194 deletions(-) diff --git a/src/grammar.y b/src/grammar.y index 4f65856..3b5359f 100644 --- a/src/grammar.y +++ b/src/grammar.y @@ -1,5 +1,5 @@ -/* Syntax Analyzer with Bison (3.8.1) */ -/* The Translators - Spring 2025 */ +/* Syntax Analyzer with Bison (3.8.1) */ +/* (referenced Bison manual for file boilerplate [3.1]) */ // Prologue %{ @@ -9,148 +9,151 @@ void yyerror(const char *err); extern char* yytext; extern int yychar; - SymbolTable * st; + extern SymbolTable * cur; //char* cur_value; //char* cur_type; int token_tracker; extern int line_number; extern int column_number; + extern FILE * yyin; %} %union { - int integ; - char * words; + int integ; + char * words; } //precedence order -%precedence RESERVE -%precedence RELEASE -%precedence DOT -%precedence SUB_OR_NEG -%precedence NOT -%left MUL -%left DIV -%left REM -%left ADD //need subtraction only here +%type id_or_types +%type types +%token ID 101 +%token T_INTEGER 201 +%token T_ADDRESS 202 +%token T_BOOLEAN 203 +%token T_CHARACTER 204 +%token T_STRING 205 +%token C_INTEGER 301 +%token C_NULL 302 +%token C_CHARACTER 303 +%token C_STRING 304 +%token C_TRUE 305 +%token C_FALSE 306 +%token WHILE 401 +%token IF 402 +%token THEN 403 +%token ELSE 404 +%token TYPE 405 +%token FUNCTION 406 +%token RETURN 407 +%token EXTERNAL 408 +%token AS 409 +%token L_PAREN 501 +%token R_PAREN 502 +%token L_BRACKET 503 +%token R_BRACKET 504 +%token L_BRACE 505 +%token R_BRACE 506 +%token SEMI_COLON 507 +%token COLON 508 +%token COMMA 509 +%token ARROW 510 +%token MUL 603 +%token DIV 604 +%token REM 605 +%token ADD 601 +%token LESS_THAN 606 +%token EQUAL_TO 607 +%token AND 610 +%token OR 611 +%token ASSIGN 608 +%token SUB_OR_NEG 602 +%token NOT 609 +%token DOT 612 +%token RESERVE 613 +%token RELEASE 614 +%token COMMENT 700 +%precedence RESERVE RELEASE +%precedence DOT +%precedence UMINUS +%precedence NOT +%left MUL DIV REM +%left ADD SUB_OR_NEG %left LESS_THAN %left EQUAL_TO %left AND %left OR %left ASSIGN -%token ID 101 -%token T_INTEGER 201 -%token T_ADDRESS 202 -%token T_BOOLEAN 203 -%token T_CHARACTER 204 -%token T_STRING 205 -%token C_INTEGER 301 -%token C_NULL 302 -%token C_CHARACTER 303 -%token C_STRING 304 -%token C_TRUE 305 -%token C_FALSE 306 -%token WHILE 401 -%token IF 402 -%token THEN 403 -%token ELSE 404 -%token TYPE 405 -%token FUNCTION 406 -%token RETURN 407 -%token EXTERNAL 408 -%token AS 409 -%token L_PAREN 501 -%token R_PAREN 502 -%token L_BRACKET 503 -%token R_BRACKET 504 -%token L_BRACE 505 -%token R_BRACE 506 -%token SEMI_COLON 507 -%token COLON 508 -%token COMMA 509 -%token ARROW 510 -/* %token ADD 601 -%token SUB_OR_NEG 602 -%token MUL 603 -%token DIV 604 -%token REM 605 -%token LESS_THAN 606 -%token EQUAL_TO 607 -%token ASSIGN 608 -%token NOT 609 -%token AND 610 -%token OR 611 -%token DOT 612 -%token RESERVE 613 -%token RELEASE 614 */ -%token COMMENT 700 - %% -program: - prototype_or_definition_list; +program: + prototype_or_definition_list; prototype_or_definition_list: - prototype prototype_or_definition_list - | definition prototype_or_definition_list - | prototype - | definition - ; + prototype prototype_or_definition_list + | definition prototype_or_definition_list + | prototype + | definition + ; prototype: - L_PAREN EXTERNAL R_PAREN FUNCTION ID COLON ID; + L_PAREN EXTERNAL R_PAREN FUNCTION ID COLON ID; definition: - TYPE ID COLON dblock - | TYPE ID COLON constant ARROW ID - | TYPE ID COLON types ARROW ID - | FUNCTION ID COLON ID - | TYPE ID COLON ID ARROW ID - | ID parameter ASSIGN sblock - ; + TYPE ID COLON dblock + | TYPE ID COLON constant ARROW ID + //| TYPE ID COLON types ARROW ID + | function_declaration + | TYPE ID COLON id_or_types ARROW id_or_types + | ID parameter ASSIGN sblock + ; +function_declaration: + FUNCTION { printf("found a function def\n"); }ID COLON ID + | EXTERNAL { printf("found an external function def\n"); }FUNCTION ID COLON ID + ; parameter: - L_PAREN ID R_PAREN - | AS L_PAREN idlist R_PAREN - ; + L_PAREN { printf("found a param def\n"); } ID R_PAREN + | AS{ printf("found a param_as_list def\n"); } L_PAREN idlist R_PAREN + ; idlist: - ID COMMA idlist - |ID - ; + ID COMMA idlist + |ID + ; sblock: - L_BRACE {st = CreateScope(st,2,2);} statement_list {st = getParent(st);} R_BRACE - | L_BRACE {st = CreateScope(st,2,2);} dblock statement_list {st = getParent(st);} R_BRACE - ; + L_BRACE {printf("open brace\n"); cur = CreateScope(cur,2,2);} statement_list {printf("close brace\n"); cur = getParent(cur);} R_BRACE + | L_BRACE {printf("open brace\n"); cur = CreateScope(cur,2,2);} dblock statement_list {printf("close brace\n"); cur = getParent(cur);} R_BRACE + ; dblock: - L_BRACKET declaration_list R_BRACKET; + L_BRACKET declaration_list R_BRACKET; declaration_list: - declaration - {printf( - "declaration list a rule encountered"); - //CreateEntry(st,cur_type,cur_value); - } - SEMI_COLON declaration_list - | declaration - {printf( - "declaration rule b encountered"); - //CreateEntry(st,cur_type,cur_value); - } - ; + declaration + {printf( + "found a decleration of form dec;dec_list\n"); + //CreateEntry(cur,cur_type,cur_value); + } + SEMI_COLON declaration_list + | declaration + {printf( + "found a decleration of form dec\n"); + //CreateEntry(cur,cur_type,cur_value); + } + ; declaration: - ID COLON ID { - - CreateEntry(st,strdup($1),strdup($3)); + id_or_types COLON ID { + + CreateEntry(cur,$1,$3); // printf("declaration rule encountered"); // if(cur_value != NULL){ // char* delete1 = cur_value; // printf("delete1 var assigned to cur_value"); // free(delete1); -// printf("delete1 var freed"); +// printf("delete1 var freed"); // } // if(cur_type != NULL){ // char* delete2 = cur_type; @@ -161,119 +164,133 @@ declaration: // printf("space allocated"); // strcpy(cur_value, $1); // printf("string copied over"); - + // len = strlen($3); // cur_type = malloc(len + 1); // strcpy(cur_type, $3); // printf("value var is %s type var is %s\n",cur_value,cur_type); - } - | types COLON ID - ; - + } +// | types COLON ID + ; +id_or_types: + ID + | types + ; statement_list: - compound_statement statement_list - | compound_statement - | simple_statement SEMI_COLON statement_list - | simple_statement SEMI_COLON - ; + compound_statement statement_list + | compound_statement + | simple_statement SEMI_COLON statement_list + | simple_statement SEMI_COLON + ; compound_statement: - WHILE L_PAREN expression R_PAREN sblock - | IF L_PAREN expression R_PAREN THEN sblock ELSE sblock - | sblock - ; + WHILE {printf("found an while statment\n"); } L_PAREN expression R_PAREN sblock + | IF {printf("found an if statment\n"); }L_PAREN expression R_PAREN THEN sblock ELSE sblock + | sblock + ; + +// Ref Compilers Principles, Techniques, & Tools + + + simple_statement: - assignable ASSIGN expression - | RETURN expression - ; + assignable ASSIGN {printf("found an assignment statment\n"); } expression +// I think that we need to add memOp stuff here | assignable ASSIGN expression {printf("found an assignment statment\n"); } + | RETURN {printf("found an return statment\n"); } expression + ; assignable: - ID - | assignable ablock - | assignable DOT ID - ; + ID + | assignable ablock + | assignable rec_op ID + ; + +rec_op : + DOT expression: - constant - | UnaryOperator expression - | assignable - | constant binaryOperator expression - | L_PAREN expression R_PAREN - | memOp assignable - ; + constant + | SUB_OR_NEG expression %prec UMINUS + | NOT expression + | expression ADD expression + | expression SUB_OR_NEG expression + | expression MUL expression + | expression DIV expression + | expression REM expression + | expression AND expression + | expression OR expression + | expression LESS_THAN expression + | expression EQUAL_TO expression + | assignable + //| constant binaryOperator expression + //| ID binaryOperator expression + | L_PAREN expression R_PAREN + | memOp assignable + ; + + ablock: - L_PAREN argument_list R_PAREN; + L_PAREN argument_list R_PAREN; argument_list: - expression COMMA argument_list - | expression - ; + expression COMMA argument_list + | expression + ; -UnaryOperator: - SUB_OR_NEG - | NOT - ; memOp: - RESERVE - | RELEASE - ; + RESERVE + | RELEASE + ; -binaryOperator: - ADD - | SUB_OR_NEG - | MUL - | DIV - | REM - | AND - | OR - | LESS_THAN - | EQUAL_TO - ; constant: - C_STRING - | C_INTEGER - | C_NULL - | C_CHARACTER - | C_TRUE - | C_FALSE - ; + C_STRING + | C_INTEGER + | C_NULL + | C_CHARACTER + | C_TRUE + | C_FALSE + ; types: - T_STRING - | T_INTEGER - | T_ADDRESS - | T_CHARACTER - | T_BOOLEAN - ; + T_STRING + | T_INTEGER + | T_ADDRESS + | T_CHARACTER + | T_BOOLEAN + ; // %% void yyerror(const char *err) { fprintf(stderr, "ERROR: %s at token %s at line number %d,column number %d\n", err,yytext,line_number,column_number); } - -/* int main() { - //char *str = strdup("taco"); - //cur_value = NULL; - //cur_type = NULL; - - token_tracker = 1; - st=CreateScope(NULL,1,1); - //int a; - yyparse(); - //while ((a = yyparse() != EOF){ - // token_tracker++; - //printf("%d = a: yytext = %s: yychar = %d, token number: %d\n", a, yytext, yychar,token_tracker); - //if(yytext[0] == '\n'){ - FILE* f = fdopen(1,"w"); - print_symbol_table(getAncestor(st),f); - fclose(f); - // break; - //} - //} - return 0; +/* +int main(int argc, char * argv[]) { + token_tracker = 1; + cur=CreateScope(NULL,1,1); + //int a; + FILE * fp; + if(argc > 1){ + fp = fopen(argv[1], "r"); + yyin = fp; + } else { + fp = stdin; + yyin = fp; + } + yyparse(); + //while ((a = yyparse() != EOF){ + // token_tracker++; + //printf("%d = a: yytext = %s: yychar = %d, token number: %d\n", a, yytext, yychar,token_tracker); + //if(yytext[0] == '\n'){ + FILE* f = fdopen(1,"w"); + print_symbol_table(getAncestor(cur),f); + fclose(f); + // break; + //} + //} + return 0; } */ diff --git a/src/lexicalStructure.lex b/src/lexicalStructure.lex index bf05e1d..c2db6b5 100644 --- a/src/lexicalStructure.lex +++ b/src/lexicalStructure.lex @@ -63,7 +63,7 @@ SCHAR \\n|\\t|\\\"|[^\"\n\\] {DIGIT}+ {if(DEBUG) {printf( "C_INTEGER: %s (%d)\n", yytext, C_INTEGER);} else {return C_INTEGER;}} '{CHAR}' {if(DEBUG) {printf( "C_CHARACTER: %s (%d)\n", yytext, C_CHARACTER);} else {return C_CHARACTER;}} \"{SCHAR}*\" {if(DEBUG) {printf( "C_STRING: %s (%d)\n", yytext, C_STRING);} else {return C_STRING;}} -{COMMENT} {if(DEBUG) {printf( "COMMENT: %s (%d)\n", yytext, COMMENT);} else {return COMMENT;}} +{COMMENT} {if(DEBUG) {printf( "COMMENT: %s (%d)\n", yytext, COMMENT);} else {/*return COMMENT;*/}} "(" {if(DEBUG) {printf( "L_PAREN: %s (%d)\n", yytext, L_PAREN);} else {return L_PAREN;}} ")" {if(DEBUG) {printf( "R_PAREN: %s (%d)\n", yytext, R_PAREN);} else {return R_PAREN;}} diff --git a/src/runner.c b/src/runner.c index 85e9495..fa361d5 100644 --- a/src/runner.c +++ b/src/runner.c @@ -59,7 +59,7 @@ int check_flag(char *arg, char *alpha) { int run(FILE *alpha) { int token; - curr = CreateScope(NULL, 1, 1); + cur = CreateScope(NULL, 1, 1); // If file is not found if (alpha == NULL) { @@ -108,7 +108,7 @@ int run(FILE *alpha) { yyparse(); FILE *f = fdopen(1, "w"); - print_symbol_table(getAncestor(curr), f); + print_symbol_table(getAncestor(cur), f); fclose(f); if (yyin != NULL) { @@ -179,12 +179,12 @@ int is_alpha_file(char *alpha, int file_len) { } void enter_scope(int line, int column) { - curr = CreateScope(curr, line, column); + cur = CreateScope(cur, line, column); } void exit_scope() { - if (curr->Parent_Scope == NULL) { + if (cur->Parent_Scope == NULL) { printf("Can't close top"); return; } - curr = curr->Parent_Scope; + cur = cur->Parent_Scope; } diff --git a/src/runner.h b/src/runner.h index daff88c..9f66407 100644 --- a/src/runner.h +++ b/src/runner.h @@ -31,7 +31,7 @@ extern FILE *yyin; int arg; SymbolTable *top; -SymbolTable *curr; +SymbolTable *cur; // int main(int argc, char* argv[]); char *is_tok(int argc, char *argv[]); diff --git a/tests/sprint2/test/sp2_one_line.alpha b/tests/sprint2/test/sp2_one_line.alpha index 01f115e..9031b5f 100644 --- a/tests/sprint2/test/sp2_one_line.alpha +++ b/tests/sprint2/test/sp2_one_line.alpha @@ -1 +1 @@ -type rec: [integer: x; integer: y] type T1: integer -> integer type T2: rec -> integer function foo : T1 function bar1 : T2 function bar2 : T2 foo(x) := { return x * x; } bar1(a) := { return a.x * a.y; } bar2 as (r,s) := { return r * s; } entry(arg) := { [ integer: result ; rec: w] result := foo(5); w := reserve(w); w.x := 5; w.y := 7; result := bar1(w); result := bar2(5,7); return 0; } +type rec: [integer: x; integer: y] type T1: integer -> integer type T2: rec -> integer function foo : T1 function bar1 : T2 function bar2 : T2 foo(x) := { return x * x; } bar1(a) := { return a.x * a.y; } bar2 as (r,s) := { return r * s; } entry(arg) := { [ integer: result ; rec: w] result := foo(5); w := reserve w; w.x := 5; w.y := 7; result := bar1(w); result := bar2(5,7); return 0; } From f99dfc9b5454caac34c754eaec068c696f66669b Mon Sep 17 00:00:00 2001 From: Meyer Simon Date: Wed, 5 Mar 2025 15:31:01 -0500 Subject: [PATCH 093/105] Fixed some of the spacing and added a harder test t#36 --- src/grammar.y | 120 ++++++++++++++++---------------------------------- 1 file changed, 39 insertions(+), 81 deletions(-) diff --git a/src/grammar.y b/src/grammar.y index 3b5359f..d275f94 100644 --- a/src/grammar.y +++ b/src/grammar.y @@ -1,7 +1,3 @@ -/* Syntax Analyzer with Bison (3.8.1) */ -/* (referenced Bison manual for file boilerplate [3.1]) */ - -// Prologue %{ #include #include "../src/symbol_table.c" @@ -22,7 +18,7 @@ int integ; char * words; } -//precedence order + //need subtraction only here %type id_or_types %type types @@ -72,6 +68,8 @@ %token RESERVE 613 %token RELEASE 614 %token COMMENT 700 + +//precedence order %precedence RESERVE RELEASE %precedence DOT %precedence UMINUS @@ -84,120 +82,83 @@ %left OR %left ASSIGN - %% program: - prototype_or_definition_list; + prototype_or_definition_list + ; prototype_or_definition_list: - prototype prototype_or_definition_list + prototype prototype_or_definition_list | definition prototype_or_definition_list | prototype | definition ; + prototype: - L_PAREN EXTERNAL R_PAREN FUNCTION ID COLON ID; + L_PAREN EXTERNAL R_PAREN FUNCTION ID COLON ID; definition: TYPE ID COLON dblock | TYPE ID COLON constant ARROW ID - //| TYPE ID COLON types ARROW ID | function_declaration | TYPE ID COLON id_or_types ARROW id_or_types | ID parameter ASSIGN sblock ; + function_declaration: - FUNCTION { printf("found a function def\n"); }ID COLON ID - | EXTERNAL { printf("found an external function def\n"); }FUNCTION ID COLON ID + FUNCTION ID COLON ID + | EXTERNAL FUNCTION ID COLON ID ; parameter: - L_PAREN { printf("found a param def\n"); } ID R_PAREN - | AS{ printf("found a param_as_list def\n"); } L_PAREN idlist R_PAREN + L_PAREN ID R_PAREN + | AS L_PAREN idlist R_PAREN ; idlist: - ID COMMA idlist - |ID + ID COMMA idlist + | ID ; sblock: - L_BRACE {printf("open brace\n"); cur = CreateScope(cur,2,2);} statement_list {printf("close brace\n"); cur = getParent(cur);} R_BRACE - | L_BRACE {printf("open brace\n"); cur = CreateScope(cur,2,2);} dblock statement_list {printf("close brace\n"); cur = getParent(cur);} R_BRACE + L_BRACE {cur = CreateScope(cur,2,2);} statement_list {cur = getParent(cur);} R_BRACE + | L_BRACE {cur = CreateScope(cur,2,2);} dblock statement_list {cur = getParent(cur);} R_BRACE ; dblock: - L_BRACKET declaration_list R_BRACKET; + L_BRACKET declaration_list R_BRACKET; declaration_list: - declaration - {printf( - "found a decleration of form dec;dec_list\n"); - //CreateEntry(cur,cur_type,cur_value); - } - SEMI_COLON declaration_list + declaration SEMI_COLON declaration_list | declaration - {printf( - "found a decleration of form dec\n"); - //CreateEntry(cur,cur_type,cur_value); - } ; declaration: - id_or_types COLON ID { - - CreateEntry(cur,$1,$3); -// printf("declaration rule encountered"); -// if(cur_value != NULL){ -// char* delete1 = cur_value; -// printf("delete1 var assigned to cur_value"); -// free(delete1); -// printf("delete1 var freed"); -// } -// if(cur_type != NULL){ -// char* delete2 = cur_type; -// free(delete2);} -// int len = strlen($1); -// printf("length determined"); -// cur_value = malloc(len + 1); -// printf("space allocated"); -// strcpy(cur_value, $1); -// printf("string copied over"); - -// len = strlen($3); -// cur_type = malloc(len + 1); -// strcpy(cur_type, $3); -// printf("value var is %s type var is %s\n",cur_value,cur_type); - } -// | types COLON ID + id_or_types COLON ID {CreateEntry(cur,$1,$3); } ; + id_or_types: - ID + ID | types ; + statement_list: - compound_statement statement_list + compound_statement statement_list | compound_statement | simple_statement SEMI_COLON statement_list | simple_statement SEMI_COLON ; compound_statement: - WHILE {printf("found an while statment\n"); } L_PAREN expression R_PAREN sblock - | IF {printf("found an if statment\n"); }L_PAREN expression R_PAREN THEN sblock ELSE sblock + WHILE L_PAREN expression R_PAREN sblock + | IF L_PAREN expression R_PAREN THEN sblock ELSE sblock | sblock ; -// Ref Compilers Principles, Techniques, & Tools - - - - simple_statement: - assignable ASSIGN {printf("found an assignment statment\n"); } expression -// I think that we need to add memOp stuff here | assignable ASSIGN expression {printf("found an assignment statment\n"); } - | RETURN {printf("found an return statment\n"); } expression + assignable ASSIGN expression + | RETURN expression ; assignable: @@ -207,7 +168,7 @@ assignable: ; rec_op : - DOT + DOT expression: constant @@ -223,31 +184,28 @@ expression: | expression LESS_THAN expression | expression EQUAL_TO expression | assignable - //| constant binaryOperator expression - //| ID binaryOperator expression | L_PAREN expression R_PAREN | memOp assignable ; - - ablock: - L_PAREN argument_list R_PAREN; + L_PAREN argument_list R_PAREN + ; argument_list: - expression COMMA argument_list + expression COMMA argument_list | expression ; memOp: - RESERVE + RESERVE | RELEASE ; constant: - C_STRING + C_STRING | C_INTEGER | C_NULL | C_CHARACTER @@ -256,19 +214,19 @@ constant: ; types: - T_STRING + T_STRING | T_INTEGER | T_ADDRESS | T_CHARACTER | T_BOOLEAN ; -// + %% void yyerror(const char *err) { fprintf(stderr, "ERROR: %s at token %s at line number %d,column number %d\n", err,yytext,line_number,column_number); } -/* +/* int main(int argc, char * argv[]) { token_tracker = 1; cur=CreateScope(NULL,1,1); @@ -283,13 +241,13 @@ int main(int argc, char * argv[]) { } yyparse(); //while ((a = yyparse() != EOF){ - // token_tracker++; + // token_tracker++; //printf("%d = a: yytext = %s: yychar = %d, token number: %d\n", a, yytext, yychar,token_tracker); //if(yytext[0] == '\n'){ FILE* f = fdopen(1,"w"); print_symbol_table(getAncestor(cur),f); fclose(f); - // break; + // break; //} //} return 0; From 6fdccb3d8e0405a1bc4556963d2068ee7950ac37 Mon Sep 17 00:00:00 2001 From: Meyer Simon Date: Wed, 5 Mar 2025 16:49:45 -0500 Subject: [PATCH 094/105] fixed the spaceing t#34 --- src/grammar.y | 5 +- src/lexicalStructure.lex | 2 + src/runner.c | 294 ++++++++++++++-------------- tests/sprint2/test/sp2_llnode.alpha | 74 +++++++ 4 files changed, 226 insertions(+), 149 deletions(-) create mode 100644 tests/sprint2/test/sp2_llnode.alpha diff --git a/src/grammar.y b/src/grammar.y index d275f94..921a666 100644 --- a/src/grammar.y +++ b/src/grammar.y @@ -4,6 +4,7 @@ extern int yylex(void); void yyerror(const char *err); extern char* yytext; + extern int yyleng; extern int yychar; extern SymbolTable * cur; //char* cur_value; @@ -122,8 +123,8 @@ idlist: ; sblock: - L_BRACE {cur = CreateScope(cur,2,2);} statement_list {cur = getParent(cur);} R_BRACE - | L_BRACE {cur = CreateScope(cur,2,2);} dblock statement_list {cur = getParent(cur);} R_BRACE + L_BRACE {column_number += yyleng; cur = CreateScope(cur,line_number,column_number);} statement_list {cur = getParent(cur);} R_BRACE + | L_BRACE {column_number += yyleng; cur = CreateScope(cur,line_number,column_number);} dblock statement_list {cur = getParent(cur);} R_BRACE ; dblock: diff --git a/src/lexicalStructure.lex b/src/lexicalStructure.lex index c2db6b5..98a70d2 100644 --- a/src/lexicalStructure.lex +++ b/src/lexicalStructure.lex @@ -7,9 +7,11 @@ %{ #include #include "../tmp/grammar.tab.h" + #include "../src/symbol_table.h" #ifndef DEBUG #define DEBUG 0 #endif + extern SymbolTable * cur; int line_number = 1, column_number = 1; %} diff --git a/src/runner.c b/src/runner.c index fa361d5..2132f65 100644 --- a/src/runner.c +++ b/src/runner.c @@ -4,187 +4,187 @@ #include "runner.h" int main(int argc, char *argv[]) { - if (argc == 1) { - fprintf(stderr, INVALID); - return -1; - } - - else if (argc == 2) { - if (is_help(argv[1])) { - return 0; - } else if (is_alpha_file(argv[1], strlen(argv[1])) == 0) { - no_flag = SET_FLAG; - alpha_file = fopen(argv[1], "r"); - } else { - fprintf(stderr, INVALID); - return -1; - } - } - - else { - if (is_alpha_file(argv[argc - 1], strlen(argv[argc - 1])) != 0) { - fprintf(stderr, INVALID); - return -1; - } else { - for (int i = 1; i < argc - 1; i++) { - if (check_flag(argv[i], argv[argc - 1]) != 0) { - fprintf(stderr, "INVALID FLAG(S): Use -help to view valid inputs \n"); - return -1; + if (argc == 1) { + fprintf(stderr, INVALID); + return -1; } - } - alpha_file = fopen(argv[argc - 1], "r"); - } - } - return run(alpha_file); + + else if (argc == 2) { + if (is_help(argv[1])) { + return 0; + } else if (is_alpha_file(argv[1], strlen(argv[1])) == 0) { + no_flag = SET_FLAG; + alpha_file = fopen(argv[1], "r"); + } else { + fprintf(stderr, INVALID); + return -1; + } + } + + else { + if (is_alpha_file(argv[argc - 1], strlen(argv[argc - 1])) != 0) { + fprintf(stderr, INVALID); + return -1; + } else { + for (int i = 1; i < argc - 1; i++) { + if (check_flag(argv[i], argv[argc - 1]) != 0) { + fprintf(stderr, "INVALID FLAG(S): Use -help to view valid inputs \n"); + return -1; + } + } + alpha_file = fopen(argv[argc - 1], "r"); + } + } + return run(alpha_file); } int check_flag(char *arg, char *alpha) { - if (strcmp("-tok", arg) == 0) { - if (tok_flag == NULL) { - return new_file(arg, alpha); - } - fprintf(stderr, "FLAGS REPEAT\n"); - return -1; - } else if (strcmp("-st", arg) == 0) { - if (st_flag == NULL) { - return new_file(arg, alpha); - } - fprintf(stderr, "FLAGS REPEAT\n"); - return -1; - } else { - fprintf(stderr, "INVALID FLAG: Use -help for valid inputs\n"); - return -1; - } + if (strcmp("-tok", arg) == 0) { + if (tok_flag == NULL) { + return new_file(arg, alpha); + } + fprintf(stderr, "FLAGS REPEAT\n"); + return -1; + } else if (strcmp("-st", arg) == 0) { + if (st_flag == NULL) { + return new_file(arg, alpha); + } + fprintf(stderr, "FLAGS REPEAT\n"); + return -1; + } else { + fprintf(stderr, "INVALID FLAG: Use -help for valid inputs\n"); + return -1; + } } int run(FILE *alpha) { - int token; - cur = CreateScope(NULL, 1, 1); + int token; + cur = CreateScope(NULL, 1, 1); - // If file is not found - if (alpha == NULL) { - fprintf(stderr, "INPUT FILE NOT FOUND\n"); - return -1; - } - yyin = alpha; - - // TOK FLAG - if (tok_flag != NULL) { - while (0 != (token = yylex())) { - if (tok_flag != NULL) { - fprintf(tok_flag, "%d %d %3d \"%s\"\n", line_number, column_number, - token, yytext); - } - if (token == COMMENT) { - for (int i = 0; i < yyleng; i++) { - if (yytext[i] == '\n') { - line_number++; - column_number = 0; - } - column_number++; + // If file is not found + if (alpha == NULL) { + fprintf(stderr, "INPUT FILE NOT FOUND\n"); + return -1; } - continue; - } - if (token == 1999) { - printf( - "On line number %d and column number %d we have an invalid " - "character:%s\n", - line_number, column_number, yytext); - } - column_number += yyleng; - } - fclose(tok_flag); + yyin = alpha; - if (yyin != NULL) { - fclose(yyin); - } - return 0; - } + // TOK FLAG + if (tok_flag != NULL) { + while (0 != (token = yylex())) { + if (tok_flag != NULL) { + fprintf(tok_flag, "%d %d %3d \"%s\"\n", line_number, column_number, + token, yytext); + } + if (token == COMMENT) { + for (int i = 0; i < yyleng; i++) { + if (yytext[i] == '\n') { + line_number++; + column_number = 0; + } + column_number++; + } + continue; + } + if (token == 1999) { + printf( + "On line number %d and column number %d we have an invalid " + "character:%s\n", + line_number, column_number, yytext); + } + column_number += yyleng; + } + fclose(tok_flag); - if (st_flag != NULL) { - // output symbol table, file pointer is - // print_symbol_table(top,st_flag); - } + if (yyin != NULL) { + fclose(yyin); + } + return 0; + } - yyparse(); - FILE *f = fdopen(1, "w"); - print_symbol_table(getAncestor(cur), f); - fclose(f); + if (st_flag != NULL) { + // output symbol table, file pointer is + // print_symbol_table(top,st_flag); + } - if (yyin != NULL) { - fclose(yyin); - } + yyparse(); + FILE *f = fdopen(1, "w"); + print_symbol_table(getAncestor(cur), f); + fclose(f); - return 0; + if (yyin != NULL) { + fclose(yyin); + } + + return 0; } bool is_help(char *input) { - if (strcmp(input, "-help") == 0) { - printf("%s", HELP); - return true; - } + if (strcmp(input, "-help") == 0) { + printf("%s", HELP); + return true; + } - return false; + return false; } int new_file(char *arg, char *alpha) { - int type_len; - const char *basename = alpha; - const char *slash = strchr(alpha, '/'); + int type_len; + const char *basename = alpha; + const char *slash = strchr(alpha, '/'); - while (slash != NULL) { - basename = slash + 1; - slash = strchr(basename, '/'); - } + while (slash != NULL) { + basename = slash + 1; + slash = strchr(basename, '/'); + } - mkdir("./out", 0777); + mkdir("./out", 0777); - char *new_basename = calloc(strlen(basename) + 5, sizeof(char)); - strcpy(new_basename, "./out/"); - strcat(new_basename, basename); - basename = new_basename; + char *new_basename = calloc(strlen(basename) + 5, sizeof(char)); + strcpy(new_basename, "./out/"); + strcat(new_basename, basename); + basename = new_basename; - if (strcmp(arg, "-tok") == 0) { - type_len = TOK_LEN; - } else if (strcmp(arg, "-st") == 0) { - type_len = ST_LEN; - } else { - fprintf(stderr, "INVALID FLAG: Use -help to view valid inputs\n"); - return -1; - } + if (strcmp(arg, "-tok") == 0) { + type_len = TOK_LEN; + } else if (strcmp(arg, "-st") == 0) { + type_len = ST_LEN; + } else { + fprintf(stderr, "INVALID FLAG: Use -help to view valid inputs\n"); + return -1; + } - // calculate lengths - int basename_len = strlen(basename); - char *file_name = - calloc(basename_len - ALPHA_OFFSET + type_len + 2, sizeof(char)); + // calculate lengths + int basename_len = strlen(basename); + char *file_name = + calloc(basename_len - ALPHA_OFFSET + type_len + 2, sizeof(char)); - // coy filename and add extension - strncpy(file_name, basename, basename_len - ALPHA_OFFSET); - strcat(file_name, "."); - strcat(file_name, arg + 1); + // coy filename and add extension + strncpy(file_name, basename, basename_len - ALPHA_OFFSET); + strcat(file_name, "."); + strcat(file_name, arg + 1); - if (strcmp(arg, "-tok") == 0) { - tok_flag = fopen(file_name, "w"); - } else if (strcmp(arg, "-st") == 0) { - st_flag = fopen(file_name, "w"); - } - return 0; + if (strcmp(arg, "-tok") == 0) { + tok_flag = fopen(file_name, "w"); + } else if (strcmp(arg, "-st") == 0) { + st_flag = fopen(file_name, "w"); + } + return 0; } int is_alpha_file(char *alpha, int file_len) { - if (strcmp(".alpha", alpha + sizeof(char) * (file_len - ALPHA_OFFSET)) != 0) { - return -1; // not alpha file - } - return 0; // is alpha file + if (strcmp(".alpha", alpha + sizeof(char) * (file_len - ALPHA_OFFSET)) != 0) { + return -1; // not alpha file + } + return 0; // is alpha file } void enter_scope(int line, int column) { - cur = CreateScope(cur, line, column); + cur = CreateScope(cur, line, column); } void exit_scope() { - if (cur->Parent_Scope == NULL) { - printf("Can't close top"); - return; - } - cur = cur->Parent_Scope; + if (cur->Parent_Scope == NULL) { + printf("Can't close top"); + return; + } + cur = cur->Parent_Scope; } diff --git a/tests/sprint2/test/sp2_llnode.alpha b/tests/sprint2/test/sp2_llnode.alpha new file mode 100644 index 0000000..880ca0b --- /dev/null +++ b/tests/sprint2/test/sp2_llnode.alpha @@ -0,0 +1,74 @@ +type rec: [integer: x; integer: y] +type T1: integer -> integer +type T2: rec -> integer + +type llnode: [address: prev; integer: val; address: next] +type list: integer -> llnode + +function foo : T1 +function bar1 : T2 +function bar2 : T2 +function make_list : list +make_list(a) := { + [integer:orig_a; address: ret; address: curr; address: temp] + if (a < 0 | a = 0) then { + return null; + } else { + ret := reserve llnode; + ret.prev := null; + ret.next := null; + ret.val := a; + while (0 < a) { + temp := reserve llnode; + temp.prev := null; + temp.next := null; + temp.val := val; + if (a = orig_a) then { + ret.next := temp; + temp.prev := ret; + curr := temp; + } else { + curr.next := temp; + temp.prev := curr; + curr := temp; + } + a := a - 1; + } + return ret; + } +} + + +foo(x) := { + return x * x; + } +bar1(a) := { + return a.x * a.y; + } + +bar2 as (r,s) := { + if (r < s) then { + while (!(r < s)) { + r := r + 1; + } + } else { + [integer: x] + x := 0; + while (x < 10) { + r := r + s; + } + } + return r * s; + } +entry(arg) := { + [ integer: result ; rec: w; llnode: li] + li := make_list(6); + result := foo(5); + w := reserve w; + w.x := 5; + w.y := 7; + result := bar1(w); + result := bar2(5,7); + + return 0; +} From 211919d70ec1ac7416be8db7af92eb70d7a81288 Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Thu, 6 Mar 2025 02:05:47 -0500 Subject: [PATCH 095/105] fixed location issues for error messages and scoping. Used location macros and the percent location as defined in guides to track location. Code may warrant cleanup as we don't need to manually keep track of locations ourselves any more through our line and column number variables --- src/grammar.y | 9 +- src/grammar.y.save | 255 ++++++++++++++++++++++++++++++++ src/lexicalStructure.lex | 110 +++++++------- src/lexicalStructure.lex.save | 91 ++++++++++++ src/lexicalStructure.lex.save.1 | 91 ++++++++++++ src/runner.c | 28 +++- 6 files changed, 524 insertions(+), 60 deletions(-) create mode 100644 src/grammar.y.save create mode 100644 src/lexicalStructure.lex.save create mode 100644 src/lexicalStructure.lex.save.1 diff --git a/src/grammar.y b/src/grammar.y index 921a666..3732fc1 100644 --- a/src/grammar.y +++ b/src/grammar.y @@ -14,7 +14,8 @@ extern int column_number; extern FILE * yyin; %} - +//%define api.location.type {location_t} +%locations %union { int integ; char * words; @@ -123,8 +124,8 @@ idlist: ; sblock: - L_BRACE {column_number += yyleng; cur = CreateScope(cur,line_number,column_number);} statement_list {cur = getParent(cur);} R_BRACE - | L_BRACE {column_number += yyleng; cur = CreateScope(cur,line_number,column_number);} dblock statement_list {cur = getParent(cur);} R_BRACE + L_BRACE {cur = CreateScope(cur,@1.first_line,@1.first_column);} statement_list {cur = getParent(cur);} R_BRACE + | L_BRACE {cur = CreateScope(cur,@1.first_line,@1.first_column);} dblock statement_list {cur = getParent(cur);} R_BRACE ; dblock: @@ -225,7 +226,7 @@ types: %% void yyerror(const char *err) { - fprintf(stderr, "ERROR: %s at token %s at line number %d,column number %d\n", err,yytext,line_number,column_number); + fprintf(stderr, "ERROR: %s at token %s at line number %d,column number %d\n", err,yytext,yylloc.first_line,yylloc.first_column); } /* int main(int argc, char * argv[]) { diff --git a/src/grammar.y.save b/src/grammar.y.save new file mode 100644 index 0000000..df5d589 --- /dev/null +++ b/src/grammar.y.save @@ -0,0 +1,255 @@ +%{ + #include + #include "../src/symbol_table.c" + extern int yylex(void); + void yyerror(const char *err); + extern char* yytext; + extern int yychar; + extern SymbolTable * cur; + //char* cur_value; + //char* cur_type; + int token_tracker; + extern int line_number; + extern int column_number; + extern FILE * yyin; +%} + +%union { + int integ; + char * words; +} + +//need subtraction only here +%type id_or_types +%type types +%token ID 101 +%token T_INTEGER 201 +%token T_ADDRESS 202 +%token T_BOOLEAN 203 +%token T_CHARACTER 204 +%token T_STRING 205 +%token C_INTEGER 301 +%token C_NULL 302 +%token C_CHARACTER 303 +%token C_STRING 304 +%token C_TRUE 305 +%token C_FALSE 306 +%token WHILE 401 +%token IF 402 +%token THEN 403 +%token ELSE 404 +%token TYPE 405 +%token FUNCTION 406 +%token RETURN 407 +%token EXTERNAL 408 +%token AS 409 +%token L_PAREN 501 +%token R_PAREN 502 +%token L_BRACKET 503 +%token R_BRACKET 504 +%token L_BRACE 505 +%token R_BRACE 506 +%token SEMI_COLON 507 +%token COLON 508 +%token COMMA 509 +%token ARROW 510 +%token MUL 603 +%token DIV 604 +%token REM 605 +%token ADD 601 +%token LESS_THAN 606 +%token EQUAL_TO 607 +%token AND 610 +%token OR 611 +%token ASSIGN 608 +%token SUB_OR_NEG 602 +%token NOT 609 +%token DOT 612 +%token RESERVE 613 +%token RELEASE 614 +%token COMMENT 700 + +//precedence order +%precedence RESERVE RELEASE +%precedence DOT +%precedence UMINUS +%precedence NOT +%left MUL DIV REM +%left ADD SUB_OR_NEG +%left LESS_THAN +%left EQUAL_TO +%left AND +%left OR +%left ASSIGN + +%% + +program: + prototype_or_definition_list + ; + +prototype_or_definition_list: + prototype prototype_or_definition_list + | definition prototype_or_definition_list + | prototype + | definition + ; + +prototype: + L_PAREN EXTERNAL R_PAREN FUNCTION ID COLON ID; + +definition: + TYPE ID COLON dblock + | TYPE ID COLON constant ARROW ID + | function_declaration + | TYPE ID COLON id_or_types ARROW id_or_types + | ID parameter ASSIGN sblock + ; + +function_declaration: + FUNCTION ID COLON ID + | EXTERNAL FUNCTION ID COLON ID + ; + +parameter: + L_PAREN ID R_PAREN + | AS L_PAREN idlist R_PAREN + ; + +idlist: + ID COMMA idlist + | ID + ; + +sblock: + L_BRACE {cur = CreateScope(cur,2,2);} statement_list {cur = getParent(cur);} R_BRACE + | L_BRACE {cur = CreateScope(cur,2,2);} dblock statement_list {cur = getParent(cur);} R_BRACE + ; + +dblock: + L_BRACKET declaration_list R_BRACKET; + +declaration_list: + declaration SEMI_COLON declaration_list + | declaration + ; + + +declaration: + id_or_types COLON ID {CreateEntry(cur,$1,$3); } + ; + +id_or_types: + ID + | types + ; + +statement_list: + compound_statement statement_list + | compound_statement + | simple_statement SEMI_COLON statement_list + | simple_statement SEMI_COLON + ; + +compound_statement: + WHILE L_PAREN expression R_PAREN sblock + | IF L_PAREN expression R_PAREN THEN sblock ELSE sblock + | sblock + ; + +simple_statement: + assignable ASSIGN expression + | RETURN expression + ; + +assignable: + ID + | assignable ablock + | assignable rec_op ID + ; + +rec_op : + DOT + +expression: + constant + | SUB_OR_NEG expression %prec UMINUS + | NOT expression + | expression ADD expression + | expression SUB_OR_NEG expression + | expression MUL expression + | expression DIV expression + | expression REM expression + | expression AND expression + | expression OR expression + | expression LESS_THAN expression + | expression EQUAL_TO expression + | assignable + | L_PAREN expression R_PAREN + | memOp assignable + ; + +ablock: + L_PAREN argument_list R_PAREN + ; + +argument_list: + expression COMMA argument_list + | expression + ; + + +memOp: + RESERVE + | RELEASE + ; + + +constant: + C_STRING + | C_INTEGER + | C_NULL + | C_CHARACTER + | C_TRUE + | C_FALSE + ; + +types: + T_STRING + | T_INTEGER + | T_ADDRESS + | T_CHARACTER + | T_BOOLEAN + ; + +%% + +void yyerror(const char *err) { + fprintf(stderr, "ERROR: %s at token %s at line number %d,column number %d\n", err,yytext,line_number,column_number); +} +/* +int main(int argc, char * argv[]) { + token_tracker = 1; + cur=CreateScope(NULL,1,1); + //int a; + FILE * fp; + if(argc > 1){ + fp = fopen(argv[1], "r"); + yyin = fp; + } else { + fp = stdin; + yyin = fp; + } + yyparse(); + //while ((a = yyparse() != EOF){ + // token_tracker++; + //printf("%d = a: yytext = %s: yychar = %d, token number: %d\n", a, yytext, yychar,token_tracker); + //if(yytext[0] == '\n'){ + FILE* f = fdopen(1,"w"); + print_symbol_table(getAncestor(cur),f); + fclose(f); + // break; + //} + //} + return 0; +} */ diff --git a/src/lexicalStructure.lex b/src/lexicalStructure.lex index 98a70d2..aae5433 100644 --- a/src/lexicalStructure.lex +++ b/src/lexicalStructure.lex @@ -3,7 +3,7 @@ %option noyywrap %option header-file="flex.h" - +%option yylineno %{ #include #include "../tmp/grammar.tab.h" @@ -12,8 +12,18 @@ #define DEBUG 0 #endif extern SymbolTable * cur; + extern FILE* tok_flag; + extern void incr(int lnum,int cnum, int tok); + extern void print_tok(int tok); int line_number = 1, column_number = 1; + int yycolumn = 1; + #define YY_USER_ACTION { \ + yylloc.first_line = yylineno; \ + yylloc.last_line = yylineno; \ + yylloc.first_column = yycolumn; \ + yylloc.last_column = yycolumn + yyleng - 1; \ + yycolumn += yyleng; } %} STARCOM [^\*]|\*+[^\)\*]+ @@ -26,63 +36,63 @@ SCHAR \\n|\\t|\\\"|[^\"\n\\] %% -"integer" {if(DEBUG) {printf( "T_INTEGER: %s (%d)\n", yytext, T_INTEGER);} else {return T_INTEGER;}} -"address" {if(DEBUG) {printf( "T_ADDRESS: %s (%d)\n", yytext, T_ADDRESS);} else {return T_ADDRESS;}} -"Boolean" {if(DEBUG) {printf( "T_BOOLEAN: %s (%d)\n", yytext, T_BOOLEAN);} else {return T_BOOLEAN;}} -"character" {if(DEBUG) {printf( "T_CHARACTER: %s (%d)\n", yytext, T_CHARACTER);} else {return T_CHARACTER;}} +"integer" {if(DEBUG) {printf( "T_INTEGER: %s (%d)\n", yytext, T_INTEGER);} else {if(tok_flag != NULL){print_tok(T_INTEGER);}incr(line_number,column_number,T_INTEGER);return T_INTEGER;}} +"address" {if(DEBUG) {printf( "T_ADDRESS: %s (%d)\n", yytext, T_ADDRESS);} else {if(tok_flag != NULL){print_tok(T_ADDRESS);}incr(line_number,column_number,T_ADDRESS);return T_ADDRESS;}} +"Boolean" {if(DEBUG) {printf( "T_BOOLEAN: %s (%d)\n", yytext, T_BOOLEAN);} else {if(tok_flag != NULL){print_tok(T_INTEGER);}incr(line_number,column_number,T_INTEGER);return T_BOOLEAN;}} +"character" {if(DEBUG) {printf( "T_CHARACTER: %s (%d)\n", yytext, T_CHARACTER);} else {if(tok_flag != NULL){print_tok(T_CHARACTER);}incr(line_number,column_number,T_CHARACTER);return T_CHARACTER;}} -"while" {if(DEBUG) {printf( "WHILE: %s (%d)\n", yytext, WHILE);} else {return WHILE;}} -"if" {if(DEBUG) {printf( "IF: %s (%d)\n", yytext, IF);} else {return IF;}} -"then" {if(DEBUG) {printf( "THEN: %s (%d)\n", yytext, THEN);} else {return THEN;}} -"else" {if(DEBUG) {printf( "ELSE: %s (%d)\n", yytext, ELSE);} else {return ELSE;}} -"type" {if(DEBUG) {printf( "TYPE: %s (%d)\n", yytext, TYPE);} else {return TYPE;}} -"function" {if(DEBUG) {printf( "FUNCTION: %s (%d)\n", yytext, FUNCTION);} else {return FUNCTION;}} -"return" {if(DEBUG) {printf( "RETURN: %s (%d)\n", yytext, RETURN);} else {return RETURN;}} -"external" {if(DEBUG) {printf( "EXTERNAL: %s (%d)\n", yytext, EXTERNAL);} else {return EXTERNAL;}} -"as" {if(DEBUG) {printf( "AS: %s (%d)\n", yytext, AS);} else {return AS;}} +"while" {if(DEBUG) {printf( "WHILE: %s (%d)\n", yytext, WHILE);} else {if(tok_flag != NULL){print_tok(WHILE);}incr(line_number,column_number,WHILE);return WHILE;}} +"if" {if(DEBUG) {printf( "IF: %s (%d)\n", yytext, IF);} else {if(tok_flag != NULL){print_tok(IF);}incr(line_number,column_number,IF);return IF;}} +"then" {if(DEBUG) {printf( "THEN: %s (%d)\n", yytext, THEN);} else {if(tok_flag != NULL){print_tok(THEN);}incr(line_number,column_number,THEN);return THEN;}} +"else" {if(DEBUG) {printf( "ELSE: %s (%d)\n", yytext, ELSE);} else {if(tok_flag != NULL){print_tok(ELSE);}incr(line_number,column_number,ELSE);return ELSE;}} +"type" {if(DEBUG) {printf( "TYPE: %s (%d)\n", yytext, TYPE);} else {if(tok_flag != NULL){print_tok(TYPE);}incr(line_number,column_number,TYPE);return TYPE;}} +"function" {if(DEBUG) {printf( "FUNCTION: %s (%d)\n", yytext, FUNCTION);} else {if(tok_flag != NULL){print_tok(FUNCTION);}incr(line_number,column_number,FUNCTION);return FUNCTION;}} +"return" {if(DEBUG) {printf( "RETURN: %s (%d)\n", yytext, RETURN);} else {if(tok_flag != NULL){print_tok(RETURN);}incr(line_number,column_number,RETURN);return RETURN;}} +"external" {if(DEBUG) {printf( "EXTERNAL: %s (%d)\n", yytext, EXTERNAL);} else {if(tok_flag != NULL){print_tok(EXTERNAL);}incr(line_number,column_number,EXTERNAL);return EXTERNAL;}} +"as" {if(DEBUG) {printf( "AS: %s (%d)\n", yytext, AS);} else {if(tok_flag != NULL){print_tok(AS);}incr(line_number,column_number,AS);return AS;}} -"release" {if(DEBUG) {printf( "RELEASE: %s (%d)\n", yytext, RELEASE);} else {return RELEASE;}} -"reserve" {if(DEBUG) {printf( "RESERVE: %s (%d)\n", yytext, RESERVE);} else {return RESERVE;}} +"release" {if(DEBUG) {printf( "RELEASE: %s (%d)\n", yytext, RELEASE);} else {if(tok_flag != NULL){print_tok(RELEASE);}incr(line_number,column_number,RELEASE);return RELEASE;}} +"reserve" {if(DEBUG) {printf( "RESERVE: %s (%d)\n", yytext, RESERVE);} else {if(tok_flag != NULL){print_tok(RESERVE);}incr(line_number,column_number,RESERVE);return RESERVE;}} -"+" {if(DEBUG) {printf( "ADD: %s (%d)\n", yytext, ADD);} else {return ADD;}} -"-" {if(DEBUG) {printf( "SUB_OR_NEG: %s (%d)\n", yytext, SUB_OR_NEG);} else {return SUB_OR_NEG;}} -"*" {if(DEBUG) {printf( "MUL: %s (%d)\n", yytext, MUL);} else {return MUL;}} -"/" {if(DEBUG) {printf( "DIV: %s (%d)\n", yytext, DIV);} else {return DIV;}} -"%" {if(DEBUG) {printf( "REM: %s (%d)\n", yytext, REM);} else {return REM;}} -"<" {if(DEBUG) {printf( "LESS_THAN: %s (%d)\n", yytext, LESS_THAN);} else {return LESS_THAN;}} -"=" {if(DEBUG) {printf( "EQUAL_TO: %s (%d)\n", yytext, EQUAL_TO);} else {return EQUAL_TO;}} -":=" {if(DEBUG) {printf( "ASSIGN: %s (%d)\n", yytext, ASSIGN);} else {return ASSIGN;}} -"!" {if(DEBUG) {printf( "NOT: %s (%d)\n", yytext, NOT);} else {return NOT;}} -"&" {if(DEBUG) {printf( "AND: %s (%d)\n", yytext, AND);} else {return AND;}} -"|" {if(DEBUG) {printf( "OR: %s (%d)\n", yytext, OR);} else {return OR;}} -"." {if(DEBUG) {printf( "DOT: %s (%d)\n", yytext, DOT);} else {return DOT;}} +"+" {if(DEBUG) {printf( "ADD: %s (%d)\n", yytext, ADD);} else {if(tok_flag != NULL){print_tok(ADD);}incr(line_number,column_number,ADD);return ADD;}} +"-" {if(DEBUG) {printf( "SUB_OR_NEG: %s (%d)\n", yytext, SUB_OR_NEG);} else {if(tok_flag != NULL){print_tok(SUB_OR_NEG);}incr(line_number,column_number,SUB_OR_NEG);return SUB_OR_NEG;}} +"*" {if(DEBUG) {printf( "MUL: %s (%d)\n", yytext, MUL);} else {if(tok_flag != NULL){print_tok(MUL);}incr(line_number,column_number,MUL);return MUL;}} +"/" {if(DEBUG) {printf( "DIV: %s (%d)\n", yytext, DIV);} else {if(tok_flag != NULL){print_tok(DIV);}incr(line_number,column_number,DIV);return DIV;}} +"%" {if(DEBUG) {printf( "REM: %s (%d)\n", yytext, REM);} else {if(tok_flag != NULL){print_tok(REM);}incr(line_number,column_number,REM);return REM;}} +"<" {if(DEBUG) {printf( "LESS_THAN: %s (%d)\n", yytext, LESS_THAN);} else {if(tok_flag != NULL){print_tok(LESS_THAN);}incr(line_number,column_number,LESS_THAN);return LESS_THAN;}} +"=" {if(DEBUG) {printf( "EQUAL_TO: %s (%d)\n", yytext, EQUAL_TO);} else {if(tok_flag != NULL){print_tok(EQUAL_TO);}incr(line_number,column_number,EQUAL_TO);return EQUAL_TO;}} +":=" {if(DEBUG) {printf( "ASSIGN: %s (%d)\n", yytext, ASSIGN);} else {if(tok_flag != NULL){print_tok(ASSIGN);}incr(line_number,column_number,ASSIGN);return ASSIGN;}} +"!" {if(DEBUG) {printf( "NOT: %s (%d)\n", yytext, NOT);} else {if(tok_flag != NULL){print_tok(NOT);}incr(line_number,column_number,NOT);return NOT;}} +"&" {if(DEBUG) {printf( "AND: %s (%d)\n", yytext, AND);} else {if(tok_flag != NULL){print_tok(AND);}incr(line_number,column_number,AND);return AND;}} +"|" {if(DEBUG) {printf( "OR: %s (%d)\n", yytext, OR);} else {if(tok_flag != NULL){print_tok(OR);}incr(line_number,column_number,OR);return OR;}} +"." {if(DEBUG) {printf( "DOT: %s (%d)\n", yytext, DOT);} else {if(tok_flag != NULL){print_tok(DOT);}incr(line_number,column_number,DOT);return DOT;}} -";" {if(DEBUG) {printf( "SEMI_COLON: %s (%d)\n", yytext, SEMI_COLON);} else {return SEMI_COLON;}} -":" {if(DEBUG) {printf( "COLON: %s (%d)\n", yytext, COLON);} else {return COLON;}} -"," {if(DEBUG) {printf( "COMMA: %s (%d)\n", yytext, COMMA);} else {return COMMA;}} -"->" {if(DEBUG) {printf( "ARROW: %s (%d)\n", yytext, ARROW);} else {return ARROW;}} +";" {if(DEBUG) {printf( "SEMI_COLON: %s (%d)\n", yytext, SEMI_COLON);} else {if(tok_flag != NULL){print_tok(SEMI_COLON);}incr(line_number,column_number,SEMI_COLON);return SEMI_COLON;}} +":" {if(DEBUG) {printf( "COLON: %s (%d)\n", yytext, COLON);} else {if(tok_flag != NULL){print_tok(COLON);}incr(line_number,column_number,COLON);return COLON;}} +"," {if(DEBUG) {printf( "COMMA: %s (%d)\n", yytext, COMMA);} else {if(tok_flag != NULL){print_tok(COMMA);}incr(line_number,column_number,COMMA);return COMMA;}} +"->" {if(DEBUG) {printf( "ARROW: %s (%d)\n", yytext, ARROW);} else {if(tok_flag != NULL){print_tok(ARROW);}incr(line_number,column_number,ARROW);return ARROW;}} -{DIGIT}+ {if(DEBUG) {printf( "C_INTEGER: %s (%d)\n", yytext, C_INTEGER);} else {return C_INTEGER;}} -'{CHAR}' {if(DEBUG) {printf( "C_CHARACTER: %s (%d)\n", yytext, C_CHARACTER);} else {return C_CHARACTER;}} -\"{SCHAR}*\" {if(DEBUG) {printf( "C_STRING: %s (%d)\n", yytext, C_STRING);} else {return C_STRING;}} -{COMMENT} {if(DEBUG) {printf( "COMMENT: %s (%d)\n", yytext, COMMENT);} else {/*return COMMENT;*/}} +{DIGIT}+ {if(DEBUG) {printf( "C_INTEGER: %s (%d)\n", yytext, C_INTEGER);} else {if(tok_flag != NULL){print_tok(C_INTEGER);}incr(line_number,column_number,C_INTEGER);return C_INTEGER;}} +'{CHAR}' {if(DEBUG) {printf( "C_CHARACTER: %s (%d)\n", yytext, C_CHARACTER);} else {if(tok_flag != NULL){print_tok(C_CHARACTER);}incr(line_number,column_number,C_CHARACTER);return C_CHARACTER;}} +\"{SCHAR}*\" {if(DEBUG) {printf( "C_STRING: %s (%d)\n", yytext, C_STRING);} else {if(tok_flag != NULL){print_tok(C_STRING);}incr(line_number,column_number,C_STRING);return C_STRING;}} +{COMMENT} {if(DEBUG) {printf( "COMMENT: %s (%d)\n", yytext, COMMENT);} else {if(tok_flag != NULL){print_tok(COMMENT);}incr(line_number,column_number,COMMENT);/*return COMMENT;*/}} -"(" {if(DEBUG) {printf( "L_PAREN: %s (%d)\n", yytext, L_PAREN);} else {return L_PAREN;}} -")" {if(DEBUG) {printf( "R_PAREN: %s (%d)\n", yytext, R_PAREN);} else {return R_PAREN;}} -"[" {if(DEBUG) {printf( "L_BRACKET: %s (%d)\n", yytext, L_BRACKET);} else {return L_BRACKET;}} -"]" {if(DEBUG) {printf( "R_BRACKET: %s (%d)\n", yytext, R_BRACKET);} else {return R_BRACKET;}} -"{" {if(DEBUG) {printf( "L_BRACE: %s (%d)\n", yytext, L_BRACE);} else {return L_BRACE;}} -"}" {if(DEBUG) {printf( "R_BRACE: %s (%d)\n", yytext, R_BRACE);} else {return R_BRACE;}} +"(" {if(DEBUG) {printf( "L_PAREN: %s (%d)\n", yytext, L_PAREN);} else {if(tok_flag != NULL){print_tok(L_PAREN);}incr(line_number,column_number,L_PAREN);return L_PAREN;}} +")" {if(DEBUG) {printf( "R_PAREN: %s (%d)\n", yytext, R_PAREN);} else {if(tok_flag != NULL){print_tok(R_PAREN);}incr(line_number,column_number,R_PAREN);return R_PAREN;}} +"[" {if(DEBUG) {printf( "L_BRACKET: %s (%d)\n", yytext, L_BRACKET);} else {if(tok_flag != NULL){print_tok(L_BRACKET);}incr(line_number,column_number,L_BRACKET);return L_BRACKET;}} +"]" {if(DEBUG) {printf( "R_BRACKET: %s (%d)\n", yytext, R_BRACKET);} else {if(tok_flag != NULL){print_tok(R_BRACKET);}incr(line_number,column_number,R_BRACKET);return R_BRACKET;}} +"{" {if(DEBUG) {printf( "L_BRACE: %s (%d)\n", yytext, L_BRACE);} else {if(tok_flag != NULL){print_tok(L_BRACE);}incr(line_number,column_number,L_BRACE);return L_BRACE;}} +"}" {if(DEBUG) {printf( "R_BRACE: %s (%d)\n", yytext, R_BRACE);} else {if(tok_flag != NULL){print_tok(R_BRACE);}incr(line_number,column_number,R_BRACE);return R_BRACE;}} -"true" {if(DEBUG) {printf( "C_TRUE: %s (%d)\n", yytext, C_TRUE);} else {return C_TRUE;}} -"false" {if(DEBUG) {printf( "C_FALSE: %s (%d)\n", yytext, C_FALSE);} else {return C_FALSE;}} -"null" {if(DEBUG) {printf( "C_NULL: %s (%d)\n", yytext, C_NULL);} else {return C_NULL;}} +"true" {if(DEBUG) {printf( "C_TRUE: %s (%d)\n", yytext, C_TRUE);} else {if(tok_flag != NULL){print_tok(C_TRUE);}incr(line_number,column_number,C_TRUE);return C_TRUE;}} +"false" {if(DEBUG) {printf( "C_FALSE: %s (%d)\n", yytext, C_FALSE);} else {if(tok_flag != NULL){print_tok(C_FALSE);}incr(line_number,column_number,C_FALSE);return C_FALSE;}} +"null" {if(DEBUG) {printf( "C_NULL: %s (%d)\n", yytext, C_NULL);} else {if(tok_flag != NULL){print_tok(C_NULL);}incr(line_number,column_number,C_NULL);return C_NULL;}} -{ID} {if(DEBUG) {printf( "ID: %s (%d)\n", yytext, ID);} else {yylval.words = strdup(yytext); return ID;}} +{ID} {if(DEBUG) {printf( "ID: %s (%d)\n", yytext, ID);} else {if(tok_flag != NULL){print_tok(ID);}incr(line_number,column_number,ID);yylval.words = strdup(yytext); return ID;}} -\n {line_number++; column_number = 1;} -\t {column_number++;} -" " {column_number++;} -. {column_number++; return 1999;} +\n {yycolumn=1;incr(line_number,column_number,0);} +\t {incr(line_number,column_number,0);} +" " {incr(line_number,column_number,0);} +. {incr(line_number,column_number,0);} %% diff --git a/src/lexicalStructure.lex.save b/src/lexicalStructure.lex.save new file mode 100644 index 0000000..c2ce8c9 --- /dev/null +++ b/src/lexicalStructure.lex.save @@ -0,0 +1,91 @@ +/* Lexical Analyzer with Flex (1.6.0) */ +/* The Translators - Spring 2025 */ + +%option noyywrap +%option header-file="flex.h" + +%{ + #include + #include "../tmp/grammar.tab.h" + #include "../src/symbol_table.h" + #ifndef DEBUG + #define DEBUG 0 + #endif + extern SymbolTable * cur; + extern int tok_flag; + extern void incr(int lnum,int cnum, int tok); + extern void print_tok(int tok); + + int line_number = 1, column_number = 1; +%} + +STARCOM [^\*]|\*+[^\)\*]+ +PARENCOM [^\)]|[^\*\)]+\)+ +COMMENT \(\*{STARCOM}*\*\)|\(\*{PARENCOM}*\*\) +ID [A-Za-z_][0-9A-Za-z_]* +DIGIT [0-9] +CHAR \\n|\\t|\\'|[^'\n\t\\]|\\\\ +SCHAR \\n|\\t|\\\"|[^\"\n\\] + +%% + +"integer" {if(DEBUG) {printf( "T_INTEGER: %s (%d)\n", yytext, T_INTEGER);} else {if(tok_flag != NULL){print_tok(T_INTEGER);}incr(line_number,column_number,T_INTEGER);return T_INTEGER;}} +"address" {if(DEBUG) {printf( "T_ADDRESS: %s (%d)\n", yytext, T_ADDRESS);} else {return T_ADDRESS;}} +"Boolean" {if(DEBUG) {printf( "T_BOOLEAN: %s (%d)\n", yytext, T_BOOLEAN);} else {return T_BOOLEAN;}} +"character" {if(DEBUG) {printf( "T_CHARACTER: %s (%d)\n", yytext, T_CHARACTER);} else {return T_CHARACTER;}} + +"while" {if(DEBUG) {printf( "WHILE: %s (%d)\n", yytext, WHILE);} else {return WHILE;}} +"if" {if(DEBUG) {printf( "IF: %s (%d)\n", yytext, IF);} else {return IF;}} +"then" {if(DEBUG) {printf( "THEN: %s (%d)\n", yytext, THEN);} else {return THEN;}} +"else" {if(DEBUG) {printf( "ELSE: %s (%d)\n", yytext, ELSE);} else {return ELSE;}} +"type" {if(DEBUG) {printf( "TYPE: %s (%d)\n", yytext, TYPE);} else {return TYPE;}} +"function" {if(DEBUG) {printf( "FUNCTION: %s (%d)\n", yytext, FUNCTION);} else {return FUNCTION;}} +"return" {if(DEBUG) {printf( "RETURN: %s (%d)\n", yytext, RETURN);} else {return RETURN;}} +"external" {if(DEBUG) {printf( "EXTERNAL: %s (%d)\n", yytext, EXTERNAL);} else {return EXTERNAL;}} +"as" {if(DEBUG) {printf( "AS: %s (%d)\n", yytext, AS);} else {return AS;}} + +"release" {if(DEBUG) {printf( "RELEASE: %s (%d)\n", yytext, RELEASE);} else {return RELEASE;}} +"reserve" {if(DEBUG) {printf( "RESERVE: %s (%d)\n", yytext, RESERVE);} else {return RESERVE;}} + +"+" {if(DEBUG) {printf( "ADD: %s (%d)\n", yytext, ADD);} else {return ADD;}} +"-" {if(DEBUG) {printf( "SUB_OR_NEG: %s (%d)\n", yytext, SUB_OR_NEG);} else {return SUB_OR_NEG;}} +"*" {if(DEBUG) {printf( "MUL: %s (%d)\n", yytext, MUL);} else {return MUL;}} +"/" {if(DEBUG) {printf( "DIV: %s (%d)\n", yytext, DIV);} else {return DIV;}} +"%" {if(DEBUG) {printf( "REM: %s (%d)\n", yytext, REM);} else {return REM;}} +"<" {if(DEBUG) {printf( "LESS_THAN: %s (%d)\n", yytext, LESS_THAN);} else {return LESS_THAN;}} +"=" {if(DEBUG) {printf( "EQUAL_TO: %s (%d)\n", yytext, EQUAL_TO);} else {return EQUAL_TO;}} +":=" {if(DEBUG) {printf( "ASSIGN: %s (%d)\n", yytext, ASSIGN);} else {return ASSIGN;}} +"!" {if(DEBUG) {printf( "NOT: %s (%d)\n", yytext, NOT);} else {return NOT;}} +"&" {if(DEBUG) {printf( "AND: %s (%d)\n", yytext, AND);} else {return AND;}} +"|" {if(DEBUG) {printf( "OR: %s (%d)\n", yytext, OR);} else {return OR;}} +"." {if(DEBUG) {printf( "DOT: %s (%d)\n", yytext, DOT);} else {return DOT;}} + +";" {if(DEBUG) {printf( "SEMI_COLON: %s (%d)\n", yytext, SEMI_COLON);} else {return SEMI_COLON;}} +":" {if(DEBUG) {printf( "COLON: %s (%d)\n", yytext, COLON);} else {return COLON;}} +"," {if(DEBUG) {printf( "COMMA: %s (%d)\n", yytext, COMMA);} else {return COMMA;}} +"->" {if(DEBUG) {printf( "ARROW: %s (%d)\n", yytext, ARROW);} else {return ARROW;}} + +{DIGIT}+ {if(DEBUG) {printf( "C_INTEGER: %s (%d)\n", yytext, C_INTEGER);} else {return C_INTEGER;}} +'{CHAR}' {if(DEBUG) {printf( "C_CHARACTER: %s (%d)\n", yytext, C_CHARACTER);} else {return C_CHARACTER;}} +\"{SCHAR}*\" {if(DEBUG) {printf( "C_STRING: %s (%d)\n", yytext, C_STRING);} else {return C_STRING;}} +{COMMENT} {if(DEBUG) {printf( "COMMENT: %s (%d)\n", yytext, COMMENT);} else {/*return COMMENT;*/}} + +"(" {if(DEBUG) {printf( "L_PAREN: %s (%d)\n", yytext, L_PAREN);} else {return L_PAREN;}} +")" {if(DEBUG) {printf( "R_PAREN: %s (%d)\n", yytext, R_PAREN);} else {return R_PAREN;}} +"[" {if(DEBUG) {printf( "L_BRACKET: %s (%d)\n", yytext, L_BRACKET);} else {return L_BRACKET;}} +"]" {if(DEBUG) {printf( "R_BRACKET: %s (%d)\n", yytext, R_BRACKET);} else {return R_BRACKET;}} +"{" {if(DEBUG) {printf( "L_BRACE: %s (%d)\n", yytext, L_BRACE);} else {return L_BRACE;}} +"}" {if(DEBUG) {printf( "R_BRACE: %s (%d)\n", yytext, R_BRACE);} else {return R_BRACE;}} + +"true" {if(DEBUG) {printf( "C_TRUE: %s (%d)\n", yytext, C_TRUE);} else {return C_TRUE;}} +"false" {if(DEBUG) {printf( "C_FALSE: %s (%d)\n", yytext, C_FALSE);} else {return C_FALSE;}} +"null" {if(DEBUG) {printf( "C_NULL: %s (%d)\n", yytext, C_NULL);} else {return C_NULL;}} + +{ID} {if(DEBUG) {printf( "ID: %s (%d)\n", yytext, ID);} else {yylval.words = strdup(yytext); return ID;}} + +\n {line_number++; column_number = 1;} +\t {column_number++;} +" " {column_number++;} +. {column_number++; return 1999;} + +%% diff --git a/src/lexicalStructure.lex.save.1 b/src/lexicalStructure.lex.save.1 new file mode 100644 index 0000000..e0d5cc3 --- /dev/null +++ b/src/lexicalStructure.lex.save.1 @@ -0,0 +1,91 @@ +/* Lexical Analyzer with Flex (1.6.0) */ +/* The Translators - Spring 2025 */ + +%option noyywrap +%option header-file="flex.h" + +%{ + #include + #include "../tmp/grammar.tab.h" + #include "../src/symbol_table.h" + #ifndef DEBUG + #define DEBUG 0 + #endif + extern SymbolTable * cur; + extern int tok_flag; + extern void incr(int lnum,int cnum, int tok); + extern void print_tok(int tok); + + int line_number = 1, column_number = 1; +%} + +STARCOM [^\*]|\*+[^\)\*]+ +PARENCOM [^\)]|[^\*\)]+\)+ +COMMENT \(\*{STARCOM}*\*\)|\(\*{PARENCOM}*\*\) +ID [A-Za-z_][0-9A-Za-z_]* +DIGIT [0-9] +CHAR \\n|\\t|\\'|[^'\n\t\\]|\\\\ +SCHAR \\n|\\t|\\\"|[^\"\n\\] + +%% + +"integer" {if(DEBUG) {printf( "T_INTEGER: %s (%d)\n", yytext, T_INTEGER);} else {return T_INTEGER;}} +"address" {if(DEBUG) {printf( "T_ADDRESS: %s (%d)\n", yytext, T_ADDRESS);} else {return T_ADDRESS;}} +"Boolean" {if(DEBUG) {printf( "T_BOOLEAN: %s (%d)\n", yytext, T_BOOLEAN);} else {return T_BOOLEAN;}} +"character" {if(DEBUG) {printf( "T_CHARACTER: %s (%d)\n", yytext, T_CHARACTER);} else {return T_CHARACTER;}} + +"while" {if(DEBUG) {printf( "WHILE: %s (%d)\n", yytext, WHILE);} else {return WHILE;}} +"if" {if(DEBUG) {printf( "IF: %s (%d)\n", yytext, IF);} else {return IF;}} +"then" {if(DEBUG) {printf( "THEN: %s (%d)\n", yytext, THEN);} else {return THEN;}} +"else" {if(DEBUG) {printf( "ELSE: %s (%d)\n", yytext, ELSE);} else {return ELSE;}} +"type" {if(DEBUG) {printf( "TYPE: %s (%d)\n", yytext, TYPE);} else {return TYPE;}} +"function" {if(DEBUG) {printf( "FUNCTION: %s (%d)\n", yytext, FUNCTION);} else {return FUNCTION;}} +"return" {if(DEBUG) {printf( "RETURN: %s (%d)\n", yytext, RETURN);} else {return RETURN;}} +"external" {if(DEBUG) {printf( "EXTERNAL: %s (%d)\n", yytext, EXTERNAL);} else {return EXTERNAL;}} +"as" {if(DEBUG) {printf( "AS: %s (%d)\n", yytext, AS);} else {return AS;}} + +"release" {if(DEBUG) {printf( "RELEASE: %s (%d)\n", yytext, RELEASE);} else {return RELEASE;}} +"reserve" {if(DEBUG) {printf( "RESERVE: %s (%d)\n", yytext, RESERVE);} else {return RESERVE;}} + +"+" {if(DEBUG) {printf( "ADD: %s (%d)\n", yytext, ADD);} else {return ADD;}} +"-" {if(DEBUG) {printf( "SUB_OR_NEG: %s (%d)\n", yytext, SUB_OR_NEG);} else {return SUB_OR_NEG;}} +"*" {if(DEBUG) {printf( "MUL: %s (%d)\n", yytext, MUL);} else {return MUL;}} +"/" {if(DEBUG) {printf( "DIV: %s (%d)\n", yytext, DIV);} else {return DIV;}} +"%" {if(DEBUG) {printf( "REM: %s (%d)\n", yytext, REM);} else {return REM;}} +"<" {if(DEBUG) {printf( "LESS_THAN: %s (%d)\n", yytext, LESS_THAN);} else {return LESS_THAN;}} +"=" {if(DEBUG) {printf( "EQUAL_TO: %s (%d)\n", yytext, EQUAL_TO);} else {return EQUAL_TO;}} +":=" {if(DEBUG) {printf( "ASSIGN: %s (%d)\n", yytext, ASSIGN);} else {return ASSIGN;}} +"!" {if(DEBUG) {printf( "NOT: %s (%d)\n", yytext, NOT);} else {return NOT;}} +"&" {if(DEBUG) {printf( "AND: %s (%d)\n", yytext, AND);} else {return AND;}} +"|" {if(DEBUG) {printf( "OR: %s (%d)\n", yytext, OR);} else {return OR;}} +"." {if(DEBUG) {printf( "DOT: %s (%d)\n", yytext, DOT);} else {return DOT;}} + +";" {if(DEBUG) {printf( "SEMI_COLON: %s (%d)\n", yytext, SEMI_COLON);} else {return SEMI_COLON;}} +":" {if(DEBUG) {printf( "COLON: %s (%d)\n", yytext, COLON);} else {return COLON;}} +"," {if(DEBUG) {printf( "COMMA: %s (%d)\n", yytext, COMMA);} else {return COMMA;}} +"->" {if(DEBUG) {printf( "ARROW: %s (%d)\n", yytext, ARROW);} else {return ARROW;}} + +{DIGIT}+ {if(DEBUG) {printf( "C_INTEGER: %s (%d)\n", yytext, C_INTEGER);} else {return C_INTEGER;}} +'{CHAR}' {if(DEBUG) {printf( "C_CHARACTER: %s (%d)\n", yytext, C_CHARACTER);} else {return C_CHARACTER;}} +\"{SCHAR}*\" {if(DEBUG) {printf( "C_STRING: %s (%d)\n", yytext, C_STRING);} else {return C_STRING;}} +{COMMENT} {if(DEBUG) {printf( "COMMENT: %s (%d)\n", yytext, COMMENT);} else {/*return COMMENT;*/}} + +"(" {if(DEBUG) {printf( "L_PAREN: %s (%d)\n", yytext, L_PAREN);} else {return L_PAREN;}} +")" {if(DEBUG) {printf( "R_PAREN: %s (%d)\n", yytext, R_PAREN);} else {return R_PAREN;}} +"[" {if(DEBUG) {printf( "L_BRACKET: %s (%d)\n", yytext, L_BRACKET);} else {return L_BRACKET;}} +"]" {if(DEBUG) {printf( "R_BRACKET: %s (%d)\n", yytext, R_BRACKET);} else {return R_BRACKET;}} +"{" {if(DEBUG) {printf( "L_BRACE: %s (%d)\n", yytext, L_BRACE);} else {return L_BRACE;}} +"}" {if(DEBUG) {printf( "R_BRACE: %s (%d)\n", yytext, R_BRACE);} else {return R_BRACE;}} + +"true" {if(DEBUG) {printf( "C_TRUE: %s (%d)\n", yytext, C_TRUE);} else {return C_TRUE;}} +"false" {if(DEBUG) {printf( "C_FALSE: %s (%d)\n", yytext, C_FALSE);} else {return C_FALSE;}} +"null" {if(DEBUG) {printf( "C_NULL: %s (%d)\n", yytext, C_NULL);} else {return C_NULL;}} + +{ID} {if(DEBUG) {printf( "ID: %s (%d)\n", yytext, ID);} else {yylval.words = strdup(yytext); return ID;}} + +\n {line_number++; column_number = 1;} +\t {column_number++;} +" " {column_number++;} +. {column_number++; return 1999;} + +%% diff --git a/src/runner.c b/src/runner.c index 2132f65..d6327ef 100644 --- a/src/runner.c +++ b/src/runner.c @@ -57,6 +57,22 @@ int check_flag(char *arg, char *alpha) { } } +void incr(int lnum,int cnum, int tok){ + //if (tok == COMMENT) { + for (int i = 0; i < yyleng; i++) { + if (yytext[i] == '\n') { + line_number++; + column_number = 0; + } + column_number++; + } +// }else{ +// column_number += yyleng; +// } +} +void print_tok(int tok){ +fprintf(tok_flag, "%d %d %3d \"%s\"\n", line_number, column_number,tok, yytext); +} int run(FILE *alpha) { int token; cur = CreateScope(NULL, 1, 1); @@ -71,11 +87,11 @@ int run(FILE *alpha) { // TOK FLAG if (tok_flag != NULL) { while (0 != (token = yylex())) { - if (tok_flag != NULL) { - fprintf(tok_flag, "%d %d %3d \"%s\"\n", line_number, column_number, - token, yytext); - } - if (token == COMMENT) { + //if (tok_flag != NULL) { + // fprintf(tok_flag, "%d %d %3d \"%s\"\n", line_number, column_number, + // token, yytext); + //} + /*if (token == COMMENT) { for (int i = 0; i < yyleng; i++) { if (yytext[i] == '\n') { line_number++; @@ -91,7 +107,7 @@ int run(FILE *alpha) { "character:%s\n", line_number, column_number, yytext); } - column_number += yyleng; + column_number += yyleng; */ } fclose(tok_flag); From 9eee3d94ba3458c0ef99003828d5d9a16907f354 Mon Sep 17 00:00:00 2001 From: Scarlett Date: Thu, 6 Mar 2025 21:31:55 -0500 Subject: [PATCH 096/105] cleanup (removed .saves) --- .gitignore | 3 +- src/grammar.y | 3 + src/grammar.y.save | 255 -------------------------------- src/lexicalStructure.lex.save | 91 ------------ src/lexicalStructure.lex.save.1 | 91 ------------ src/symbol_table.c | 3 + 6 files changed, 8 insertions(+), 438 deletions(-) delete mode 100644 src/grammar.y.save delete mode 100644 src/lexicalStructure.lex.save delete mode 100644 src/lexicalStructure.lex.save.1 diff --git a/.gitignore b/.gitignore index 8cf77d3..a6fca1a 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ grammar.tab.h .vscode out tmp -parser \ No newline at end of file +parser +*.save \ No newline at end of file diff --git a/src/grammar.y b/src/grammar.y index 3732fc1..350b568 100644 --- a/src/grammar.y +++ b/src/grammar.y @@ -1,3 +1,6 @@ +/* Syntax Analyzer with Bison (3.8.2) */ +/* The Translators - Spring 2025 */ + %{ #include #include "../src/symbol_table.c" diff --git a/src/grammar.y.save b/src/grammar.y.save deleted file mode 100644 index df5d589..0000000 --- a/src/grammar.y.save +++ /dev/null @@ -1,255 +0,0 @@ -%{ - #include - #include "../src/symbol_table.c" - extern int yylex(void); - void yyerror(const char *err); - extern char* yytext; - extern int yychar; - extern SymbolTable * cur; - //char* cur_value; - //char* cur_type; - int token_tracker; - extern int line_number; - extern int column_number; - extern FILE * yyin; -%} - -%union { - int integ; - char * words; -} - -//need subtraction only here -%type id_or_types -%type types -%token ID 101 -%token T_INTEGER 201 -%token T_ADDRESS 202 -%token T_BOOLEAN 203 -%token T_CHARACTER 204 -%token T_STRING 205 -%token C_INTEGER 301 -%token C_NULL 302 -%token C_CHARACTER 303 -%token C_STRING 304 -%token C_TRUE 305 -%token C_FALSE 306 -%token WHILE 401 -%token IF 402 -%token THEN 403 -%token ELSE 404 -%token TYPE 405 -%token FUNCTION 406 -%token RETURN 407 -%token EXTERNAL 408 -%token AS 409 -%token L_PAREN 501 -%token R_PAREN 502 -%token L_BRACKET 503 -%token R_BRACKET 504 -%token L_BRACE 505 -%token R_BRACE 506 -%token SEMI_COLON 507 -%token COLON 508 -%token COMMA 509 -%token ARROW 510 -%token MUL 603 -%token DIV 604 -%token REM 605 -%token ADD 601 -%token LESS_THAN 606 -%token EQUAL_TO 607 -%token AND 610 -%token OR 611 -%token ASSIGN 608 -%token SUB_OR_NEG 602 -%token NOT 609 -%token DOT 612 -%token RESERVE 613 -%token RELEASE 614 -%token COMMENT 700 - -//precedence order -%precedence RESERVE RELEASE -%precedence DOT -%precedence UMINUS -%precedence NOT -%left MUL DIV REM -%left ADD SUB_OR_NEG -%left LESS_THAN -%left EQUAL_TO -%left AND -%left OR -%left ASSIGN - -%% - -program: - prototype_or_definition_list - ; - -prototype_or_definition_list: - prototype prototype_or_definition_list - | definition prototype_or_definition_list - | prototype - | definition - ; - -prototype: - L_PAREN EXTERNAL R_PAREN FUNCTION ID COLON ID; - -definition: - TYPE ID COLON dblock - | TYPE ID COLON constant ARROW ID - | function_declaration - | TYPE ID COLON id_or_types ARROW id_or_types - | ID parameter ASSIGN sblock - ; - -function_declaration: - FUNCTION ID COLON ID - | EXTERNAL FUNCTION ID COLON ID - ; - -parameter: - L_PAREN ID R_PAREN - | AS L_PAREN idlist R_PAREN - ; - -idlist: - ID COMMA idlist - | ID - ; - -sblock: - L_BRACE {cur = CreateScope(cur,2,2);} statement_list {cur = getParent(cur);} R_BRACE - | L_BRACE {cur = CreateScope(cur,2,2);} dblock statement_list {cur = getParent(cur);} R_BRACE - ; - -dblock: - L_BRACKET declaration_list R_BRACKET; - -declaration_list: - declaration SEMI_COLON declaration_list - | declaration - ; - - -declaration: - id_or_types COLON ID {CreateEntry(cur,$1,$3); } - ; - -id_or_types: - ID - | types - ; - -statement_list: - compound_statement statement_list - | compound_statement - | simple_statement SEMI_COLON statement_list - | simple_statement SEMI_COLON - ; - -compound_statement: - WHILE L_PAREN expression R_PAREN sblock - | IF L_PAREN expression R_PAREN THEN sblock ELSE sblock - | sblock - ; - -simple_statement: - assignable ASSIGN expression - | RETURN expression - ; - -assignable: - ID - | assignable ablock - | assignable rec_op ID - ; - -rec_op : - DOT - -expression: - constant - | SUB_OR_NEG expression %prec UMINUS - | NOT expression - | expression ADD expression - | expression SUB_OR_NEG expression - | expression MUL expression - | expression DIV expression - | expression REM expression - | expression AND expression - | expression OR expression - | expression LESS_THAN expression - | expression EQUAL_TO expression - | assignable - | L_PAREN expression R_PAREN - | memOp assignable - ; - -ablock: - L_PAREN argument_list R_PAREN - ; - -argument_list: - expression COMMA argument_list - | expression - ; - - -memOp: - RESERVE - | RELEASE - ; - - -constant: - C_STRING - | C_INTEGER - | C_NULL - | C_CHARACTER - | C_TRUE - | C_FALSE - ; - -types: - T_STRING - | T_INTEGER - | T_ADDRESS - | T_CHARACTER - | T_BOOLEAN - ; - -%% - -void yyerror(const char *err) { - fprintf(stderr, "ERROR: %s at token %s at line number %d,column number %d\n", err,yytext,line_number,column_number); -} -/* -int main(int argc, char * argv[]) { - token_tracker = 1; - cur=CreateScope(NULL,1,1); - //int a; - FILE * fp; - if(argc > 1){ - fp = fopen(argv[1], "r"); - yyin = fp; - } else { - fp = stdin; - yyin = fp; - } - yyparse(); - //while ((a = yyparse() != EOF){ - // token_tracker++; - //printf("%d = a: yytext = %s: yychar = %d, token number: %d\n", a, yytext, yychar,token_tracker); - //if(yytext[0] == '\n'){ - FILE* f = fdopen(1,"w"); - print_symbol_table(getAncestor(cur),f); - fclose(f); - // break; - //} - //} - return 0; -} */ diff --git a/src/lexicalStructure.lex.save b/src/lexicalStructure.lex.save deleted file mode 100644 index c2ce8c9..0000000 --- a/src/lexicalStructure.lex.save +++ /dev/null @@ -1,91 +0,0 @@ -/* Lexical Analyzer with Flex (1.6.0) */ -/* The Translators - Spring 2025 */ - -%option noyywrap -%option header-file="flex.h" - -%{ - #include - #include "../tmp/grammar.tab.h" - #include "../src/symbol_table.h" - #ifndef DEBUG - #define DEBUG 0 - #endif - extern SymbolTable * cur; - extern int tok_flag; - extern void incr(int lnum,int cnum, int tok); - extern void print_tok(int tok); - - int line_number = 1, column_number = 1; -%} - -STARCOM [^\*]|\*+[^\)\*]+ -PARENCOM [^\)]|[^\*\)]+\)+ -COMMENT \(\*{STARCOM}*\*\)|\(\*{PARENCOM}*\*\) -ID [A-Za-z_][0-9A-Za-z_]* -DIGIT [0-9] -CHAR \\n|\\t|\\'|[^'\n\t\\]|\\\\ -SCHAR \\n|\\t|\\\"|[^\"\n\\] - -%% - -"integer" {if(DEBUG) {printf( "T_INTEGER: %s (%d)\n", yytext, T_INTEGER);} else {if(tok_flag != NULL){print_tok(T_INTEGER);}incr(line_number,column_number,T_INTEGER);return T_INTEGER;}} -"address" {if(DEBUG) {printf( "T_ADDRESS: %s (%d)\n", yytext, T_ADDRESS);} else {return T_ADDRESS;}} -"Boolean" {if(DEBUG) {printf( "T_BOOLEAN: %s (%d)\n", yytext, T_BOOLEAN);} else {return T_BOOLEAN;}} -"character" {if(DEBUG) {printf( "T_CHARACTER: %s (%d)\n", yytext, T_CHARACTER);} else {return T_CHARACTER;}} - -"while" {if(DEBUG) {printf( "WHILE: %s (%d)\n", yytext, WHILE);} else {return WHILE;}} -"if" {if(DEBUG) {printf( "IF: %s (%d)\n", yytext, IF);} else {return IF;}} -"then" {if(DEBUG) {printf( "THEN: %s (%d)\n", yytext, THEN);} else {return THEN;}} -"else" {if(DEBUG) {printf( "ELSE: %s (%d)\n", yytext, ELSE);} else {return ELSE;}} -"type" {if(DEBUG) {printf( "TYPE: %s (%d)\n", yytext, TYPE);} else {return TYPE;}} -"function" {if(DEBUG) {printf( "FUNCTION: %s (%d)\n", yytext, FUNCTION);} else {return FUNCTION;}} -"return" {if(DEBUG) {printf( "RETURN: %s (%d)\n", yytext, RETURN);} else {return RETURN;}} -"external" {if(DEBUG) {printf( "EXTERNAL: %s (%d)\n", yytext, EXTERNAL);} else {return EXTERNAL;}} -"as" {if(DEBUG) {printf( "AS: %s (%d)\n", yytext, AS);} else {return AS;}} - -"release" {if(DEBUG) {printf( "RELEASE: %s (%d)\n", yytext, RELEASE);} else {return RELEASE;}} -"reserve" {if(DEBUG) {printf( "RESERVE: %s (%d)\n", yytext, RESERVE);} else {return RESERVE;}} - -"+" {if(DEBUG) {printf( "ADD: %s (%d)\n", yytext, ADD);} else {return ADD;}} -"-" {if(DEBUG) {printf( "SUB_OR_NEG: %s (%d)\n", yytext, SUB_OR_NEG);} else {return SUB_OR_NEG;}} -"*" {if(DEBUG) {printf( "MUL: %s (%d)\n", yytext, MUL);} else {return MUL;}} -"/" {if(DEBUG) {printf( "DIV: %s (%d)\n", yytext, DIV);} else {return DIV;}} -"%" {if(DEBUG) {printf( "REM: %s (%d)\n", yytext, REM);} else {return REM;}} -"<" {if(DEBUG) {printf( "LESS_THAN: %s (%d)\n", yytext, LESS_THAN);} else {return LESS_THAN;}} -"=" {if(DEBUG) {printf( "EQUAL_TO: %s (%d)\n", yytext, EQUAL_TO);} else {return EQUAL_TO;}} -":=" {if(DEBUG) {printf( "ASSIGN: %s (%d)\n", yytext, ASSIGN);} else {return ASSIGN;}} -"!" {if(DEBUG) {printf( "NOT: %s (%d)\n", yytext, NOT);} else {return NOT;}} -"&" {if(DEBUG) {printf( "AND: %s (%d)\n", yytext, AND);} else {return AND;}} -"|" {if(DEBUG) {printf( "OR: %s (%d)\n", yytext, OR);} else {return OR;}} -"." {if(DEBUG) {printf( "DOT: %s (%d)\n", yytext, DOT);} else {return DOT;}} - -";" {if(DEBUG) {printf( "SEMI_COLON: %s (%d)\n", yytext, SEMI_COLON);} else {return SEMI_COLON;}} -":" {if(DEBUG) {printf( "COLON: %s (%d)\n", yytext, COLON);} else {return COLON;}} -"," {if(DEBUG) {printf( "COMMA: %s (%d)\n", yytext, COMMA);} else {return COMMA;}} -"->" {if(DEBUG) {printf( "ARROW: %s (%d)\n", yytext, ARROW);} else {return ARROW;}} - -{DIGIT}+ {if(DEBUG) {printf( "C_INTEGER: %s (%d)\n", yytext, C_INTEGER);} else {return C_INTEGER;}} -'{CHAR}' {if(DEBUG) {printf( "C_CHARACTER: %s (%d)\n", yytext, C_CHARACTER);} else {return C_CHARACTER;}} -\"{SCHAR}*\" {if(DEBUG) {printf( "C_STRING: %s (%d)\n", yytext, C_STRING);} else {return C_STRING;}} -{COMMENT} {if(DEBUG) {printf( "COMMENT: %s (%d)\n", yytext, COMMENT);} else {/*return COMMENT;*/}} - -"(" {if(DEBUG) {printf( "L_PAREN: %s (%d)\n", yytext, L_PAREN);} else {return L_PAREN;}} -")" {if(DEBUG) {printf( "R_PAREN: %s (%d)\n", yytext, R_PAREN);} else {return R_PAREN;}} -"[" {if(DEBUG) {printf( "L_BRACKET: %s (%d)\n", yytext, L_BRACKET);} else {return L_BRACKET;}} -"]" {if(DEBUG) {printf( "R_BRACKET: %s (%d)\n", yytext, R_BRACKET);} else {return R_BRACKET;}} -"{" {if(DEBUG) {printf( "L_BRACE: %s (%d)\n", yytext, L_BRACE);} else {return L_BRACE;}} -"}" {if(DEBUG) {printf( "R_BRACE: %s (%d)\n", yytext, R_BRACE);} else {return R_BRACE;}} - -"true" {if(DEBUG) {printf( "C_TRUE: %s (%d)\n", yytext, C_TRUE);} else {return C_TRUE;}} -"false" {if(DEBUG) {printf( "C_FALSE: %s (%d)\n", yytext, C_FALSE);} else {return C_FALSE;}} -"null" {if(DEBUG) {printf( "C_NULL: %s (%d)\n", yytext, C_NULL);} else {return C_NULL;}} - -{ID} {if(DEBUG) {printf( "ID: %s (%d)\n", yytext, ID);} else {yylval.words = strdup(yytext); return ID;}} - -\n {line_number++; column_number = 1;} -\t {column_number++;} -" " {column_number++;} -. {column_number++; return 1999;} - -%% diff --git a/src/lexicalStructure.lex.save.1 b/src/lexicalStructure.lex.save.1 deleted file mode 100644 index e0d5cc3..0000000 --- a/src/lexicalStructure.lex.save.1 +++ /dev/null @@ -1,91 +0,0 @@ -/* Lexical Analyzer with Flex (1.6.0) */ -/* The Translators - Spring 2025 */ - -%option noyywrap -%option header-file="flex.h" - -%{ - #include - #include "../tmp/grammar.tab.h" - #include "../src/symbol_table.h" - #ifndef DEBUG - #define DEBUG 0 - #endif - extern SymbolTable * cur; - extern int tok_flag; - extern void incr(int lnum,int cnum, int tok); - extern void print_tok(int tok); - - int line_number = 1, column_number = 1; -%} - -STARCOM [^\*]|\*+[^\)\*]+ -PARENCOM [^\)]|[^\*\)]+\)+ -COMMENT \(\*{STARCOM}*\*\)|\(\*{PARENCOM}*\*\) -ID [A-Za-z_][0-9A-Za-z_]* -DIGIT [0-9] -CHAR \\n|\\t|\\'|[^'\n\t\\]|\\\\ -SCHAR \\n|\\t|\\\"|[^\"\n\\] - -%% - -"integer" {if(DEBUG) {printf( "T_INTEGER: %s (%d)\n", yytext, T_INTEGER);} else {return T_INTEGER;}} -"address" {if(DEBUG) {printf( "T_ADDRESS: %s (%d)\n", yytext, T_ADDRESS);} else {return T_ADDRESS;}} -"Boolean" {if(DEBUG) {printf( "T_BOOLEAN: %s (%d)\n", yytext, T_BOOLEAN);} else {return T_BOOLEAN;}} -"character" {if(DEBUG) {printf( "T_CHARACTER: %s (%d)\n", yytext, T_CHARACTER);} else {return T_CHARACTER;}} - -"while" {if(DEBUG) {printf( "WHILE: %s (%d)\n", yytext, WHILE);} else {return WHILE;}} -"if" {if(DEBUG) {printf( "IF: %s (%d)\n", yytext, IF);} else {return IF;}} -"then" {if(DEBUG) {printf( "THEN: %s (%d)\n", yytext, THEN);} else {return THEN;}} -"else" {if(DEBUG) {printf( "ELSE: %s (%d)\n", yytext, ELSE);} else {return ELSE;}} -"type" {if(DEBUG) {printf( "TYPE: %s (%d)\n", yytext, TYPE);} else {return TYPE;}} -"function" {if(DEBUG) {printf( "FUNCTION: %s (%d)\n", yytext, FUNCTION);} else {return FUNCTION;}} -"return" {if(DEBUG) {printf( "RETURN: %s (%d)\n", yytext, RETURN);} else {return RETURN;}} -"external" {if(DEBUG) {printf( "EXTERNAL: %s (%d)\n", yytext, EXTERNAL);} else {return EXTERNAL;}} -"as" {if(DEBUG) {printf( "AS: %s (%d)\n", yytext, AS);} else {return AS;}} - -"release" {if(DEBUG) {printf( "RELEASE: %s (%d)\n", yytext, RELEASE);} else {return RELEASE;}} -"reserve" {if(DEBUG) {printf( "RESERVE: %s (%d)\n", yytext, RESERVE);} else {return RESERVE;}} - -"+" {if(DEBUG) {printf( "ADD: %s (%d)\n", yytext, ADD);} else {return ADD;}} -"-" {if(DEBUG) {printf( "SUB_OR_NEG: %s (%d)\n", yytext, SUB_OR_NEG);} else {return SUB_OR_NEG;}} -"*" {if(DEBUG) {printf( "MUL: %s (%d)\n", yytext, MUL);} else {return MUL;}} -"/" {if(DEBUG) {printf( "DIV: %s (%d)\n", yytext, DIV);} else {return DIV;}} -"%" {if(DEBUG) {printf( "REM: %s (%d)\n", yytext, REM);} else {return REM;}} -"<" {if(DEBUG) {printf( "LESS_THAN: %s (%d)\n", yytext, LESS_THAN);} else {return LESS_THAN;}} -"=" {if(DEBUG) {printf( "EQUAL_TO: %s (%d)\n", yytext, EQUAL_TO);} else {return EQUAL_TO;}} -":=" {if(DEBUG) {printf( "ASSIGN: %s (%d)\n", yytext, ASSIGN);} else {return ASSIGN;}} -"!" {if(DEBUG) {printf( "NOT: %s (%d)\n", yytext, NOT);} else {return NOT;}} -"&" {if(DEBUG) {printf( "AND: %s (%d)\n", yytext, AND);} else {return AND;}} -"|" {if(DEBUG) {printf( "OR: %s (%d)\n", yytext, OR);} else {return OR;}} -"." {if(DEBUG) {printf( "DOT: %s (%d)\n", yytext, DOT);} else {return DOT;}} - -";" {if(DEBUG) {printf( "SEMI_COLON: %s (%d)\n", yytext, SEMI_COLON);} else {return SEMI_COLON;}} -":" {if(DEBUG) {printf( "COLON: %s (%d)\n", yytext, COLON);} else {return COLON;}} -"," {if(DEBUG) {printf( "COMMA: %s (%d)\n", yytext, COMMA);} else {return COMMA;}} -"->" {if(DEBUG) {printf( "ARROW: %s (%d)\n", yytext, ARROW);} else {return ARROW;}} - -{DIGIT}+ {if(DEBUG) {printf( "C_INTEGER: %s (%d)\n", yytext, C_INTEGER);} else {return C_INTEGER;}} -'{CHAR}' {if(DEBUG) {printf( "C_CHARACTER: %s (%d)\n", yytext, C_CHARACTER);} else {return C_CHARACTER;}} -\"{SCHAR}*\" {if(DEBUG) {printf( "C_STRING: %s (%d)\n", yytext, C_STRING);} else {return C_STRING;}} -{COMMENT} {if(DEBUG) {printf( "COMMENT: %s (%d)\n", yytext, COMMENT);} else {/*return COMMENT;*/}} - -"(" {if(DEBUG) {printf( "L_PAREN: %s (%d)\n", yytext, L_PAREN);} else {return L_PAREN;}} -")" {if(DEBUG) {printf( "R_PAREN: %s (%d)\n", yytext, R_PAREN);} else {return R_PAREN;}} -"[" {if(DEBUG) {printf( "L_BRACKET: %s (%d)\n", yytext, L_BRACKET);} else {return L_BRACKET;}} -"]" {if(DEBUG) {printf( "R_BRACKET: %s (%d)\n", yytext, R_BRACKET);} else {return R_BRACKET;}} -"{" {if(DEBUG) {printf( "L_BRACE: %s (%d)\n", yytext, L_BRACE);} else {return L_BRACE;}} -"}" {if(DEBUG) {printf( "R_BRACE: %s (%d)\n", yytext, R_BRACE);} else {return R_BRACE;}} - -"true" {if(DEBUG) {printf( "C_TRUE: %s (%d)\n", yytext, C_TRUE);} else {return C_TRUE;}} -"false" {if(DEBUG) {printf( "C_FALSE: %s (%d)\n", yytext, C_FALSE);} else {return C_FALSE;}} -"null" {if(DEBUG) {printf( "C_NULL: %s (%d)\n", yytext, C_NULL);} else {return C_NULL;}} - -{ID} {if(DEBUG) {printf( "ID: %s (%d)\n", yytext, ID);} else {yylval.words = strdup(yytext); return ID;}} - -\n {line_number++; column_number = 1;} -\t {column_number++;} -" " {column_number++;} -. {column_number++; return 1999;} - -%% diff --git a/src/symbol_table.c b/src/symbol_table.c index 48a7a42..47d731b 100644 --- a/src/symbol_table.c +++ b/src/symbol_table.c @@ -1,3 +1,6 @@ +/* Symbol Table */ +/* The Translators - Spring 2025 */ + #include "symbol_table.h" #include From e32b8758b5950222e94319a4d26e1818c8f37096 Mon Sep 17 00:00:00 2001 From: Meyer Simon Date: Thu, 6 Mar 2025 21:39:51 -0500 Subject: [PATCH 097/105] edited the test file llnode t#36 --- tests/sprint2/test/sp2_llnode.alpha | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/sprint2/test/sp2_llnode.alpha b/tests/sprint2/test/sp2_llnode.alpha index 880ca0b..6b4912e 100644 --- a/tests/sprint2/test/sp2_llnode.alpha +++ b/tests/sprint2/test/sp2_llnode.alpha @@ -2,7 +2,7 @@ type rec: [integer: x; integer: y] type T1: integer -> integer type T2: rec -> integer -type llnode: [address: prev; integer: val; address: next] +type llnode: [llnode: prev; integer: val; llnode: next] type list: integer -> llnode function foo : T1 From 06764ad9b3bb621b9a36e11b3cfbe0f1ed266bd2 Mon Sep 17 00:00:00 2001 From: Meyer Simon Date: Fri, 7 Mar 2025 12:36:06 -0500 Subject: [PATCH 098/105] Prec not working --- src/grammar.y | 28 ++++++++++++------------- tests/sprint2/test/sp2_presidence.alpha | 4 ++++ 2 files changed, 18 insertions(+), 14 deletions(-) create mode 100644 tests/sprint2/test/sp2_presidence.alpha diff --git a/src/grammar.y b/src/grammar.y index 350b568..0fc6eb0 100644 --- a/src/grammar.y +++ b/src/grammar.y @@ -177,20 +177,20 @@ rec_op : expression: constant - | SUB_OR_NEG expression %prec UMINUS - | NOT expression - | expression ADD expression - | expression SUB_OR_NEG expression - | expression MUL expression - | expression DIV expression - | expression REM expression - | expression AND expression - | expression OR expression - | expression LESS_THAN expression - | expression EQUAL_TO expression - | assignable - | L_PAREN expression R_PAREN - | memOp assignable + | SUB_OR_NEG expression %prec UMINUS{printf("==\n");} + | NOT expression{printf("==\n");} + | expression ADD expression %prec ADD {printf("doing addition\n");} + | expression SUB_OR_NEG expression %prec SUB_OR_NEG{printf("subtraction\n");} + | expression MUL expression %prec MUL {printf("multiplication\n");} + | expression DIV expression %prec DIV{printf("division\n");} + | expression REM expression %prec REM {printf("remainder\n");} + | expression AND expression %prec AND {printf("and\n");} + | expression OR expression %prec OR {printf("or\n");} + | expression LESS_THAN expression %prec LESS_THAN {printf("less than\n");} + | expression EQUAL_TO expression %prec EQUAL_TO{printf("==\n");} + | assignable {printf("==\n");} + | L_PAREN expression R_PAREN {printf("==\n");} + | memOp assignable{printf("==\n");} ; ablock: diff --git a/tests/sprint2/test/sp2_presidence.alpha b/tests/sprint2/test/sp2_presidence.alpha new file mode 100644 index 0000000..9b2ef86 --- /dev/null +++ b/tests/sprint2/test/sp2_presidence.alpha @@ -0,0 +1,4 @@ +entry(arg) := { + [integer:x] + x := 3 + 2 * 8; +} From 6dcad0752073e30f75bfaa787b66b1b71b49d52f Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Fri, 7 Mar 2025 13:36:07 -0500 Subject: [PATCH 099/105] fixed precedence tests --- src/grammar.y | 67 ++++++++++--------- src/lexicalStructure.lex | 2 +- .../sprint2/test/sp2_integer_binary_op.alpha | 15 +++++ 3 files changed, 52 insertions(+), 32 deletions(-) create mode 100644 tests/sprint2/test/sp2_integer_binary_op.alpha diff --git a/src/grammar.y b/src/grammar.y index 3732fc1..f4a8b1b 100644 --- a/src/grammar.y +++ b/src/grammar.y @@ -1,6 +1,7 @@ %{ #include #include "../src/symbol_table.c" + #include extern int yylex(void); void yyerror(const char *err); extern char* yytext; @@ -21,16 +22,18 @@ char * words; } -//need subtraction only here + %type id_or_types %type types +%type expression +%type constant %token ID 101 %token T_INTEGER 201 %token T_ADDRESS 202 %token T_BOOLEAN 203 %token T_CHARACTER 204 %token T_STRING 205 -%token C_INTEGER 301 +%token C_INTEGER 301 %token C_NULL 302 %token C_CHARACTER 303 %token C_STRING 304 @@ -72,17 +75,19 @@ %token COMMENT 700 //precedence order -%precedence RESERVE RELEASE -%precedence DOT -%precedence UMINUS -%precedence NOT -%left MUL DIV REM -%left ADD SUB_OR_NEG -%left LESS_THAN -%left EQUAL_TO -%left AND -%left OR %left ASSIGN +%left OR +%left AND +%left EQUAL_TO +%left LESS_THAN +%left ADD SUB_OR_NEG +%left MUL DIV REM +%precedence NOT +%precedence UMINUS +%precedence DOT +%precedence RESERVE RELEASE + + %% @@ -125,7 +130,7 @@ idlist: sblock: L_BRACE {cur = CreateScope(cur,@1.first_line,@1.first_column);} statement_list {cur = getParent(cur);} R_BRACE - | L_BRACE {cur = CreateScope(cur,@1.first_line,@1.first_column);} dblock statement_list {cur = getParent(cur);} R_BRACE + | L_BRACE {cur = CreateScope(cur,@1.first_line,@1.first_column);} dblock {printf("seen sblock with dblock\n");} statement_list {cur = getParent(cur);} R_BRACE ; dblock: @@ -155,7 +160,7 @@ statement_list: compound_statement: WHILE L_PAREN expression R_PAREN sblock | IF L_PAREN expression R_PAREN THEN sblock ELSE sblock - | sblock + | sblock //{printf("seen a compound statement rule\n");} ; simple_statement: @@ -173,21 +178,21 @@ rec_op : DOT expression: - constant - | SUB_OR_NEG expression %prec UMINUS - | NOT expression - | expression ADD expression - | expression SUB_OR_NEG expression - | expression MUL expression - | expression DIV expression - | expression REM expression - | expression AND expression - | expression OR expression - | expression LESS_THAN expression - | expression EQUAL_TO expression - | assignable - | L_PAREN expression R_PAREN - | memOp assignable + constant {printf("constant expression\n");} + | SUB_OR_NEG expression %prec UMINUS {printf("negative expression\n");} + | NOT expression {printf("not expression\n");} + | expression ADD expression {printf("add expression\n");} + | expression SUB_OR_NEG expression {printf("subtract expression\n");} + | expression MUL expression {printf("multiply expression\n");} + | expression DIV expression {printf("division expression\n");} + | expression REM expression {printf("remainder expression\n");} + | expression AND expression {printf("and expression\n");} + | expression OR expression {printf("or expression\n");} + | expression LESS_THAN expression {printf("less than expression\n");} + | expression EQUAL_TO expression {printf("equals check expression\n");} + | assignable {printf("assignable expression\n");} + | L_PAREN expression R_PAREN {printf("paren expression\n");} + | memOp assignable ; ablock: @@ -201,8 +206,8 @@ argument_list: memOp: - RESERVE - | RELEASE + RESERVE {printf("reserve expression\n");} + | RELEASE {printf("release expression\n");} ; diff --git a/src/lexicalStructure.lex b/src/lexicalStructure.lex index aae5433..0c53b6f 100644 --- a/src/lexicalStructure.lex +++ b/src/lexicalStructure.lex @@ -72,7 +72,7 @@ SCHAR \\n|\\t|\\\"|[^\"\n\\] "," {if(DEBUG) {printf( "COMMA: %s (%d)\n", yytext, COMMA);} else {if(tok_flag != NULL){print_tok(COMMA);}incr(line_number,column_number,COMMA);return COMMA;}} "->" {if(DEBUG) {printf( "ARROW: %s (%d)\n", yytext, ARROW);} else {if(tok_flag != NULL){print_tok(ARROW);}incr(line_number,column_number,ARROW);return ARROW;}} -{DIGIT}+ {if(DEBUG) {printf( "C_INTEGER: %s (%d)\n", yytext, C_INTEGER);} else {if(tok_flag != NULL){print_tok(C_INTEGER);}incr(line_number,column_number,C_INTEGER);return C_INTEGER;}} +{DIGIT}+ {if(DEBUG) {printf( "C_INTEGER: %s (%d)\n", yytext, C_INTEGER);} else {if(tok_flag != NULL){print_tok(C_INTEGER);}incr(line_number,column_number,C_INTEGER);yylval.integ = atoi(yytext);return C_INTEGER;}} '{CHAR}' {if(DEBUG) {printf( "C_CHARACTER: %s (%d)\n", yytext, C_CHARACTER);} else {if(tok_flag != NULL){print_tok(C_CHARACTER);}incr(line_number,column_number,C_CHARACTER);return C_CHARACTER;}} \"{SCHAR}*\" {if(DEBUG) {printf( "C_STRING: %s (%d)\n", yytext, C_STRING);} else {if(tok_flag != NULL){print_tok(C_STRING);}incr(line_number,column_number,C_STRING);return C_STRING;}} {COMMENT} {if(DEBUG) {printf( "COMMENT: %s (%d)\n", yytext, COMMENT);} else {if(tok_flag != NULL){print_tok(COMMENT);}incr(line_number,column_number,COMMENT);/*return COMMENT;*/}} diff --git a/tests/sprint2/test/sp2_integer_binary_op.alpha b/tests/sprint2/test/sp2_integer_binary_op.alpha new file mode 100644 index 0000000..39e00a6 --- /dev/null +++ b/tests/sprint2/test/sp2_integer_binary_op.alpha @@ -0,0 +1,15 @@ +entry(arg) := { + [integer:x; address: arr; address: arr2; Boolean : b2; Boolean : b1] + x := 3 + 2 * 8; + x := 3 - 2 / 8; + x := 3 * 2 % 8; + x := 3 * 2 % 8; + x := 3 % 2 * 8; + x := 3 + 2 - 8; + arr2 := 1 * reserve x; + arr2 := release x; + b2 := 3 < 2; + b1 := 1 = 2; + b2 := !(3 < 2); + b1 := 6<7 & 7=7; +} From d1c36566c70539ed0ea72875bdd8efab98a1fb4f Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Fri, 7 Mar 2025 15:22:10 -0500 Subject: [PATCH 100/105] still working on resolving type name issue --- src/grammar.y | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/src/grammar.y b/src/grammar.y index 8ea0317..4c5e4e6 100644 --- a/src/grammar.y +++ b/src/grammar.y @@ -28,8 +28,6 @@ %type id_or_types %type types -%type expression -%type constant %token ID 101 %token T_INTEGER 201 %token T_ADDRESS 202 @@ -37,11 +35,11 @@ %token T_CHARACTER 204 %token T_STRING 205 %token C_INTEGER 301 -%token C_NULL 302 -%token C_CHARACTER 303 -%token C_STRING 304 -%token C_TRUE 305 -%token C_FALSE 306 +%token C_NULL 302 +%token C_CHARACTER 303 +%token C_STRING 304 +%token C_TRUE 305 +%token C_FALSE 306 %token WHILE 401 %token IF 402 %token THEN 403 @@ -109,17 +107,17 @@ prototype: L_PAREN EXTERNAL R_PAREN FUNCTION ID COLON ID; definition: - TYPE ID COLON dblock + TYPE ID COLON dblock | TYPE ID COLON constant ARROW ID - | function_declaration + //| function_declaration | TYPE ID COLON id_or_types ARROW id_or_types | ID parameter ASSIGN sblock ; -function_declaration: - FUNCTION ID COLON ID - | EXTERNAL FUNCTION ID COLON ID - ; +//function_declaration: + // FUNCTION ID COLON ID + //| EXTERNAL FUNCTION ID COLON ID + //; parameter: L_PAREN ID R_PAREN @@ -145,12 +143,12 @@ declaration_list: ; declaration: - id_or_types COLON ID {CreateEntry(cur,$1,$3); } + id_or_types COLON ID {CreateEntry(cur,$1,$3); } ; id_or_types: - ID - | types + ID {printf("string of id in id_or_type is %s\n",$1);} {$$ = $1;} + | types {printf("string of type in id_or_type is %s\n",$1);} {$$ = $1;} ; statement_list: @@ -226,11 +224,11 @@ constant: ; types: - T_STRING - | T_INTEGER - | T_ADDRESS - | T_CHARACTER - | T_BOOLEAN + T_STRING {printf("string of T_STRING in types is %s\n",$1);} {$$ = $1;} + | T_INTEGER {printf("string of T_INTEGER in types is %s\n",$1);} {$$ = $1;} + | T_ADDRESS {printf("string of T_ADDRESS in types is %s\n",$1);} {$$ = $1;} + | T_CHARACTER {printf("string of T_CHARACTER in types is %s\n",$1);} {$$ = $1;} + | T_BOOLEAN {printf("string of T_BOOLEAN in types is %s\n",$1);} {$$ = $1;} ; %% From 3a22ecbcdc2a7bc6eb1af706b7088ce35958b40a Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Fri, 7 Mar 2025 15:50:15 -0500 Subject: [PATCH 101/105] fixed declaration name --- Grammar-FE-t-NoTask | 35 +++++++++++++++++++++++++++++++++++ src/lexicalStructure.lex | 14 +++++++------- 2 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 Grammar-FE-t-NoTask diff --git a/Grammar-FE-t-NoTask b/Grammar-FE-t-NoTask new file mode 100644 index 0000000..1ad478e --- /dev/null +++ b/Grammar-FE-t-NoTask @@ -0,0 +1,35 @@ +* Dev + Sprint1-TokenLocationLogic-NoTask + Sprint1-TokenizeConstantsAndLiterals-FE-t#03 + Sprint2-BlockHandlingGrammar-FE-t#34 + Sprint2-CombineGrammarAndMakeAndRunner-BE-NoTask# + Sprint2-NewFormatPlusGrammar-FE-t#NoTask + Sprint2-PrintOutErrorTokenPositions-NoTask + Sprint2-Symbol_Table_Setup-FE-t#32 + Token_Error_Logic-No_Task + main + remotes/origin/Dev + remotes/origin/HEAD -> origin/main + remotes/origin/Sprint1-BasicProgSetup-FE-t#06 + remotes/origin/Sprint1-BasicProgSetupFix-t#06 + remotes/origin/Sprint1-HelpInput-FE-t#18 + remotes/origin/Sprint1-TokenLocationLogic-NoTask + remotes/origin/Sprint1-TokenizeConstantsAndLiterals-FE-t#03 + remotes/origin/Sprint1-TokenizeID_MainFunction-FE-t#04 + remotes/origin/Sprint1-TokenizeOperators-FE-t#08 + remotes/origin/Sprint1-Type/Keywards-FE-t#07 + remotes/origin/Sprint1-punctuation/grouping-FE-t#09 + remotes/origin/Sprint2-AssignableAndMemory-FE-t#39 + remotes/origin/Sprint2-BlockHandlingGrammar-FE-t#34 + remotes/origin/Sprint2-CombineGrammarAndMakeAndRunner-BE-NoTask# + remotes/origin/Sprint2-CommandLineHandling-FE-t#33 + remotes/origin/Sprint2-CompoundStmntGrmmr-FE-t#36 + remotes/origin/Sprint2-FunctionDefinition-FE-t#38 + remotes/origin/Sprint2-Infrastructure-FE-t#30 + remotes/origin/Sprint2-NewFormatPlusGrammar-FE-t#NoTask + remotes/origin/Sprint2-PrintOutErrorTokenPositions-NoTask + remotes/origin/Sprint2-SymbolTableOperations-FE-t#29 + remotes/origin/Sprint2-Symbol_Table_Setup-FE-t#32 + remotes/origin/Sprint2-addingTests-t#00 + remotes/origin/Token_Error_Logic-No_Task + remotes/origin/main diff --git a/src/lexicalStructure.lex b/src/lexicalStructure.lex index 0c53b6f..eac2840 100644 --- a/src/lexicalStructure.lex +++ b/src/lexicalStructure.lex @@ -36,10 +36,10 @@ SCHAR \\n|\\t|\\\"|[^\"\n\\] %% -"integer" {if(DEBUG) {printf( "T_INTEGER: %s (%d)\n", yytext, T_INTEGER);} else {if(tok_flag != NULL){print_tok(T_INTEGER);}incr(line_number,column_number,T_INTEGER);return T_INTEGER;}} -"address" {if(DEBUG) {printf( "T_ADDRESS: %s (%d)\n", yytext, T_ADDRESS);} else {if(tok_flag != NULL){print_tok(T_ADDRESS);}incr(line_number,column_number,T_ADDRESS);return T_ADDRESS;}} -"Boolean" {if(DEBUG) {printf( "T_BOOLEAN: %s (%d)\n", yytext, T_BOOLEAN);} else {if(tok_flag != NULL){print_tok(T_INTEGER);}incr(line_number,column_number,T_INTEGER);return T_BOOLEAN;}} -"character" {if(DEBUG) {printf( "T_CHARACTER: %s (%d)\n", yytext, T_CHARACTER);} else {if(tok_flag != NULL){print_tok(T_CHARACTER);}incr(line_number,column_number,T_CHARACTER);return T_CHARACTER;}} +"integer" {if(DEBUG) {printf( "T_INTEGER: %s (%d)\n", yytext, T_INTEGER);} else {if(tok_flag != NULL){print_tok(T_INTEGER);}incr(line_number,column_number,T_INTEGER);yylval.words = strdup(yytext);return T_INTEGER;}} +"address" {if(DEBUG) {printf( "T_ADDRESS: %s (%d)\n", yytext, T_ADDRESS);} else {if(tok_flag != NULL){print_tok(T_ADDRESS);}incr(line_number,column_number,T_ADDRESS);yylval.words = strdup(yytext);return T_ADDRESS;}} +"Boolean" {if(DEBUG) {printf( "T_BOOLEAN: %s (%d)\n", yytext, T_BOOLEAN);} else {if(tok_flag != NULL){print_tok(T_INTEGER);}incr(line_number,column_number,T_INTEGER);yylval.words = strdup(yytext);return T_BOOLEAN;}} +"character" {if(DEBUG) {printf( "T_CHARACTER: %s (%d)\n", yytext, T_CHARACTER);} else {if(tok_flag != NULL){print_tok(T_CHARACTER);}incr(line_number,column_number,T_CHARACTER);yylval.words = strdup(yytext);return T_CHARACTER;}} "while" {if(DEBUG) {printf( "WHILE: %s (%d)\n", yytext, WHILE);} else {if(tok_flag != NULL){print_tok(WHILE);}incr(line_number,column_number,WHILE);return WHILE;}} "if" {if(DEBUG) {printf( "IF: %s (%d)\n", yytext, IF);} else {if(tok_flag != NULL){print_tok(IF);}incr(line_number,column_number,IF);return IF;}} @@ -84,9 +84,9 @@ SCHAR \\n|\\t|\\\"|[^\"\n\\] "{" {if(DEBUG) {printf( "L_BRACE: %s (%d)\n", yytext, L_BRACE);} else {if(tok_flag != NULL){print_tok(L_BRACE);}incr(line_number,column_number,L_BRACE);return L_BRACE;}} "}" {if(DEBUG) {printf( "R_BRACE: %s (%d)\n", yytext, R_BRACE);} else {if(tok_flag != NULL){print_tok(R_BRACE);}incr(line_number,column_number,R_BRACE);return R_BRACE;}} -"true" {if(DEBUG) {printf( "C_TRUE: %s (%d)\n", yytext, C_TRUE);} else {if(tok_flag != NULL){print_tok(C_TRUE);}incr(line_number,column_number,C_TRUE);return C_TRUE;}} -"false" {if(DEBUG) {printf( "C_FALSE: %s (%d)\n", yytext, C_FALSE);} else {if(tok_flag != NULL){print_tok(C_FALSE);}incr(line_number,column_number,C_FALSE);return C_FALSE;}} -"null" {if(DEBUG) {printf( "C_NULL: %s (%d)\n", yytext, C_NULL);} else {if(tok_flag != NULL){print_tok(C_NULL);}incr(line_number,column_number,C_NULL);return C_NULL;}} +"true" {if(DEBUG) {printf( "C_TRUE: %s (%d)\n", yytext, C_TRUE);} else {if(tok_flag != NULL){print_tok(C_TRUE);}incr(line_number,column_number,C_TRUE);yylval.words = strdup(yytext);return C_TRUE;}} +"false" {if(DEBUG) {printf( "C_FALSE: %s (%d)\n", yytext, C_FALSE);} else {if(tok_flag != NULL){print_tok(C_FALSE);}incr(line_number,column_number,C_FALSE);yylval.words = strdup(yytext);return C_FALSE;}} +"null" {if(DEBUG) {printf( "C_NULL: %s (%d)\n", yytext, C_NULL);} else {if(tok_flag != NULL){print_tok(C_NULL);}incr(line_number,column_number,C_NULL);yylval.words = strdup(yytext);return C_NULL;}} {ID} {if(DEBUG) {printf( "ID: %s (%d)\n", yytext, ID);} else {if(tok_flag != NULL){print_tok(ID);}incr(line_number,column_number,ID);yylval.words = strdup(yytext); return ID;}} From abd24760e09060ae99bbbe1e6545c10a072de746 Mon Sep 17 00:00:00 2001 From: Meyer Simon Date: Fri, 7 Mar 2025 16:05:52 -0500 Subject: [PATCH 102/105] Fixed and error in grammar.y t#36 --- src/grammar.y | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/grammar.y b/src/grammar.y index 4c5e4e6..3e9bc44 100644 --- a/src/grammar.y +++ b/src/grammar.y @@ -107,17 +107,17 @@ prototype: L_PAREN EXTERNAL R_PAREN FUNCTION ID COLON ID; definition: - TYPE ID COLON dblock + TYPE ID COLON dblock | TYPE ID COLON constant ARROW ID - //| function_declaration + | function_declaration | TYPE ID COLON id_or_types ARROW id_or_types | ID parameter ASSIGN sblock ; -//function_declaration: - // FUNCTION ID COLON ID - //| EXTERNAL FUNCTION ID COLON ID - //; +function_declaration: + FUNCTION ID COLON ID + | EXTERNAL FUNCTION ID COLON ID + ; parameter: L_PAREN ID R_PAREN @@ -194,9 +194,9 @@ expression: | expression EQUAL_TO expression {printf("equals check expression\n");} | assignable {printf("assignable expression\n");} | L_PAREN expression R_PAREN {printf("paren expression\n");} - | memOp assignable + | memOp assignable ; - + ablock: L_PAREN argument_list R_PAREN From 072182dbbc9c229742925615742637e38e1420cd Mon Sep 17 00:00:00 2001 From: Meyer Simon Date: Sat, 8 Mar 2025 14:08:14 -0500 Subject: [PATCH 103/105] Fixed spacing in the files t#NONE --- src/symbol_table.c | 212 ++++++++++++++++++++++----------------------- src/symbol_table.h | 24 ++--- 2 files changed, 118 insertions(+), 118 deletions(-) diff --git a/src/symbol_table.c b/src/symbol_table.c index 47d731b..ebd06ee 100644 --- a/src/symbol_table.c +++ b/src/symbol_table.c @@ -8,115 +8,115 @@ #include SymbolTable* CreateScope(SymbolTable* ParentScope, int Line, int Column) { - SymbolTable* table = (SymbolTable*)malloc(sizeof(SymbolTable)); - table->Line_Number = Line; - table->Column_Number = Column; - table->Parent_Scope = ParentScope; - table->Children_Scope = NULL; - table->entries = NULL; - if (ParentScope != NULL) { - if (ParentScope->Children_Scope == NULL) { - ListOfTable* newEntry = (ListOfTable*)malloc(sizeof(ListOfTable)); - newEntry->next = NULL; - // newEntry->prev = NULL; - newEntry->table = table; - ParentScope->Children_Scope = newEntry; - } else { - ListOfTable* newEntry = (ListOfTable*)malloc(sizeof(ListOfTable)); - // newEntry->prev = NULL; - newEntry->table = table; - ListOfTable* oldEntry = ParentScope->Children_Scope; - ParentScope->Children_Scope = newEntry; - newEntry->next = oldEntry; - } - } - return table; + SymbolTable* table = (SymbolTable*)malloc(sizeof(SymbolTable)); + table->Line_Number = Line; + table->Column_Number = Column; + table->Parent_Scope = ParentScope; + table->Children_Scope = NULL; + table->entries = NULL; + if (ParentScope != NULL) { + if (ParentScope->Children_Scope == NULL) { + ListOfTable* newEntry = (ListOfTable*)malloc(sizeof(ListOfTable)); + newEntry->next = NULL; + // newEntry->prev = NULL; + newEntry->table = table; + ParentScope->Children_Scope = newEntry; + } else { + ListOfTable* newEntry = (ListOfTable*)malloc(sizeof(ListOfTable)); + // newEntry->prev = NULL; + newEntry->table = table; + ListOfTable* oldEntry = ParentScope->Children_Scope; + ParentScope->Children_Scope = newEntry; + newEntry->next = oldEntry; + } + } + return table; } TableNode* CreateEntry(SymbolTable* table, char* typeOf, char* id) { - TableNode* newEntry = (TableNode*)malloc(sizeof(TableNode)); - newEntry->theType = typeOf; - newEntry->theName = id; - if (table->entries == NULL) { - table->entries = newEntry; - return newEntry; - } else { - TableNode* oldEntry = table->entries; - table->entries = newEntry; - newEntry->next = oldEntry; - return newEntry; - } + TableNode* newEntry = (TableNode*)malloc(sizeof(TableNode)); + newEntry->theType = typeOf; + newEntry->theName = id; + if (table->entries == NULL) { + table->entries = newEntry; + return newEntry; + } else { + TableNode* oldEntry = table->entries; + table->entries = newEntry; + newEntry->next = oldEntry; + return newEntry; + } } TableNode* table_lookup(SymbolTable* table, char* x) { - TableNode* entrie = table->entries; - for (; entrie != NULL; entrie = entrie->next) { - if (!strcmp(entrie->theName, x)) { - return entrie; - } - } - return NULL; + TableNode* entrie = table->entries; + for (; entrie != NULL; entrie = entrie->next) { + if (!strcmp(entrie->theName, x)) { + return entrie; + } + } + return NULL; } TableNode* look_up(SymbolTable* table, char* x) { - if (table == NULL) { - return NULL; - } - TableNode* ret = table_lookup(table, x); - if (ret != NULL) { - return ret; - } - return look_up(table->Parent_Scope, x); + if (table == NULL) { + return NULL; + } + TableNode* ret = table_lookup(table, x); + if (ret != NULL) { + return ret; + } + return look_up(table->Parent_Scope, x); } void print_symbol_table(SymbolTable* table, FILE* file_ptr) { - if (table->Parent_Scope == NULL) { - fprintf(file_ptr, "%-17s: %-6s : %-6s : %-21s: %-28s\n", "NAME", "SCOPE", - "PARENT", "TYPE", "Extra annotation"); - } - TableNode* entrie = table->entries; - fprintf(file_ptr, - "-----------------:--------:--------:----------------------:---------" - "--------------------\n"); - int parant_scope = 0; - int current_scope = 0; - if (table->Parent_Scope != NULL) { - parant_scope = table->Parent_Scope->Line_Number * 1000 + - table->Parent_Scope->Column_Number; - current_scope = table->Line_Number * 1000 + table->Column_Number; - } else { - current_scope = 1001; - } + if (table->Parent_Scope == NULL) { + fprintf(file_ptr, "%-17s: %-6s : %-6s : %-21s: %-28s\n", "NAME", "SCOPE", + "PARENT", "TYPE", "Extra annotation"); + } + TableNode* entrie = table->entries; + fprintf(file_ptr, + "-----------------:--------:--------:----------------------:---------" + "--------------------\n"); + int parant_scope = 0; + int current_scope = 0; + if (table->Parent_Scope != NULL) { + parant_scope = table->Parent_Scope->Line_Number * 1000 + + table->Parent_Scope->Column_Number; + current_scope = table->Line_Number * 1000 + table->Column_Number; + } else { + current_scope = 1001; + } - for (; entrie != NULL; entrie = entrie->next) { - if (parant_scope == 0) { - fprintf(file_ptr, "%-17s: %06d : : %-21s: %-28s\n", - entrie->theName, current_scope, entrie->theType, - "Extra annotation"); - } else { - fprintf(file_ptr, "%-17s: %06d : %06d : %-21s: %-28s\n", entrie->theName, - current_scope, parant_scope, entrie->theType, "Extra annotation"); - } - } - if (table->Children_Scope != NULL) { - ListOfTable* node = table->Children_Scope; - for (; node != NULL; node = node->next) { - print_symbol_table(node->table, file_ptr); - } - } - if (table->Parent_Scope == NULL) { - fprintf(file_ptr, - "-----------------:--------:--------:----------------------:-------" - "----------------------\n"); - } + for (; entrie != NULL; entrie = entrie->next) { + if (parant_scope == 0) { + fprintf(file_ptr, "%-17s: %06d : : %-21s: %-28s\n", + entrie->theName, current_scope, entrie->theType, + "Extra annotation"); + } else { + fprintf(file_ptr, "%-17s: %06d : %06d : %-21s: %-28s\n", entrie->theName, + current_scope, parant_scope, entrie->theType, "Extra annotation"); + } + } + if (table->Children_Scope != NULL) { + ListOfTable* node = table->Children_Scope; + for (; node != NULL; node = node->next) { + print_symbol_table(node->table, file_ptr); + } + } + if (table->Parent_Scope == NULL) { + fprintf(file_ptr, + "-----------------:--------:--------:----------------------:-------" + "----------------------\n"); + } } SymbolTable* getAncestor(SymbolTable* table) { - if (table->Parent_Scope == NULL) { - // if table has no parent, return itself - return table; - } else { - // call function recursively to grab ancestor - return getAncestor(table->Parent_Scope); - } + if (table->Parent_Scope == NULL) { + // if table has no parent, return itself + return table; + } else { + // call function recursively to grab ancestor + return getAncestor(table->Parent_Scope); + } } SymbolTable* getParent(SymbolTable* st) { return st->Parent_Scope; } @@ -134,15 +134,15 @@ int getColumn(SymbolTable* st) { return st->Column_Number; } // standalone test of table and entry creation /* -int main(){ - char* String = "STRING"; - char* X = "X"; - SymbolTable* Second = CreateScope(NULL, 2,2); - printf("Line number is %d, Column number of scope is -%d\n",Second->Line_Number,Second->Column_Number); TableNode* First_Entry = -CreateEntry(Second,String,X); + int main(){ + char* String = "STRING"; + char* X = "X"; + SymbolTable* Second = CreateScope(NULL, 2,2); + printf("Line number is %d, Column number of scope is + %d\n",Second->Line_Number,Second->Column_Number); TableNode* First_Entry = + CreateEntry(Second,String,X); - printf("The type of the first entry is %s\n",First_Entry->theType); - return 0; - } - */ + printf("The type of the first entry is %s\n",First_Entry->theType); + return 0; + } + */ diff --git a/src/symbol_table.h b/src/symbol_table.h index 0ef5c8a..1e1b7da 100644 --- a/src/symbol_table.h +++ b/src/symbol_table.h @@ -4,24 +4,24 @@ #include typedef struct ListOfTable { - struct SymbolTable* table; - // struct ListOfTable* prev; - struct ListOfTable* next; + struct SymbolTable* table; + // struct ListOfTable* prev; + struct ListOfTable* next; } ListOfTable; typedef struct TableNode { - char* theType; - char* theName; - struct TableNode* next; + char* theType; + char* theName; + struct TableNode* next; } TableNode; typedef struct SymbolTable { - TableNode* entries; - struct SymbolTable* Parent_Scope; - struct ListOfTable* Children_Scope; - int Line_Number; - int Column_Number; + TableNode* entries; + struct SymbolTable* Parent_Scope; + struct ListOfTable* Children_Scope; + int Line_Number; + int Column_Number; } SymbolTable; SymbolTable* CreateScope(SymbolTable* ParentScope, int Line, int Column); @@ -40,4 +40,4 @@ TableNode* getNextEntry(TableNode* tn); char* getType(TableNode* tn); char* getName(TableNode* tn); int getLine(SymbolTable* st); -int getColumn(SymbolTable* st); \ No newline at end of file +int getColumn(SymbolTable* st); From e8b0af1213cf08adceb7c2b310b0c8e073402acf Mon Sep 17 00:00:00 2001 From: Meyer Simon Date: Sun, 9 Mar 2025 15:19:15 -0400 Subject: [PATCH 104/105] Fixed the spacing in the symbole table files t#NONE --- src/symbol_table.c | 5 ++++- src/symbol_table.h | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/symbol_table.c b/src/symbol_table.c index ebd06ee..05a1f6e 100644 --- a/src/symbol_table.c +++ b/src/symbol_table.c @@ -85,7 +85,10 @@ void print_symbol_table(SymbolTable* table, FILE* file_ptr) { } else { current_scope = 1001; } - + if ( entrie == NULL ) { + fprintf(file_ptr, "%-17s: %06d : %06d : %-21s: %-28s\n", "", + current_scope, parant_scope, "", "Empty Scope"); + } for (; entrie != NULL; entrie = entrie->next) { if (parant_scope == 0) { fprintf(file_ptr, "%-17s: %06d : : %-21s: %-28s\n", diff --git a/src/symbol_table.h b/src/symbol_table.h index 1e1b7da..03028ad 100644 --- a/src/symbol_table.h +++ b/src/symbol_table.h @@ -7,7 +7,6 @@ typedef struct ListOfTable { struct SymbolTable* table; // struct ListOfTable* prev; struct ListOfTable* next; - } ListOfTable; typedef struct TableNode { From 2f046711235551ce0c4459324860f3402925b5b9 Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Mon, 10 Mar 2025 11:56:26 -0400 Subject: [PATCH 105/105] updated get entry function to get string pointers instead of creating different strings. Also created a define function for top level scopes. Create Entry does not work for top level --- runner | Bin 0 -> 31632 bytes src/runner.c | 2 +- src/symbol_table.c | 49 ++++++++++++++++++++++++++-- tests/sprint2/test/sp2_simple.alpha | 3 +- 4 files changed, 50 insertions(+), 4 deletions(-) create mode 100755 runner diff --git a/runner b/runner new file mode 100755 index 0000000000000000000000000000000000000000..2e82053c17fdb3d7d7accdf24e8b6de3f689a7ed GIT binary patch literal 31632 zcmeHwd3;pW-S?S<3t>7spHsKtsJTo_cUL9s=p8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P0dYKKab9{}5>86J_66Ps??+x(@>p9_;o1AE27` zT~bfMbvB1fwvo(koBkHLK~Yf2i`0|LeMNuVroU6_D`9=(5H8$n*xMm??OZT#x@A}x-qbbxJp;aQg`i0|EZvm7+_PdMcID?#)|>v literal 0 HcmV?d00001 diff --git a/src/runner.c b/src/runner.c index d6327ef..2110d23 100644 --- a/src/runner.c +++ b/src/runner.c @@ -75,7 +75,7 @@ fprintf(tok_flag, "%d %d %3d \"%s\"\n", line_number, column_number,tok, yytext); } int run(FILE *alpha) { int token; - cur = CreateScope(NULL, 1, 1); + top = cur = CreateScope(NULL, 1, 1); // If file is not found if (alpha == NULL) { diff --git a/src/symbol_table.c b/src/symbol_table.c index 47d731b..2053d76 100644 --- a/src/symbol_table.c +++ b/src/symbol_table.c @@ -6,7 +6,8 @@ #include #include #include - +char * typey = "type"; +char * funy = "function"; SymbolTable* CreateScope(SymbolTable* ParentScope, int Line, int Column) { SymbolTable* table = (SymbolTable*)malloc(sizeof(SymbolTable)); table->Line_Number = Line; @@ -33,9 +34,19 @@ SymbolTable* CreateScope(SymbolTable* ParentScope, int Line, int Column) { return table; } +//create entry just for things below top level scope TableNode* CreateEntry(SymbolTable* table, char* typeOf, char* id) { +if(table ==NULL || table->Parent_Scope == NULL){ + printf("Null reference to table given for create entry or given top level scope which is invalid\n"); + return NULL; +} +TableNode* topDef = (table_lookup(getAncestor(table),typeOf)); +if(topDef == NULL){ + printf("This type is not defined at the top level\n"); + return NULL; +} TableNode* newEntry = (TableNode*)malloc(sizeof(TableNode)); - newEntry->theType = typeOf; + newEntry->theType = topDef->theName; newEntry->theName = id; if (table->entries == NULL) { table->entries = newEntry; @@ -47,6 +58,40 @@ TableNode* CreateEntry(SymbolTable* table, char* typeOf, char* id) { return newEntry; } } + +//we use false for type defs and true for functions for parameter of typeOf +TableNode* Define(SymbolTable* table, bool typeOf, char* id) { +if(table ==NULL || table->Parent_Scope != NULL){ + printf("No valid table given for header defs\n"); + return NULL; +} + + + TableNode* newEntry = (TableNode*)malloc(sizeof(TableNode)); + +//possible issues with referencing text instead of heap +if(typeOf == 0){ + newEntry->theType = typey; +} +if (typeOf == 1){ + newEntry->theType = funy; +} +if(table_lookup(table,id) != NULL){ + printf("already defined at the top level, can't define duplicate names\n"); + return NULL; +} + newEntry->theName = id; + if (table->entries == NULL) { + table->entries = newEntry; + return newEntry; + } else { + TableNode* oldEntry = table->entries; + table->entries = newEntry; + newEntry->next = oldEntry; + return newEntry; + } +} + TableNode* table_lookup(SymbolTable* table, char* x) { TableNode* entrie = table->entries; for (; entrie != NULL; entrie = entrie->next) { diff --git a/tests/sprint2/test/sp2_simple.alpha b/tests/sprint2/test/sp2_simple.alpha index 13f3c9f..0b214c3 100644 --- a/tests/sprint2/test/sp2_simple.alpha +++ b/tests/sprint2/test/sp2_simple.alpha @@ -1,4 +1,5 @@ -#include "library.alpha" + entry(arg) := { + [int : x] return 0; }