diff --git a/.gitignore b/.gitignore index 1e7f6f8..8f4132b 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ cscope.out /src/y.tab.c /src/lex.yy.c /src/parse.tab.c +/src/y.output /bin /build /lib diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..f2b54c3 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,5 @@ +language: c +compiler: +- clang +- gcc +script: make test diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0c251e6 --- /dev/null +++ b/Makefile @@ -0,0 +1,30 @@ +YACC = bison -y +LEX = flex +TARGET = bin/streem + +all : $(TARGET) + +.PHONY : all + +test : all + $(TARGET) example/fizzbuzz.strm +.PHONY : test + +src/y.tab.c : src/parse.y + $(YACC) -o src/y.tab.c src/parse.y + +src/lex.yy.c : src/lex.l + $(LEX) -o src/lex.yy.c src/lex.l + +src/parse.o : src/y.tab.c src/lex.yy.c + $(CC) -g -c src/y.tab.c -o src/parse.o + +$(TARGET) : src/parse.o + mkdir -p "$$(dirname $(TARGET))" + $(CC) -g src/parse.o -o $(TARGET) + +clean : + rm -f src/y.output src/y.tab.c + rm -f src/lex.yy.c + rm -f src/*.o $(TARGET) +.PHONY : clean diff --git a/README.md b/README.md index 88dca26..3c28b4c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # Streem - stream based concurrent scripting language +[![Build Status](https://travis-ci.org/matz/streem.svg?branch=master)](https://travis-ci.org/matz/streem) +[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/matz/streem?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + Streem is a concurrent scripting language based on a programming model similar to shell, with influences from Ruby, Erlang and other functional programming languages. @@ -10,7 +13,12 @@ In Streem, a simple `cat` program looks like this: STDIN | STDOUT ``` -And a simple FizzBuzz will look like this: +Streem is a (sort of) DSL for data flows. Above code means +building data-flow connection between `STDIN` and `STDOUT`. +Actual data processing will be done in the event loop +invoked after program execution. + +For another example, a simple FizzBuzz will look like this: ``` seq(100) | {|x| @@ -29,6 +37,10 @@ seq(100) | {|x| } | STDOUT ``` +The second part in the pipeline (`{|x|...}`) is a function +object. If a function object is connected in the pipeline, +it will be invoked for each elements in the stream. + # Note Streem is still in the design stage. It's not working yet. Stay tuned. @@ -38,11 +50,11 @@ Streem is still in the design stage. It's not working yet. Stay tuned. * bison * flex * gcc / clang +* cram (python, pip) # How to compile ``` -cd src make ``` @@ -53,6 +65,26 @@ you have granted non-exclusive right to your contributed code under MIT license. Use for discussion. +# How to test + +## Cram + +[Cram](https://bitheap.org/cram/) is a testing framework for testing command line applications. + +Cram tests look like snippets of interactive shell sessions. Cram runs each command and compares the command output in the test with the command's actual output. + +## Install Cram Testing Framework + +``` +$ sudo pip install cram +``` + +## Running tests + +``` +$ cram tests/*.t -E +``` + # License Streem is distributed under MIT license. diff --git a/example/fizzbuzz.strm b/example/fizzbuzz.strm new file mode 100644 index 0000000..2b9e25f --- /dev/null +++ b/example/fizzbuzz.strm @@ -0,0 +1,14 @@ +seq(100) | {|x| + if x % 15 == 0 { + "FizzBuzz" + } + else if x % 3 == 0 { + "Fizz" + } + else if x % 5 == 0 { + "Buzz" + } + else { + x + } +} | STDOUT diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index bc48768..0000000 --- a/src/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -YACC = bison -y -LEX = flex -TARGET = ../bin/streem - -all : $(TARGET) - -.PHONY : all - -test : all - streem example.stm -.PHONY : test - -y.tab.c : parse.y - $(YACC) parse.y - -lex.yy.c : lex.l - $(LEX) lex.l - -parse.o : y.tab.c lex.yy.c - $(CC) -g -c y.tab.c -o parse.o - -$(TARGET) : parse.o - mkdir -p "$$(dirname $(TARGET))" - $(CC) -g parse.o -o $(TARGET) - -clean : - rm -f y.output y.tab.c - rm -f lex.yy.c - rm -f *.o $(TARGET) -.PHONY : clean diff --git a/src/lex.l b/src/lex.l index 37a8da0..f7dc963 100644 --- a/src/lex.l +++ b/src/lex.l @@ -4,47 +4,81 @@ ** See Copyright Notice in LICENSE file. */ -%option bison-bridge +%{ +#define YY_DECL int yylex(YYSTYPE *yylval) + +static char* +strdup0(const char *s) +{ + size_t len = strlen(s); + char *p; + + p = (char*)malloc(len+1); + if (p) { + strcpy(p, s); + } + return p; +} + +static char* +strndup0(const char *s, size_t n) +{ + size_t i, len; + const char *p = s; + char *new; + + for (i=0; i"{TRAIL} return op_gt; -">="{TRAIL} return op_ge; -"&&"{TRAIL} return op_and; -"||"{TRAIL} return op_or; -"|"{TRAIL} return op_bar; -"&"{TRAIL} return op_amper; -"<-"{TRAIL} return op_lasgn; -"->"{TRAIL} return op_rasgn; +"+"{TRAIL} return op_plus; +"-"{TRAIL} return op_minus; +"*"{TRAIL} return op_mult; +"/"{TRAIL} return op_div; +"%"{TRAIL} return op_mod; +"=="{TRAIL} return op_eq; +"!="{TRAIL} return op_neq; +"<"{TRAIL} return op_lt; +"<="{TRAIL} return op_le; +">"{TRAIL} return op_gt; +">="{TRAIL} return op_ge; +"&&"{TRAIL} return op_and; +"||"{TRAIL} return op_or; +"|"{TRAIL} return op_bar; +"&"{TRAIL} return op_amper; +"<-"{TRAIL} return op_lasgn; +"->"{TRAIL} return op_rasgn; +"="{TRAIL} return '='; -if{TRAIL} return keyword_if; -{TRAIL}else{TRAIL} return keyword_else; -break{TRAIL} return keyword_break; -emit{TRAIL} return keyword_emit; -return{TRAIL} return keyword_return; -nil{TRAIL} return keyword_nil; -true{TRAIL} return keyword_true; -false{TRAIL} return keyword_false; +if{TRAIL} return keyword_if; +{TRAIL}else{TRAIL} return keyword_else; +break{TRAIL} return keyword_break; +emit{TRAIL} return keyword_emit; +return{TRAIL} return keyword_return; +nil{TRAIL} return keyword_nil; +true{TRAIL} return keyword_true; +false{TRAIL} return keyword_false; [A-Za-z_][A-Za-z0-9_]* { - yylval->str = strdup(yytext); + yylval->str = strdup0(yytext); return identifier; }; {TRAIL}\.{TRAIL} return '.'; -[(\[{,;]{TRAIL} return yytext[0]; -[)\]}] return yytext[0]; -"\n" return '\n'; +[(\[{,;:]{TRAIL} return yytext[0]; +[)\]}] return yytext[0]; +"\n" return '\n'; (([1-9][0-9]*)|0)(\.[0-9]*)? { double temp; @@ -54,7 +88,7 @@ false{TRAIL} return keyword_false; }; \"([^\\\"]|\\.)*\" { - yylval->str = strndup(yytext+1, strlen(yytext)-2); + yylval->str = strndup0(yytext+1, strlen(yytext)-2); return lit_string; }; diff --git a/src/parse.y b/src/parse.y index b41bd17..6435f1f 100644 --- a/src/parse.y +++ b/src/parse.y @@ -35,8 +35,8 @@ static void yyerror(parser_state *p, const char *s); keyword_nil keyword_true keyword_false - op_lasgn - op_rasgn + op_lasgn + op_rasgn op_plus op_minus op_mult @@ -54,9 +54,9 @@ static void yyerror(parser_state *p, const char *s); op_amper %token - lit_number - lit_string - identifier + lit_number + lit_string + identifier /* * precedence table @@ -152,12 +152,13 @@ primary : lit_number | primary '.' identifier '(' opt_args ')' | primary '.' identifier | keyword_if expr '{' compstmt '}' opt_else - | keyword_nil - | keyword_true - | keyword_false + | keyword_nil + | keyword_true + | keyword_false ; -map : expr ':' expr +map : lit_string ':' expr + | identifier ':' expr ; map_args : map @@ -204,7 +205,11 @@ main(int argc, const char**argv) { int n; - // yydebug = 1; + if (argc > 1) { + yyin = fopen(argv[1], "r"); + } + + yydebug = 1; n = yyparse(NULL); if (n == 0) { printf("Syntax OK\n"); diff --git a/tests/parser_tests.test b/tests/parser_tests.test new file mode 100644 index 0000000..6129719 --- /dev/null +++ b/tests/parser_tests.test @@ -0,0 +1,4962 @@ +Streem should recognise the sequence funciton: + $ echo 'seq(100)' | $TESTDIR/../bin/streem + Starting parse + Entering state 0 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 13 + Reading a token: Next token is token '(' () + Shifting token '(' () + Entering state 36 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 13 36 + Entering state 25 + Reading a token: Next token is token ')' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 13 36 + Entering state 30 + Next token is token ')' () + Reducing stack by rule 41 (line 138): + $1 = nterm expr () + -> $$ = nterm args () + Stack now 0 13 36 + Entering state 32 + Next token is token ')' () + Reducing stack by rule 40 (line 135): + $1 = nterm args () + -> $$ = nterm opt_args () + Stack now 0 13 36 + Entering state 77 + Next token is token ')' () + Shifting token ')' () + Entering state 113 + Reducing stack by rule 52 (line 151): + $1 = token identifier () + $2 = token '(' () + $3 = nterm opt_args () + $4 = token ')' () + -> $$ = nterm primary () + Stack now 0 + Entering state 25 + Reading a token: Next token is token '\n' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token '\n' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 + Entering state 21 + Next token is token '\n' () + Shifting token '\n' () + Entering state 52 + Reducing stack by rule 75 (line 190): + $1 = token '\n' () + -> $$ = nterm term () + Stack now 0 21 + Entering state 55 + Reducing stack by rule 72 (line 185): + $1 = nterm term () + -> $$ = nterm terms () + Stack now 0 21 + Entering state 54 + Reading a token: Now at end of input. + Reducing stack by rule 71 (line 182): + $1 = nterm terms () + -> $$ = nterm opt_terms () + Stack now 0 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 + Entering state 20 + Reducing stack by rule 1 (line 80): + $1 = nterm compstmt () + -> $$ = nterm program () + Stack now 0 + Entering state 19 + Now at end of input. + Stack now 0 19 + Cleanup: popping nterm program () + Syntax OK + +Streem should recognise an if statement: + $ echo 'if true {}' | $TESTDIR/../bin/streem + Starting parse + Entering state 0 + Reading a token: Next token is token keyword_if () + Shifting token keyword_if () + Entering state 2 + Reading a token: Next token is token keyword_true () + Shifting token keyword_true () + Entering state 7 + Reducing stack by rule 57 (line 156): + $1 = token keyword_true () + -> $$ = nterm primary () + Stack now 0 2 + Entering state 25 + Reading a token: Next token is token '{' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 2 + Entering state 29 + Next token is token '{' () + Shifting token '{' () + Entering state 75 + Reading a token: Next token is token '}' () + Reducing stack by rule 3 (line 86): + -> $$ = nterm stmts () + Stack now 0 2 29 75 + Entering state 21 + Next token is token '}' () + Reducing stack by rule 70 (line 181): + -> $$ = nterm opt_terms () + Stack now 0 2 29 75 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 2 29 75 + Entering state 111 + Next token is token '}' () + Shifting token '}' () + Entering state 123 + Reducing stack by rule 35 (line 126): + -> $$ = nterm opt_elsif () + Stack now 0 2 29 75 111 123 + Entering state 126 + Reading a token: Next token is token '\n' () + Reducing stack by rule 37 (line 130): + $1 = nterm opt_elsif () + -> $$ = nterm opt_else () + Stack now 0 2 29 75 111 123 + Entering state 127 + Reducing stack by rule 55 (line 154): + $1 = token keyword_if () + $2 = nterm expr () + $3 = token '{' () + $4 = nterm compstmt () + $5 = token '}' () + $6 = nterm opt_else () + -> $$ = nterm primary () + Stack now 0 + Entering state 25 + Next token is token '\n' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token '\n' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 + Entering state 21 + Next token is token '\n' () + Shifting token '\n' () + Entering state 52 + Reducing stack by rule 75 (line 190): + $1 = token '\n' () + -> $$ = nterm term () + Stack now 0 21 + Entering state 55 + Reducing stack by rule 72 (line 185): + $1 = nterm term () + -> $$ = nterm terms () + Stack now 0 21 + Entering state 54 + Reading a token: Now at end of input. + Reducing stack by rule 71 (line 182): + $1 = nterm terms () + -> $$ = nterm opt_terms () + Stack now 0 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 + Entering state 20 + Reducing stack by rule 1 (line 80): + $1 = nterm compstmt () + -> $$ = nterm program () + Stack now 0 + Entering state 19 + Now at end of input. + Stack now 0 19 + Cleanup: popping nterm program () + Syntax OK + +Streem should recognise an if-else statement: + $ echo 'if true {} else {}' | $TESTDIR/../bin/streem + Starting parse + Entering state 0 + Reading a token: Next token is token keyword_if () + Shifting token keyword_if () + Entering state 2 + Reading a token: Next token is token keyword_true () + Shifting token keyword_true () + Entering state 7 + Reducing stack by rule 57 (line 156): + $1 = token keyword_true () + -> $$ = nterm primary () + Stack now 0 2 + Entering state 25 + Reading a token: Next token is token '{' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 2 + Entering state 29 + Next token is token '{' () + Shifting token '{' () + Entering state 75 + Reading a token: Next token is token '}' () + Reducing stack by rule 3 (line 86): + -> $$ = nterm stmts () + Stack now 0 2 29 75 + Entering state 21 + Next token is token '}' () + Reducing stack by rule 70 (line 181): + -> $$ = nterm opt_terms () + Stack now 0 2 29 75 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 2 29 75 + Entering state 111 + Next token is token '}' () + Shifting token '}' () + Entering state 123 + Reducing stack by rule 35 (line 126): + -> $$ = nterm opt_elsif () + Stack now 0 2 29 75 111 123 + Entering state 126 + Reading a token: Next token is token keyword_else () + Shifting token keyword_else () + Entering state 129 + Reading a token: Next token is token '{' () + Shifting token '{' () + Entering state 131 + Reading a token: Next token is token '}' () + Reducing stack by rule 3 (line 86): + -> $$ = nterm stmts () + Stack now 0 2 29 75 111 123 126 129 131 + Entering state 21 + Next token is token '}' () + Reducing stack by rule 70 (line 181): + -> $$ = nterm opt_terms () + Stack now 0 2 29 75 111 123 126 129 131 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 2 29 75 111 123 126 129 131 + Entering state 133 + Next token is token '}' () + Shifting token '}' () + Entering state 135 + Reducing stack by rule 38 (line 131): + $1 = nterm opt_elsif () + $2 = token keyword_else () + $3 = token '{' () + $4 = nterm compstmt () + $5 = token '}' () + -> $$ = nterm opt_else () + Stack now 0 2 29 75 111 123 + Entering state 127 + Reducing stack by rule 55 (line 154): + $1 = token keyword_if () + $2 = nterm expr () + $3 = token '{' () + $4 = nterm compstmt () + $5 = token '}' () + $6 = nterm opt_else () + -> $$ = nterm primary () + Stack now 0 + Entering state 25 + Reading a token: Next token is token '\n' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token '\n' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 + Entering state 21 + Next token is token '\n' () + Shifting token '\n' () + Entering state 52 + Reducing stack by rule 75 (line 190): + $1 = token '\n' () + -> $$ = nterm term () + Stack now 0 21 + Entering state 55 + Reducing stack by rule 72 (line 185): + $1 = nterm term () + -> $$ = nterm terms () + Stack now 0 21 + Entering state 54 + Reading a token: Now at end of input. + Reducing stack by rule 71 (line 182): + $1 = nterm terms () + -> $$ = nterm opt_terms () + Stack now 0 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 + Entering state 20 + Reducing stack by rule 1 (line 80): + $1 = nterm compstmt () + -> $$ = nterm program () + Stack now 0 + Entering state 19 + Now at end of input. + Stack now 0 19 + Cleanup: popping nterm program () + Syntax OK + +Streem should recognise a mathimatical expression: + $ echo '((1 + 1) * (99 / 3)) % 33' | $TESTDIR/../bin/streem + Starting parse + Entering state 0 + Reading a token: Next token is token '(' () + Shifting token '(' () + Entering state 17 + Reading a token: Next token is token '(' () + Shifting token '(' () + Entering state 17 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 17 17 + Entering state 25 + Reading a token: Next token is token op_plus () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 17 17 + Entering state 24 + Next token is token op_plus () + Shifting token op_plus () + Entering state 59 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 17 17 24 59 + Entering state 25 + Reading a token: Next token is token ')' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 17 17 24 59 + Entering state 95 + Next token is token ')' () + Reducing stack by rule 15 (line 104): + $1 = nterm expr () + $2 = token op_plus () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 17 17 + Entering state 24 + Next token is token ')' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 17 17 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 17 17 + Entering state 21 + Next token is token ')' () + Reducing stack by rule 70 (line 181): + -> $$ = nterm opt_terms () + Stack now 0 17 17 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 17 17 + Entering state 42 + Next token is token ')' () + Shifting token ')' () + Entering state 82 + Reducing stack by rule 46 (line 145): + $1 = token '(' () + $2 = nterm compstmt () + $3 = token ')' () + -> $$ = nterm primary () + Stack now 0 17 + Entering state 25 + Reading a token: Next token is token op_mult () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 17 + Entering state 24 + Next token is token op_mult () + Shifting token op_mult () + Entering state 61 + Reading a token: Next token is token '(' () + Shifting token '(' () + Entering state 17 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 17 24 61 17 + Entering state 25 + Reading a token: Next token is token op_div () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 17 24 61 17 + Entering state 24 + Next token is token op_div () + Shifting token op_div () + Entering state 62 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 17 24 61 17 24 62 + Entering state 25 + Reading a token: Next token is token ')' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 17 24 61 17 24 62 + Entering state 98 + Reducing stack by rule 18 (line 107): + $1 = nterm expr () + $2 = token op_div () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 17 24 61 17 + Entering state 24 + Next token is token ')' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 17 24 61 17 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 17 24 61 17 + Entering state 21 + Next token is token ')' () + Reducing stack by rule 70 (line 181): + -> $$ = nterm opt_terms () + Stack now 0 17 24 61 17 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 17 24 61 17 + Entering state 42 + Next token is token ')' () + Shifting token ')' () + Entering state 82 + Reducing stack by rule 46 (line 145): + $1 = token '(' () + $2 = nterm compstmt () + $3 = token ')' () + -> $$ = nterm primary () + Stack now 0 17 24 61 + Entering state 25 + Reading a token: Next token is token ')' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 17 24 61 + Entering state 97 + Reducing stack by rule 17 (line 106): + $1 = nterm expr () + $2 = token op_mult () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 17 + Entering state 24 + Next token is token ')' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 17 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 17 + Entering state 21 + Next token is token ')' () + Reducing stack by rule 70 (line 181): + -> $$ = nterm opt_terms () + Stack now 0 17 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 17 + Entering state 42 + Next token is token ')' () + Shifting token ')' () + Entering state 82 + Reducing stack by rule 46 (line 145): + $1 = token '(' () + $2 = nterm compstmt () + $3 = token ')' () + -> $$ = nterm primary () + Stack now 0 + Entering state 25 + Reading a token: Next token is token op_mod () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token op_mod () + Shifting token op_mod () + Entering state 63 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 24 63 + Entering state 25 + Reading a token: Next token is token '\n' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 63 + Entering state 99 + Reducing stack by rule 19 (line 108): + $1 = nterm expr () + $2 = token op_mod () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token '\n' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 + Entering state 21 + Next token is token '\n' () + Shifting token '\n' () + Entering state 52 + Reducing stack by rule 75 (line 190): + $1 = token '\n' () + -> $$ = nterm term () + Stack now 0 21 + Entering state 55 + Reducing stack by rule 72 (line 185): + $1 = nterm term () + -> $$ = nterm terms () + Stack now 0 21 + Entering state 54 + Reading a token: Now at end of input. + Reducing stack by rule 71 (line 182): + $1 = nterm terms () + -> $$ = nterm opt_terms () + Stack now 0 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 + Entering state 20 + Reducing stack by rule 1 (line 80): + $1 = nterm compstmt () + -> $$ = nterm program () + Stack now 0 + Entering state 19 + Now at end of input. + Stack now 0 19 + Cleanup: popping nterm program () + Syntax OK + +Streem should recognise a boolean expression: + $ echo '1 < 2 && 2 <= 3 && (4 >= 5) || ((3 + 3) > 8) && 1 == 1' | $TESTDIR/../bin/streem + Starting parse + Entering state 0 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 + Entering state 25 + Reading a token: Next token is token op_lt () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token op_lt () + Shifting token op_lt () + Entering state 66 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 24 66 + Entering state 25 + Reading a token: Next token is token op_and () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 66 + Entering state 102 + Next token is token op_and () + Reducing stack by rule 24 (line 113): + $1 = nterm expr () + $2 = token op_lt () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token op_and () + Shifting token op_and () + Entering state 70 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 24 70 + Entering state 25 + Reading a token: Next token is token op_le () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 70 + Entering state 106 + Next token is token op_le () + Shifting token op_le () + Entering state 67 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 24 70 106 67 + Entering state 25 + Reading a token: Next token is token op_and () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 70 106 67 + Entering state 103 + Next token is token op_and () + Reducing stack by rule 25 (line 114): + $1 = nterm expr () + $2 = token op_le () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 24 70 + Entering state 106 + Next token is token op_and () + Reducing stack by rule 32 (line 121): + $1 = nterm expr () + $2 = token op_and () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token op_and () + Shifting token op_and () + Entering state 70 + Reading a token: Next token is token '(' () + Shifting token '(' () + Entering state 17 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 24 70 17 + Entering state 25 + Reading a token: Next token is token op_ge () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 70 17 + Entering state 24 + Next token is token op_ge () + Shifting token op_ge () + Entering state 69 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 24 70 17 24 69 + Entering state 25 + Reading a token: Next token is token ')' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 70 17 24 69 + Entering state 105 + Next token is token ')' () + Reducing stack by rule 23 (line 112): + $1 = nterm expr () + $2 = token op_ge () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 24 70 17 + Entering state 24 + Next token is token ')' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 24 70 17 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 24 70 17 + Entering state 21 + Next token is token ')' () + Reducing stack by rule 70 (line 181): + -> $$ = nterm opt_terms () + Stack now 0 24 70 17 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 24 70 17 + Entering state 42 + Next token is token ')' () + Shifting token ')' () + Entering state 82 + Reducing stack by rule 46 (line 145): + $1 = token '(' () + $2 = nterm compstmt () + $3 = token ')' () + -> $$ = nterm primary () + Stack now 0 24 70 + Entering state 25 + Reading a token: Next token is token op_or () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 70 + Entering state 106 + Next token is token op_or () + Reducing stack by rule 32 (line 121): + $1 = nterm expr () + $2 = token op_and () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token op_or () + Shifting token op_or () + Entering state 71 + Reading a token: Next token is token '(' () + Shifting token '(' () + Entering state 17 + Reading a token: Next token is token '(' () + Shifting token '(' () + Entering state 17 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 24 71 17 17 + Entering state 25 + Reading a token: Next token is token op_plus () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 71 17 17 + Entering state 24 + Next token is token op_plus () + Shifting token op_plus () + Entering state 59 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 24 71 17 17 24 59 + Entering state 25 + Reading a token: Next token is token ')' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 71 17 17 24 59 + Entering state 95 + Next token is token ')' () + Reducing stack by rule 15 (line 104): + $1 = nterm expr () + $2 = token op_plus () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 24 71 17 17 + Entering state 24 + Next token is token ')' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 24 71 17 17 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 24 71 17 17 + Entering state 21 + Next token is token ')' () + Reducing stack by rule 70 (line 181): + -> $$ = nterm opt_terms () + Stack now 0 24 71 17 17 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 24 71 17 17 + Entering state 42 + Next token is token ')' () + Shifting token ')' () + Entering state 82 + Reducing stack by rule 46 (line 145): + $1 = token '(' () + $2 = nterm compstmt () + $3 = token ')' () + -> $$ = nterm primary () + Stack now 0 24 71 17 + Entering state 25 + Reading a token: Next token is token op_gt () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 71 17 + Entering state 24 + Next token is token op_gt () + Shifting token op_gt () + Entering state 68 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 24 71 17 24 68 + Entering state 25 + Reading a token: Next token is token ')' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 71 17 24 68 + Entering state 104 + Next token is token ')' () + Reducing stack by rule 22 (line 111): + $1 = nterm expr () + $2 = token op_gt () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 24 71 17 + Entering state 24 + Next token is token ')' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 24 71 17 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 24 71 17 + Entering state 21 + Next token is token ')' () + Reducing stack by rule 70 (line 181): + -> $$ = nterm opt_terms () + Stack now 0 24 71 17 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 24 71 17 + Entering state 42 + Next token is token ')' () + Shifting token ')' () + Entering state 82 + Reducing stack by rule 46 (line 145): + $1 = token '(' () + $2 = nterm compstmt () + $3 = token ')' () + -> $$ = nterm primary () + Stack now 0 24 71 + Entering state 25 + Reading a token: Next token is token op_and () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 71 + Entering state 107 + Next token is token op_and () + Shifting token op_and () + Entering state 70 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 24 71 107 70 + Entering state 25 + Reading a token: Next token is token op_eq () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 71 107 70 + Entering state 106 + Next token is token op_eq () + Shifting token op_eq () + Entering state 64 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 24 71 107 70 106 64 + Entering state 25 + Reading a token: Next token is token '\n' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 71 107 70 106 64 + Entering state 100 + Next token is token '\n' () + Reducing stack by rule 26 (line 115): + $1 = nterm expr () + $2 = token op_eq () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 24 71 107 70 + Entering state 106 + Next token is token '\n' () + Reducing stack by rule 32 (line 121): + $1 = nterm expr () + $2 = token op_and () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 24 71 + Entering state 107 + Next token is token '\n' () + Reducing stack by rule 33 (line 122): + $1 = nterm expr () + $2 = token op_or () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token '\n' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 + Entering state 21 + Next token is token '\n' () + Shifting token '\n' () + Entering state 52 + Reducing stack by rule 75 (line 190): + $1 = token '\n' () + -> $$ = nterm term () + Stack now 0 21 + Entering state 55 + Reducing stack by rule 72 (line 185): + $1 = nterm term () + -> $$ = nterm terms () + Stack now 0 21 + Entering state 54 + Reading a token: Now at end of input. + Reducing stack by rule 71 (line 182): + $1 = nterm terms () + -> $$ = nterm opt_terms () + Stack now 0 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 + Entering state 20 + Reducing stack by rule 1 (line 80): + $1 = nterm compstmt () + -> $$ = nterm program () + Stack now 0 + Entering state 19 + Now at end of input. + Stack now 0 19 + Cleanup: popping nterm program () + Syntax OK + +Streem should recognise a stream expression: + $ echo 'STDIN | STDOUT' | $TESTDIR/../bin/streem + Starting parse + Entering state 0 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 13 + Reading a token: Next token is token op_bar () + Reducing stack by rule 45 (line 144): + $1 = token identifier () + -> $$ = nterm primary () + Stack now 0 + Entering state 25 + Next token is token op_bar () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token op_bar () + Shifting token op_bar () + Entering state 72 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 28 + Reading a token: Next token is token '\n' () + Reducing stack by rule 45 (line 144): + $1 = token identifier () + -> $$ = nterm primary () + Stack now 0 24 72 + Entering state 25 + Next token is token '\n' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 + Entering state 108 + Next token is token '\n' () + Reducing stack by rule 20 (line 109): + $1 = nterm expr () + $2 = token op_bar () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token '\n' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 + Entering state 21 + Next token is token '\n' () + Shifting token '\n' () + Entering state 52 + Reducing stack by rule 75 (line 190): + $1 = token '\n' () + -> $$ = nterm term () + Stack now 0 21 + Entering state 55 + Reducing stack by rule 72 (line 185): + $1 = nterm term () + -> $$ = nterm terms () + Stack now 0 21 + Entering state 54 + Reading a token: Now at end of input. + Reducing stack by rule 71 (line 182): + $1 = nterm terms () + -> $$ = nterm opt_terms () + Stack now 0 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 + Entering state 20 + Reducing stack by rule 1 (line 80): + $1 = nterm compstmt () + -> $$ = nterm program () + Stack now 0 + Entering state 19 + Now at end of input. + Stack now 0 19 + Cleanup: popping nterm program () + Syntax OK + +Streem should recognise a block expression: + $ echo '{ |x| x + 1 }' | $TESTDIR/../bin/streem + Starting parse + Entering state 0 + Reading a token: Next token is token '{' () + Shifting token '{' () + Entering state 16 + Reading a token: Next token is token op_bar () + Shifting token op_bar () + Entering state 40 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 79 + Reducing stack by rule 68 (line 177): + $1 = token identifier () + -> $$ = nterm f_args () + Stack now 0 16 40 + Entering state 80 + Reading a token: Next token is token op_bar () + Shifting token op_bar () + Entering state 114 + Reducing stack by rule 67 (line 174): + $1 = token op_bar () + $2 = nterm f_args () + $3 = token op_bar () + -> $$ = nterm bparam () + Stack now 0 16 + Entering state 41 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 13 + Reading a token: Next token is token op_plus () + Reducing stack by rule 45 (line 144): + $1 = token identifier () + -> $$ = nterm primary () + Stack now 0 16 41 + Entering state 25 + Next token is token op_plus () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 16 41 + Entering state 24 + Next token is token op_plus () + Shifting token op_plus () + Entering state 59 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 16 41 24 59 + Entering state 25 + Reading a token: Next token is token '}' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 16 41 24 59 + Entering state 95 + Next token is token '}' () + Reducing stack by rule 15 (line 104): + $1 = nterm expr () + $2 = token op_plus () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 16 41 + Entering state 24 + Next token is token '}' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 16 41 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 16 41 + Entering state 21 + Next token is token '}' () + Reducing stack by rule 70 (line 181): + -> $$ = nterm opt_terms () + Stack now 0 16 41 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 16 41 + Entering state 81 + Next token is token '}' () + Shifting token '}' () + Entering state 116 + Reducing stack by rule 63 (line 168): + $1 = token '{' () + $2 = nterm bparam () + $3 = nterm compstmt () + $4 = token '}' () + -> $$ = nterm block () + Stack now 0 + Entering state 26 + Reducing stack by rule 51 (line 150): + $1 = nterm block () + -> $$ = nterm primary () + Stack now 0 + Entering state 25 + Reading a token: Next token is token '\n' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token '\n' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 + Entering state 21 + Next token is token '\n' () + Shifting token '\n' () + Entering state 52 + Reducing stack by rule 75 (line 190): + $1 = token '\n' () + -> $$ = nterm term () + Stack now 0 21 + Entering state 55 + Reducing stack by rule 72 (line 185): + $1 = nterm term () + -> $$ = nterm terms () + Stack now 0 21 + Entering state 54 + Reading a token: Now at end of input. + Reducing stack by rule 71 (line 182): + $1 = nterm terms () + -> $$ = nterm opt_terms () + Stack now 0 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 + Entering state 20 + Reducing stack by rule 1 (line 80): + $1 = nterm compstmt () + -> $$ = nterm program () + Stack now 0 + Entering state 19 + Now at end of input. + Stack now 0 19 + Cleanup: popping nterm program () + Syntax OK + +Streem should recognise a block expression in a stream: + $ echo 'STDIN | { |s| s + "!" } | STDOUT' | $TESTDIR/../bin/streem + Starting parse + Entering state 0 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 13 + Reading a token: Next token is token op_bar () + Reducing stack by rule 45 (line 144): + $1 = token identifier () + -> $$ = nterm primary () + Stack now 0 + Entering state 25 + Next token is token op_bar () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token op_bar () + Shifting token op_bar () + Entering state 72 + Reading a token: Next token is token '{' () + Shifting token '{' () + Entering state 16 + Reading a token: Next token is token op_bar () + Shifting token op_bar () + Entering state 40 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 79 + Reducing stack by rule 68 (line 177): + $1 = token identifier () + -> $$ = nterm f_args () + Stack now 0 24 72 16 40 + Entering state 80 + Reading a token: Next token is token op_bar () + Shifting token op_bar () + Entering state 114 + Reducing stack by rule 67 (line 174): + $1 = token op_bar () + $2 = nterm f_args () + $3 = token op_bar () + -> $$ = nterm bparam () + Stack now 0 24 72 16 + Entering state 41 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 13 + Reading a token: Next token is token op_plus () + Reducing stack by rule 45 (line 144): + $1 = token identifier () + -> $$ = nterm primary () + Stack now 0 24 72 16 41 + Entering state 25 + Next token is token op_plus () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 + Entering state 24 + Next token is token op_plus () + Shifting token op_plus () + Entering state 59 + Reading a token: Next token is token lit_string () + Shifting token lit_string () + Entering state 12 + Reducing stack by rule 44 (line 143): + $1 = token lit_string () + -> $$ = nterm primary () + Stack now 0 24 72 16 41 24 59 + Entering state 25 + Reading a token: Next token is token '}' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 24 59 + Entering state 95 + Next token is token '}' () + Reducing stack by rule 15 (line 104): + $1 = nterm expr () + $2 = token op_plus () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 + Entering state 24 + Next token is token '}' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 24 72 16 41 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 24 72 16 41 + Entering state 21 + Next token is token '}' () + Reducing stack by rule 70 (line 181): + -> $$ = nterm opt_terms () + Stack now 0 24 72 16 41 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 24 72 16 41 + Entering state 81 + Next token is token '}' () + Shifting token '}' () + Entering state 116 + Reducing stack by rule 63 (line 168): + $1 = token '{' () + $2 = nterm bparam () + $3 = nterm compstmt () + $4 = token '}' () + -> $$ = nterm block () + Stack now 0 24 72 + Entering state 26 + Reducing stack by rule 51 (line 150): + $1 = nterm block () + -> $$ = nterm primary () + Stack now 0 24 72 + Entering state 25 + Reading a token: Next token is token op_bar () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 + Entering state 108 + Next token is token op_bar () + Reducing stack by rule 20 (line 109): + $1 = nterm expr () + $2 = token op_bar () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token op_bar () + Shifting token op_bar () + Entering state 72 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 28 + Reading a token: Next token is token '\n' () + Reducing stack by rule 45 (line 144): + $1 = token identifier () + -> $$ = nterm primary () + Stack now 0 24 72 + Entering state 25 + Next token is token '\n' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 + Entering state 108 + Next token is token '\n' () + Reducing stack by rule 20 (line 109): + $1 = nterm expr () + $2 = token op_bar () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token '\n' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 + Entering state 21 + Next token is token '\n' () + Shifting token '\n' () + Entering state 52 + Reducing stack by rule 75 (line 190): + $1 = token '\n' () + -> $$ = nterm term () + Stack now 0 21 + Entering state 55 + Reducing stack by rule 72 (line 185): + $1 = nterm term () + -> $$ = nterm terms () + Stack now 0 21 + Entering state 54 + Reading a token: Now at end of input. + Reducing stack by rule 71 (line 182): + $1 = nterm terms () + -> $$ = nterm opt_terms () + Stack now 0 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 + Entering state 20 + Reducing stack by rule 1 (line 80): + $1 = nterm compstmt () + -> $$ = nterm program () + Stack now 0 + Entering state 19 + Now at end of input. + Stack now 0 19 + Cleanup: popping nterm program () + Syntax OK + +Streem should recognise a block expression with a statement in a stream: + $ echo 'STDIN | { |s| if (s != "exit") { s } else { exit() } } | STDOUT' | $TESTDIR/../bin/streem + Starting parse + Entering state 0 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 13 + Reading a token: Next token is token op_bar () + Reducing stack by rule 45 (line 144): + $1 = token identifier () + -> $$ = nterm primary () + Stack now 0 + Entering state 25 + Next token is token op_bar () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token op_bar () + Shifting token op_bar () + Entering state 72 + Reading a token: Next token is token '{' () + Shifting token '{' () + Entering state 16 + Reading a token: Next token is token op_bar () + Shifting token op_bar () + Entering state 40 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 79 + Reducing stack by rule 68 (line 177): + $1 = token identifier () + -> $$ = nterm f_args () + Stack now 0 24 72 16 40 + Entering state 80 + Reading a token: Next token is token op_bar () + Shifting token op_bar () + Entering state 114 + Reducing stack by rule 67 (line 174): + $1 = token op_bar () + $2 = nterm f_args () + $3 = token op_bar () + -> $$ = nterm bparam () + Stack now 0 24 72 16 + Entering state 41 + Reading a token: Next token is token keyword_if () + Shifting token keyword_if () + Entering state 2 + Reading a token: Next token is token '(' () + Shifting token '(' () + Entering state 17 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 13 + Reading a token: Next token is token op_neq () + Reducing stack by rule 45 (line 144): + $1 = token identifier () + -> $$ = nterm primary () + Stack now 0 24 72 16 41 2 17 + Entering state 25 + Next token is token op_neq () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 17 + Entering state 24 + Next token is token op_neq () + Shifting token op_neq () + Entering state 65 + Reading a token: Next token is token lit_string () + Shifting token lit_string () + Entering state 12 + Reducing stack by rule 44 (line 143): + $1 = token lit_string () + -> $$ = nterm primary () + Stack now 0 24 72 16 41 2 17 24 65 + Entering state 25 + Reading a token: Next token is token ')' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 17 24 65 + Entering state 101 + Next token is token ')' () + Reducing stack by rule 27 (line 116): + $1 = nterm expr () + $2 = token op_neq () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 17 + Entering state 24 + Next token is token ')' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 24 72 16 41 2 17 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 24 72 16 41 2 17 + Entering state 21 + Next token is token ')' () + Reducing stack by rule 70 (line 181): + -> $$ = nterm opt_terms () + Stack now 0 24 72 16 41 2 17 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 24 72 16 41 2 17 + Entering state 42 + Next token is token ')' () + Shifting token ')' () + Entering state 82 + Reducing stack by rule 46 (line 145): + $1 = token '(' () + $2 = nterm compstmt () + $3 = token ')' () + -> $$ = nterm primary () + Stack now 0 24 72 16 41 2 + Entering state 25 + Reading a token: Next token is token '{' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 + Entering state 29 + Next token is token '{' () + Shifting token '{' () + Entering state 75 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 13 + Reading a token: Next token is token '}' () + Reducing stack by rule 45 (line 144): + $1 = token identifier () + -> $$ = nterm primary () + Stack now 0 24 72 16 41 2 29 75 + Entering state 25 + Next token is token '}' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 29 75 + Entering state 24 + Next token is token '}' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 24 72 16 41 2 29 75 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 24 72 16 41 2 29 75 + Entering state 21 + Next token is token '}' () + Reducing stack by rule 70 (line 181): + -> $$ = nterm opt_terms () + Stack now 0 24 72 16 41 2 29 75 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 24 72 16 41 2 29 75 + Entering state 111 + Next token is token '}' () + Shifting token '}' () + Entering state 123 + Reducing stack by rule 35 (line 126): + -> $$ = nterm opt_elsif () + Stack now 0 24 72 16 41 2 29 75 111 123 + Entering state 126 + Reading a token: Next token is token keyword_else () + Shifting token keyword_else () + Entering state 129 + Reading a token: Next token is token '{' () + Shifting token '{' () + Entering state 131 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 13 + Reading a token: Next token is token '(' () + Shifting token '(' () + Entering state 36 + Reading a token: Next token is token ')' () + Reducing stack by rule 39 (line 134): + -> $$ = nterm opt_args () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 131 13 36 + Entering state 77 + Next token is token ')' () + Shifting token ')' () + Entering state 113 + Reducing stack by rule 52 (line 151): + $1 = token identifier () + $2 = token '(' () + $3 = nterm opt_args () + $4 = token ')' () + -> $$ = nterm primary () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 131 + Entering state 25 + Reading a token: Next token is token '}' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 131 + Entering state 24 + Next token is token '}' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 131 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 131 + Entering state 21 + Next token is token '}' () + Reducing stack by rule 70 (line 181): + -> $$ = nterm opt_terms () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 131 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 131 + Entering state 133 + Next token is token '}' () + Shifting token '}' () + Entering state 135 + Reducing stack by rule 38 (line 131): + $1 = nterm opt_elsif () + $2 = token keyword_else () + $3 = token '{' () + $4 = nterm compstmt () + $5 = token '}' () + -> $$ = nterm opt_else () + Stack now 0 24 72 16 41 2 29 75 111 123 + Entering state 127 + Reducing stack by rule 55 (line 154): + $1 = token keyword_if () + $2 = nterm expr () + $3 = token '{' () + $4 = nterm compstmt () + $5 = token '}' () + $6 = nterm opt_else () + -> $$ = nterm primary () + Stack now 0 24 72 16 41 + Entering state 25 + Reading a token: Next token is token '}' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 + Entering state 24 + Next token is token '}' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 24 72 16 41 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 24 72 16 41 + Entering state 21 + Next token is token '}' () + Reducing stack by rule 70 (line 181): + -> $$ = nterm opt_terms () + Stack now 0 24 72 16 41 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 24 72 16 41 + Entering state 81 + Next token is token '}' () + Shifting token '}' () + Entering state 116 + Reducing stack by rule 63 (line 168): + $1 = token '{' () + $2 = nterm bparam () + $3 = nterm compstmt () + $4 = token '}' () + -> $$ = nterm block () + Stack now 0 24 72 + Entering state 26 + Reducing stack by rule 51 (line 150): + $1 = nterm block () + -> $$ = nterm primary () + Stack now 0 24 72 + Entering state 25 + Reading a token: Next token is token op_bar () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 + Entering state 108 + Next token is token op_bar () + Reducing stack by rule 20 (line 109): + $1 = nterm expr () + $2 = token op_bar () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token op_bar () + Shifting token op_bar () + Entering state 72 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 28 + Reading a token: Next token is token '\n' () + Reducing stack by rule 45 (line 144): + $1 = token identifier () + -> $$ = nterm primary () + Stack now 0 24 72 + Entering state 25 + Next token is token '\n' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 + Entering state 108 + Next token is token '\n' () + Reducing stack by rule 20 (line 109): + $1 = nterm expr () + $2 = token op_bar () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token '\n' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 + Entering state 21 + Next token is token '\n' () + Shifting token '\n' () + Entering state 52 + Reducing stack by rule 75 (line 190): + $1 = token '\n' () + -> $$ = nterm term () + Stack now 0 21 + Entering state 55 + Reducing stack by rule 72 (line 185): + $1 = nterm term () + -> $$ = nterm terms () + Stack now 0 21 + Entering state 54 + Reading a token: Now at end of input. + Reducing stack by rule 71 (line 182): + $1 = nterm terms () + -> $$ = nterm opt_terms () + Stack now 0 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 + Entering state 20 + Reducing stack by rule 1 (line 80): + $1 = nterm compstmt () + -> $$ = nterm program () + Stack now 0 + Entering state 19 + Now at end of input. + Stack now 0 19 + Cleanup: popping nterm program () + Syntax OK + +Streem should recognise a block expression with an if statement and return values in a stream: + $ echo 'seq(100) | { |x| if x % 15 == 0 { "FizzBuzz" } else if x % 3 == 0 { "Fizz" } else if x % 5 == 0 { "Buzz" } else { x } } | STDOUT' | $TESTDIR/../bin/streem + Starting parse + Entering state 0 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 13 + Reading a token: Next token is token '(' () + Shifting token '(' () + Entering state 36 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 13 36 + Entering state 25 + Reading a token: Next token is token ')' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 13 36 + Entering state 30 + Next token is token ')' () + Reducing stack by rule 41 (line 138): + $1 = nterm expr () + -> $$ = nterm args () + Stack now 0 13 36 + Entering state 32 + Next token is token ')' () + Reducing stack by rule 40 (line 135): + $1 = nterm args () + -> $$ = nterm opt_args () + Stack now 0 13 36 + Entering state 77 + Next token is token ')' () + Shifting token ')' () + Entering state 113 + Reducing stack by rule 52 (line 151): + $1 = token identifier () + $2 = token '(' () + $3 = nterm opt_args () + $4 = token ')' () + -> $$ = nterm primary () + Stack now 0 + Entering state 25 + Reading a token: Next token is token op_bar () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token op_bar () + Shifting token op_bar () + Entering state 72 + Reading a token: Next token is token '{' () + Shifting token '{' () + Entering state 16 + Reading a token: Next token is token op_bar () + Shifting token op_bar () + Entering state 40 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 79 + Reducing stack by rule 68 (line 177): + $1 = token identifier () + -> $$ = nterm f_args () + Stack now 0 24 72 16 40 + Entering state 80 + Reading a token: Next token is token op_bar () + Shifting token op_bar () + Entering state 114 + Reducing stack by rule 67 (line 174): + $1 = token op_bar () + $2 = nterm f_args () + $3 = token op_bar () + -> $$ = nterm bparam () + Stack now 0 24 72 16 + Entering state 41 + Reading a token: Next token is token keyword_if () + Shifting token keyword_if () + Entering state 2 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 28 + Reading a token: Next token is token op_mod () + Reducing stack by rule 45 (line 144): + $1 = token identifier () + -> $$ = nterm primary () + Stack now 0 24 72 16 41 2 + Entering state 25 + Next token is token op_mod () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 + Entering state 29 + Next token is token op_mod () + Shifting token op_mod () + Entering state 63 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 24 72 16 41 2 29 63 + Entering state 25 + Reading a token: Next token is token op_eq () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 29 63 + Entering state 99 + Reducing stack by rule 19 (line 108): + $1 = nterm expr () + $2 = token op_mod () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 + Entering state 29 + Next token is token op_eq () + Shifting token op_eq () + Entering state 64 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 24 72 16 41 2 29 64 + Entering state 25 + Reading a token: Next token is token '{' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 29 64 + Entering state 100 + Next token is token '{' () + Reducing stack by rule 26 (line 115): + $1 = nterm expr () + $2 = token op_eq () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 + Entering state 29 + Next token is token '{' () + Shifting token '{' () + Entering state 75 + Reading a token: Next token is token lit_string () + Shifting token lit_string () + Entering state 12 + Reducing stack by rule 44 (line 143): + $1 = token lit_string () + -> $$ = nterm primary () + Stack now 0 24 72 16 41 2 29 75 + Entering state 25 + Reading a token: Next token is token '}' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 29 75 + Entering state 24 + Next token is token '}' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 24 72 16 41 2 29 75 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 24 72 16 41 2 29 75 + Entering state 21 + Next token is token '}' () + Reducing stack by rule 70 (line 181): + -> $$ = nterm opt_terms () + Stack now 0 24 72 16 41 2 29 75 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 24 72 16 41 2 29 75 + Entering state 111 + Next token is token '}' () + Shifting token '}' () + Entering state 123 + Reducing stack by rule 35 (line 126): + -> $$ = nterm opt_elsif () + Stack now 0 24 72 16 41 2 29 75 111 123 + Entering state 126 + Reading a token: Next token is token keyword_else () + Shifting token keyword_else () + Entering state 129 + Reading a token: Next token is token keyword_if () + Shifting token keyword_if () + Entering state 130 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 28 + Reading a token: Next token is token op_mod () + Reducing stack by rule 45 (line 144): + $1 = token identifier () + -> $$ = nterm primary () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 + Entering state 25 + Next token is token op_mod () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 + Entering state 132 + Next token is token op_mod () + Shifting token op_mod () + Entering state 63 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 63 + Entering state 25 + Reading a token: Next token is token op_eq () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 63 + Entering state 99 + Reducing stack by rule 19 (line 108): + $1 = nterm expr () + $2 = token op_mod () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 + Entering state 132 + Next token is token op_eq () + Shifting token op_eq () + Entering state 64 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 64 + Entering state 25 + Reading a token: Next token is token '{' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 64 + Entering state 100 + Next token is token '{' () + Reducing stack by rule 26 (line 115): + $1 = nterm expr () + $2 = token op_eq () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 + Entering state 132 + Next token is token '{' () + Shifting token '{' () + Entering state 134 + Reading a token: Next token is token lit_string () + Shifting token lit_string () + Entering state 12 + Reducing stack by rule 44 (line 143): + $1 = token lit_string () + -> $$ = nterm primary () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 134 + Entering state 25 + Reading a token: Next token is token '}' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 134 + Entering state 24 + Next token is token '}' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 134 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 134 + Entering state 21 + Next token is token '}' () + Reducing stack by rule 70 (line 181): + -> $$ = nterm opt_terms () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 134 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 134 + Entering state 136 + Next token is token '}' () + Shifting token '}' () + Entering state 137 + Reducing stack by rule 36 (line 127): + $1 = nterm opt_elsif () + $2 = token keyword_else () + $3 = token keyword_if () + $4 = nterm expr () + $5 = token '{' () + $6 = nterm compstmt () + $7 = token '}' () + -> $$ = nterm opt_elsif () + Stack now 0 24 72 16 41 2 29 75 111 123 + Entering state 126 + Reading a token: Next token is token keyword_else () + Shifting token keyword_else () + Entering state 129 + Reading a token: Next token is token keyword_if () + Shifting token keyword_if () + Entering state 130 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 28 + Reading a token: Next token is token op_mod () + Reducing stack by rule 45 (line 144): + $1 = token identifier () + -> $$ = nterm primary () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 + Entering state 25 + Next token is token op_mod () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 + Entering state 132 + Next token is token op_mod () + Shifting token op_mod () + Entering state 63 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 63 + Entering state 25 + Reading a token: Next token is token op_eq () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 63 + Entering state 99 + Reducing stack by rule 19 (line 108): + $1 = nterm expr () + $2 = token op_mod () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 + Entering state 132 + Next token is token op_eq () + Shifting token op_eq () + Entering state 64 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 64 + Entering state 25 + Reading a token: Next token is token '{' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 64 + Entering state 100 + Next token is token '{' () + Reducing stack by rule 26 (line 115): + $1 = nterm expr () + $2 = token op_eq () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 + Entering state 132 + Next token is token '{' () + Shifting token '{' () + Entering state 134 + Reading a token: Next token is token lit_string () + Shifting token lit_string () + Entering state 12 + Reducing stack by rule 44 (line 143): + $1 = token lit_string () + -> $$ = nterm primary () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 134 + Entering state 25 + Reading a token: Next token is token '}' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 134 + Entering state 24 + Next token is token '}' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 134 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 134 + Entering state 21 + Next token is token '}' () + Reducing stack by rule 70 (line 181): + -> $$ = nterm opt_terms () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 134 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 134 + Entering state 136 + Next token is token '}' () + Shifting token '}' () + Entering state 137 + Reducing stack by rule 36 (line 127): + $1 = nterm opt_elsif () + $2 = token keyword_else () + $3 = token keyword_if () + $4 = nterm expr () + $5 = token '{' () + $6 = nterm compstmt () + $7 = token '}' () + -> $$ = nterm opt_elsif () + Stack now 0 24 72 16 41 2 29 75 111 123 + Entering state 126 + Reading a token: Next token is token keyword_else () + Shifting token keyword_else () + Entering state 129 + Reading a token: Next token is token '{' () + Shifting token '{' () + Entering state 131 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 13 + Reading a token: Next token is token '}' () + Reducing stack by rule 45 (line 144): + $1 = token identifier () + -> $$ = nterm primary () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 131 + Entering state 25 + Next token is token '}' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 131 + Entering state 24 + Next token is token '}' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 131 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 131 + Entering state 21 + Next token is token '}' () + Reducing stack by rule 70 (line 181): + -> $$ = nterm opt_terms () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 131 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 131 + Entering state 133 + Next token is token '}' () + Shifting token '}' () + Entering state 135 + Reducing stack by rule 38 (line 131): + $1 = nterm opt_elsif () + $2 = token keyword_else () + $3 = token '{' () + $4 = nterm compstmt () + $5 = token '}' () + -> $$ = nterm opt_else () + Stack now 0 24 72 16 41 2 29 75 111 123 + Entering state 127 + Reducing stack by rule 55 (line 154): + $1 = token keyword_if () + $2 = nterm expr () + $3 = token '{' () + $4 = nterm compstmt () + $5 = token '}' () + $6 = nterm opt_else () + -> $$ = nterm primary () + Stack now 0 24 72 16 41 + Entering state 25 + Reading a token: Next token is token '}' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 + Entering state 24 + Next token is token '}' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 24 72 16 41 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 24 72 16 41 + Entering state 21 + Next token is token '}' () + Reducing stack by rule 70 (line 181): + -> $$ = nterm opt_terms () + Stack now 0 24 72 16 41 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 24 72 16 41 + Entering state 81 + Next token is token '}' () + Shifting token '}' () + Entering state 116 + Reducing stack by rule 63 (line 168): + $1 = token '{' () + $2 = nterm bparam () + $3 = nterm compstmt () + $4 = token '}' () + -> $$ = nterm block () + Stack now 0 24 72 + Entering state 26 + Reducing stack by rule 51 (line 150): + $1 = nterm block () + -> $$ = nterm primary () + Stack now 0 24 72 + Entering state 25 + Reading a token: Next token is token op_bar () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 + Entering state 108 + Next token is token op_bar () + Reducing stack by rule 20 (line 109): + $1 = nterm expr () + $2 = token op_bar () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token op_bar () + Shifting token op_bar () + Entering state 72 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 28 + Reading a token: Next token is token '\n' () + Reducing stack by rule 45 (line 144): + $1 = token identifier () + -> $$ = nterm primary () + Stack now 0 24 72 + Entering state 25 + Next token is token '\n' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 + Entering state 108 + Next token is token '\n' () + Reducing stack by rule 20 (line 109): + $1 = nterm expr () + $2 = token op_bar () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token '\n' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 + Entering state 21 + Next token is token '\n' () + Shifting token '\n' () + Entering state 52 + Reducing stack by rule 75 (line 190): + $1 = token '\n' () + -> $$ = nterm term () + Stack now 0 21 + Entering state 55 + Reducing stack by rule 72 (line 185): + $1 = nterm term () + -> $$ = nterm terms () + Stack now 0 21 + Entering state 54 + Reading a token: Now at end of input. + Reducing stack by rule 71 (line 182): + $1 = nterm terms () + -> $$ = nterm opt_terms () + Stack now 0 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 + Entering state 20 + Reducing stack by rule 1 (line 80): + $1 = nterm compstmt () + -> $$ = nterm program () + Stack now 0 + Entering state 19 + Now at end of input. + Stack now 0 19 + Cleanup: popping nterm program () + Syntax OK + +Streem should recognise a block expression with a break statement in a stream: + $ echo 'seq(100) | { |x| if x % 15 == 0 { break } else if x % 3 == 0 { "Fizz" } else if x % 5 == 0 { "Buzz" } else { x } } | STDOUT' | $TESTDIR/../bin/streem + Starting parse + Entering state 0 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 13 + Reading a token: Next token is token '(' () + Shifting token '(' () + Entering state 36 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 13 36 + Entering state 25 + Reading a token: Next token is token ')' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 13 36 + Entering state 30 + Next token is token ')' () + Reducing stack by rule 41 (line 138): + $1 = nterm expr () + -> $$ = nterm args () + Stack now 0 13 36 + Entering state 32 + Next token is token ')' () + Reducing stack by rule 40 (line 135): + $1 = nterm args () + -> $$ = nterm opt_args () + Stack now 0 13 36 + Entering state 77 + Next token is token ')' () + Shifting token ')' () + Entering state 113 + Reducing stack by rule 52 (line 151): + $1 = token identifier () + $2 = token '(' () + $3 = nterm opt_args () + $4 = token ')' () + -> $$ = nterm primary () + Stack now 0 + Entering state 25 + Reading a token: Next token is token op_bar () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token op_bar () + Shifting token op_bar () + Entering state 72 + Reading a token: Next token is token '{' () + Shifting token '{' () + Entering state 16 + Reading a token: Next token is token op_bar () + Shifting token op_bar () + Entering state 40 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 79 + Reducing stack by rule 68 (line 177): + $1 = token identifier () + -> $$ = nterm f_args () + Stack now 0 24 72 16 40 + Entering state 80 + Reading a token: Next token is token op_bar () + Shifting token op_bar () + Entering state 114 + Reducing stack by rule 67 (line 174): + $1 = token op_bar () + $2 = nterm f_args () + $3 = token op_bar () + -> $$ = nterm bparam () + Stack now 0 24 72 16 + Entering state 41 + Reading a token: Next token is token keyword_if () + Shifting token keyword_if () + Entering state 2 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 28 + Reading a token: Next token is token op_mod () + Reducing stack by rule 45 (line 144): + $1 = token identifier () + -> $$ = nterm primary () + Stack now 0 24 72 16 41 2 + Entering state 25 + Next token is token op_mod () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 + Entering state 29 + Next token is token op_mod () + Shifting token op_mod () + Entering state 63 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 24 72 16 41 2 29 63 + Entering state 25 + Reading a token: Next token is token op_eq () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 29 63 + Entering state 99 + Reducing stack by rule 19 (line 108): + $1 = nterm expr () + $2 = token op_mod () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 + Entering state 29 + Next token is token op_eq () + Shifting token op_eq () + Entering state 64 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 24 72 16 41 2 29 64 + Entering state 25 + Reading a token: Next token is token '{' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 29 64 + Entering state 100 + Next token is token '{' () + Reducing stack by rule 26 (line 115): + $1 = nterm expr () + $2 = token op_eq () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 + Entering state 29 + Next token is token '{' () + Shifting token '{' () + Entering state 75 + Reading a token: Next token is token keyword_break () + Shifting token keyword_break () + Entering state 3 + Reducing stack by rule 12 (line 97): + $1 = token keyword_break () + -> $$ = nterm stmt () + Stack now 0 24 72 16 41 2 29 75 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 24 72 16 41 2 29 75 + Entering state 21 + Reading a token: Next token is token '}' () + Reducing stack by rule 70 (line 181): + -> $$ = nterm opt_terms () + Stack now 0 24 72 16 41 2 29 75 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 24 72 16 41 2 29 75 + Entering state 111 + Next token is token '}' () + Shifting token '}' () + Entering state 123 + Reducing stack by rule 35 (line 126): + -> $$ = nterm opt_elsif () + Stack now 0 24 72 16 41 2 29 75 111 123 + Entering state 126 + Reading a token: Next token is token keyword_else () + Shifting token keyword_else () + Entering state 129 + Reading a token: Next token is token keyword_if () + Shifting token keyword_if () + Entering state 130 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 28 + Reading a token: Next token is token op_mod () + Reducing stack by rule 45 (line 144): + $1 = token identifier () + -> $$ = nterm primary () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 + Entering state 25 + Next token is token op_mod () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 + Entering state 132 + Next token is token op_mod () + Shifting token op_mod () + Entering state 63 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 63 + Entering state 25 + Reading a token: Next token is token op_eq () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 63 + Entering state 99 + Reducing stack by rule 19 (line 108): + $1 = nterm expr () + $2 = token op_mod () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 + Entering state 132 + Next token is token op_eq () + Shifting token op_eq () + Entering state 64 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 64 + Entering state 25 + Reading a token: Next token is token '{' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 64 + Entering state 100 + Next token is token '{' () + Reducing stack by rule 26 (line 115): + $1 = nterm expr () + $2 = token op_eq () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 + Entering state 132 + Next token is token '{' () + Shifting token '{' () + Entering state 134 + Reading a token: Next token is token lit_string () + Shifting token lit_string () + Entering state 12 + Reducing stack by rule 44 (line 143): + $1 = token lit_string () + -> $$ = nterm primary () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 134 + Entering state 25 + Reading a token: Next token is token '}' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 134 + Entering state 24 + Next token is token '}' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 134 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 134 + Entering state 21 + Next token is token '}' () + Reducing stack by rule 70 (line 181): + -> $$ = nterm opt_terms () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 134 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 134 + Entering state 136 + Next token is token '}' () + Shifting token '}' () + Entering state 137 + Reducing stack by rule 36 (line 127): + $1 = nterm opt_elsif () + $2 = token keyword_else () + $3 = token keyword_if () + $4 = nterm expr () + $5 = token '{' () + $6 = nterm compstmt () + $7 = token '}' () + -> $$ = nterm opt_elsif () + Stack now 0 24 72 16 41 2 29 75 111 123 + Entering state 126 + Reading a token: Next token is token keyword_else () + Shifting token keyword_else () + Entering state 129 + Reading a token: Next token is token keyword_if () + Shifting token keyword_if () + Entering state 130 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 28 + Reading a token: Next token is token op_mod () + Reducing stack by rule 45 (line 144): + $1 = token identifier () + -> $$ = nterm primary () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 + Entering state 25 + Next token is token op_mod () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 + Entering state 132 + Next token is token op_mod () + Shifting token op_mod () + Entering state 63 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 63 + Entering state 25 + Reading a token: Next token is token op_eq () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 63 + Entering state 99 + Reducing stack by rule 19 (line 108): + $1 = nterm expr () + $2 = token op_mod () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 + Entering state 132 + Next token is token op_eq () + Shifting token op_eq () + Entering state 64 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 64 + Entering state 25 + Reading a token: Next token is token '{' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 64 + Entering state 100 + Next token is token '{' () + Reducing stack by rule 26 (line 115): + $1 = nterm expr () + $2 = token op_eq () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 + Entering state 132 + Next token is token '{' () + Shifting token '{' () + Entering state 134 + Reading a token: Next token is token lit_string () + Shifting token lit_string () + Entering state 12 + Reducing stack by rule 44 (line 143): + $1 = token lit_string () + -> $$ = nterm primary () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 134 + Entering state 25 + Reading a token: Next token is token '}' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 134 + Entering state 24 + Next token is token '}' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 134 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 134 + Entering state 21 + Next token is token '}' () + Reducing stack by rule 70 (line 181): + -> $$ = nterm opt_terms () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 134 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 130 132 134 + Entering state 136 + Next token is token '}' () + Shifting token '}' () + Entering state 137 + Reducing stack by rule 36 (line 127): + $1 = nterm opt_elsif () + $2 = token keyword_else () + $3 = token keyword_if () + $4 = nterm expr () + $5 = token '{' () + $6 = nterm compstmt () + $7 = token '}' () + -> $$ = nterm opt_elsif () + Stack now 0 24 72 16 41 2 29 75 111 123 + Entering state 126 + Reading a token: Next token is token keyword_else () + Shifting token keyword_else () + Entering state 129 + Reading a token: Next token is token '{' () + Shifting token '{' () + Entering state 131 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 13 + Reading a token: Next token is token '}' () + Reducing stack by rule 45 (line 144): + $1 = token identifier () + -> $$ = nterm primary () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 131 + Entering state 25 + Next token is token '}' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 131 + Entering state 24 + Next token is token '}' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 131 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 131 + Entering state 21 + Next token is token '}' () + Reducing stack by rule 70 (line 181): + -> $$ = nterm opt_terms () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 131 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 24 72 16 41 2 29 75 111 123 126 129 131 + Entering state 133 + Next token is token '}' () + Shifting token '}' () + Entering state 135 + Reducing stack by rule 38 (line 131): + $1 = nterm opt_elsif () + $2 = token keyword_else () + $3 = token '{' () + $4 = nterm compstmt () + $5 = token '}' () + -> $$ = nterm opt_else () + Stack now 0 24 72 16 41 2 29 75 111 123 + Entering state 127 + Reducing stack by rule 55 (line 154): + $1 = token keyword_if () + $2 = nterm expr () + $3 = token '{' () + $4 = nterm compstmt () + $5 = token '}' () + $6 = nterm opt_else () + -> $$ = nterm primary () + Stack now 0 24 72 16 41 + Entering state 25 + Reading a token: Next token is token '}' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 16 41 + Entering state 24 + Next token is token '}' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 24 72 16 41 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 24 72 16 41 + Entering state 21 + Next token is token '}' () + Reducing stack by rule 70 (line 181): + -> $$ = nterm opt_terms () + Stack now 0 24 72 16 41 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 24 72 16 41 + Entering state 81 + Next token is token '}' () + Shifting token '}' () + Entering state 116 + Reducing stack by rule 63 (line 168): + $1 = token '{' () + $2 = nterm bparam () + $3 = nterm compstmt () + $4 = token '}' () + -> $$ = nterm block () + Stack now 0 24 72 + Entering state 26 + Reducing stack by rule 51 (line 150): + $1 = nterm block () + -> $$ = nterm primary () + Stack now 0 24 72 + Entering state 25 + Reading a token: Next token is token op_bar () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 + Entering state 108 + Next token is token op_bar () + Reducing stack by rule 20 (line 109): + $1 = nterm expr () + $2 = token op_bar () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token op_bar () + Shifting token op_bar () + Entering state 72 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 28 + Reading a token: Next token is token '\n' () + Reducing stack by rule 45 (line 144): + $1 = token identifier () + -> $$ = nterm primary () + Stack now 0 24 72 + Entering state 25 + Next token is token '\n' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 72 + Entering state 108 + Next token is token '\n' () + Reducing stack by rule 20 (line 109): + $1 = nterm expr () + $2 = token op_bar () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token '\n' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 + Entering state 21 + Next token is token '\n' () + Shifting token '\n' () + Entering state 52 + Reducing stack by rule 75 (line 190): + $1 = token '\n' () + -> $$ = nterm term () + Stack now 0 21 + Entering state 55 + Reducing stack by rule 72 (line 185): + $1 = nterm term () + -> $$ = nterm terms () + Stack now 0 21 + Entering state 54 + Reading a token: Now at end of input. + Reducing stack by rule 71 (line 182): + $1 = nterm terms () + -> $$ = nterm opt_terms () + Stack now 0 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 + Entering state 20 + Reducing stack by rule 1 (line 80): + $1 = nterm compstmt () + -> $$ = nterm program () + Stack now 0 + Entering state 19 + Now at end of input. + Stack now 0 19 + Cleanup: popping nterm program () + Syntax OK + +Streem should recognise nil: + $ echo 'nil' | $TESTDIR/../bin/streem + Starting parse + Entering state 0 + Reading a token: Next token is token keyword_nil () + Shifting token keyword_nil () + Entering state 6 + Reducing stack by rule 56 (line 155): + $1 = token keyword_nil () + -> $$ = nterm primary () + Stack now 0 + Entering state 25 + Reading a token: Now at end of input. + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Now at end of input. + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 + Entering state 21 + Now at end of input. + Reducing stack by rule 70 (line 181): + -> $$ = nterm opt_terms () + Stack now 0 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 + Entering state 20 + Reducing stack by rule 1 (line 80): + $1 = nterm compstmt () + -> $$ = nterm program () + Stack now 0 + Entering state 19 + Now at end of input. + Stack now 0 19 + Cleanup: popping nterm program () + Syntax OK + +Streem should recognise true: + $ echo 'true' | $TESTDIR/../bin/streem + Starting parse + Entering state 0 + Reading a token: Next token is token keyword_true () + Shifting token keyword_true () + Entering state 7 + Reducing stack by rule 57 (line 156): + $1 = token keyword_true () + -> $$ = nterm primary () + Stack now 0 + Entering state 25 + Reading a token: Now at end of input. + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Now at end of input. + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 + Entering state 21 + Now at end of input. + Reducing stack by rule 70 (line 181): + -> $$ = nterm opt_terms () + Stack now 0 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 + Entering state 20 + Reducing stack by rule 1 (line 80): + $1 = nterm compstmt () + -> $$ = nterm program () + Stack now 0 + Entering state 19 + Now at end of input. + Stack now 0 19 + Cleanup: popping nterm program () + Syntax OK + +Streem should recognise false: + $ echo 'false' | $TESTDIR/../bin/streem + Starting parse + Entering state 0 + Reading a token: Next token is token keyword_false () + Shifting token keyword_false () + Entering state 8 + Reducing stack by rule 58 (line 157): + $1 = token keyword_false () + -> $$ = nterm primary () + Stack now 0 + Entering state 25 + Reading a token: Now at end of input. + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Now at end of input. + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 + Entering state 21 + Now at end of input. + Reducing stack by rule 70 (line 181): + -> $$ = nterm opt_terms () + Stack now 0 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 + Entering state 20 + Reducing stack by rule 1 (line 80): + $1 = nterm compstmt () + -> $$ = nterm program () + Stack now 0 + Entering state 19 + Now at end of input. + Stack now 0 19 + Cleanup: popping nterm program () + Syntax OK + +Streem should recognise a literal string: + $ echo '"It works!!"' | $TESTDIR/../bin/streem + Starting parse + Entering state 0 + Reading a token: Next token is token lit_string () + Shifting token lit_string () + Entering state 12 + Reducing stack by rule 44 (line 143): + $1 = token lit_string () + -> $$ = nterm primary () + Stack now 0 + Entering state 25 + Reading a token: Next token is token '\n' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token '\n' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 + Entering state 21 + Next token is token '\n' () + Shifting token '\n' () + Entering state 52 + Reducing stack by rule 75 (line 190): + $1 = token '\n' () + -> $$ = nterm term () + Stack now 0 21 + Entering state 55 + Reducing stack by rule 72 (line 185): + $1 = nterm term () + -> $$ = nterm terms () + Stack now 0 21 + Entering state 54 + Reading a token: Now at end of input. + Reducing stack by rule 71 (line 182): + $1 = nterm terms () + -> $$ = nterm opt_terms () + Stack now 0 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 + Entering state 20 + Reducing stack by rule 1 (line 80): + $1 = nterm compstmt () + -> $$ = nterm program () + Stack now 0 + Entering state 19 + Now at end of input. + Stack now 0 19 + Cleanup: popping nterm program () + Syntax OK + +Streem should recognise a variable assignment using <-: + $ echo 'foo <- 1' | $TESTDIR/../bin/streem + Starting parse + Entering state 0 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 13 + Reading a token: Next token is token op_lasgn () + Reducing stack by rule 14 (line 101): + $1 = token identifier () + -> $$ = nterm var () + Stack now 0 + Entering state 23 + Next token is token op_lasgn () + Shifting token op_lasgn () + Entering state 56 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 23 56 + Entering state 25 + Reading a token: Next token is token '\n' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 23 56 + Entering state 91 + Next token is token '\n' () + Reducing stack by rule 8 (line 93): + $1 = nterm var () + $2 = token op_lasgn () + $3 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 + Entering state 21 + Next token is token '\n' () + Shifting token '\n' () + Entering state 52 + Reducing stack by rule 75 (line 190): + $1 = token '\n' () + -> $$ = nterm term () + Stack now 0 21 + Entering state 55 + Reducing stack by rule 72 (line 185): + $1 = nterm term () + -> $$ = nterm terms () + Stack now 0 21 + Entering state 54 + Reading a token: Now at end of input. + Reducing stack by rule 71 (line 182): + $1 = nterm terms () + -> $$ = nterm opt_terms () + Stack now 0 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 + Entering state 20 + Reducing stack by rule 1 (line 80): + $1 = nterm compstmt () + -> $$ = nterm program () + Stack now 0 + Entering state 19 + Now at end of input. + Stack now 0 19 + Cleanup: popping nterm program () + Syntax OK + +Streem should recognise a variable assignment using ->: + $ echo '1 -> foo' | $TESTDIR/../bin/streem + Starting parse + Entering state 0 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 + Entering state 25 + Reading a token: Next token is token op_rasgn () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token op_rasgn () + Shifting token op_rasgn () + Entering state 58 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 93 + Reducing stack by rule 14 (line 101): + $1 = token identifier () + -> $$ = nterm var () + Stack now 0 24 58 + Entering state 94 + Reducing stack by rule 9 (line 94): + $1 = nterm expr () + $2 = token op_rasgn () + $3 = nterm var () + -> $$ = nterm stmt () + Stack now 0 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 + Entering state 21 + Reading a token: Next token is token '\n' () + Shifting token '\n' () + Entering state 52 + Reducing stack by rule 75 (line 190): + $1 = token '\n' () + -> $$ = nterm term () + Stack now 0 21 + Entering state 55 + Reducing stack by rule 72 (line 185): + $1 = nterm term () + -> $$ = nterm terms () + Stack now 0 21 + Entering state 54 + Reading a token: Now at end of input. + Reducing stack by rule 71 (line 182): + $1 = nterm terms () + -> $$ = nterm opt_terms () + Stack now 0 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 + Entering state 20 + Reducing stack by rule 1 (line 80): + $1 = nterm compstmt () + -> $$ = nterm program () + Stack now 0 + Entering state 19 + Now at end of input. + Stack now 0 19 + Cleanup: popping nterm program () + Syntax OK + +Streem should recognise a variable assignment using =: + $ echo 'foo = 1' | $TESTDIR/../bin/streem + Starting parse + Entering state 0 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 13 + Reading a token: Next token is token '=' () + Reducing stack by rule 14 (line 101): + $1 = token identifier () + -> $$ = nterm var () + Stack now 0 + Entering state 23 + Next token is token '=' () + Shifting token '=' () + Entering state 57 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 23 57 + Entering state 25 + Reading a token: Next token is token '\n' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 23 57 + Entering state 92 + Next token is token '\n' () + Reducing stack by rule 7 (line 92): + $1 = nterm var () + $2 = token '=' () + $3 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 + Entering state 21 + Next token is token '\n' () + Shifting token '\n' () + Entering state 52 + Reducing stack by rule 75 (line 190): + $1 = token '\n' () + -> $$ = nterm term () + Stack now 0 21 + Entering state 55 + Reducing stack by rule 72 (line 185): + $1 = nterm term () + -> $$ = nterm terms () + Stack now 0 21 + Entering state 54 + Reading a token: Now at end of input. + Reducing stack by rule 71 (line 182): + $1 = nterm terms () + -> $$ = nterm opt_terms () + Stack now 0 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 + Entering state 20 + Reducing stack by rule 1 (line 80): + $1 = nterm compstmt () + -> $$ = nterm program () + Stack now 0 + Entering state 19 + Now at end of input. + Stack now 0 19 + Cleanup: popping nterm program () + Syntax OK + +Streem should recognise return statement in lambda: + $ echo '{ |x| return x + 1 }' | $TESTDIR/../bin/streem + Starting parse + Entering state 0 + Reading a token: Next token is token '{' () + Shifting token '{' () + Entering state 16 + Reading a token: Next token is token op_bar () + Shifting token op_bar () + Entering state 40 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 79 + Reducing stack by rule 68 (line 177): + $1 = token identifier () + -> $$ = nterm f_args () + Stack now 0 16 40 + Entering state 80 + Reading a token: Next token is token op_bar () + Shifting token op_bar () + Entering state 114 + Reducing stack by rule 67 (line 174): + $1 = token op_bar () + $2 = nterm f_args () + $3 = token op_bar () + -> $$ = nterm bparam () + Stack now 0 16 + Entering state 41 + Reading a token: Next token is token keyword_return () + Shifting token keyword_return () + Entering state 5 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 28 + Reading a token: Next token is token op_plus () + Reducing stack by rule 45 (line 144): + $1 = token identifier () + -> $$ = nterm primary () + Stack now 0 16 41 5 + Entering state 25 + Next token is token op_plus () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 16 41 5 + Entering state 30 + Next token is token op_plus () + Shifting token op_plus () + Entering state 59 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 16 41 5 30 59 + Entering state 25 + Reading a token: Next token is token '}' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 16 41 5 30 59 + Entering state 95 + Next token is token '}' () + Reducing stack by rule 15 (line 104): + $1 = nterm expr () + $2 = token op_plus () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 16 41 5 + Entering state 30 + Next token is token '}' () + Reducing stack by rule 41 (line 138): + $1 = nterm expr () + -> $$ = nterm args () + Stack now 0 16 41 5 + Entering state 32 + Next token is token '}' () + Reducing stack by rule 40 (line 135): + $1 = nterm args () + -> $$ = nterm opt_args () + Stack now 0 16 41 5 + Entering state 33 + Reducing stack by rule 11 (line 96): + $1 = token keyword_return () + $2 = nterm opt_args () + -> $$ = nterm stmt () + Stack now 0 16 41 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 16 41 + Entering state 21 + Next token is token '}' () + Reducing stack by rule 70 (line 181): + -> $$ = nterm opt_terms () + Stack now 0 16 41 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 16 41 + Entering state 81 + Next token is token '}' () + Shifting token '}' () + Entering state 116 + Reducing stack by rule 63 (line 168): + $1 = token '{' () + $2 = nterm bparam () + $3 = nterm compstmt () + $4 = token '}' () + -> $$ = nterm block () + Stack now 0 + Entering state 26 + Reducing stack by rule 51 (line 150): + $1 = nterm block () + -> $$ = nterm primary () + Stack now 0 + Entering state 25 + Reading a token: Next token is token '\n' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token '\n' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 + Entering state 21 + Next token is token '\n' () + Shifting token '\n' () + Entering state 52 + Reducing stack by rule 75 (line 190): + $1 = token '\n' () + -> $$ = nterm term () + Stack now 0 21 + Entering state 55 + Reducing stack by rule 72 (line 185): + $1 = nterm term () + -> $$ = nterm terms () + Stack now 0 21 + Entering state 54 + Reading a token: Now at end of input. + Reducing stack by rule 71 (line 182): + $1 = nterm terms () + -> $$ = nterm opt_terms () + Stack now 0 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 + Entering state 20 + Reducing stack by rule 1 (line 80): + $1 = nterm compstmt () + -> $$ = nterm program () + Stack now 0 + Entering state 19 + Now at end of input. + Stack now 0 19 + Cleanup: popping nterm program () + Syntax OK + +Streem should recognise basic math: + $ echo '((x + 1) * (9 / 3)) % 10' | $TESTDIR/../bin/streem + Starting parse + Entering state 0 + Reading a token: Next token is token '(' () + Shifting token '(' () + Entering state 17 + Reading a token: Next token is token '(' () + Shifting token '(' () + Entering state 17 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 13 + Reading a token: Next token is token op_plus () + Reducing stack by rule 45 (line 144): + $1 = token identifier () + -> $$ = nterm primary () + Stack now 0 17 17 + Entering state 25 + Next token is token op_plus () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 17 17 + Entering state 24 + Next token is token op_plus () + Shifting token op_plus () + Entering state 59 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 17 17 24 59 + Entering state 25 + Reading a token: Next token is token ')' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 17 17 24 59 + Entering state 95 + Next token is token ')' () + Reducing stack by rule 15 (line 104): + $1 = nterm expr () + $2 = token op_plus () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 17 17 + Entering state 24 + Next token is token ')' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 17 17 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 17 17 + Entering state 21 + Next token is token ')' () + Reducing stack by rule 70 (line 181): + -> $$ = nterm opt_terms () + Stack now 0 17 17 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 17 17 + Entering state 42 + Next token is token ')' () + Shifting token ')' () + Entering state 82 + Reducing stack by rule 46 (line 145): + $1 = token '(' () + $2 = nterm compstmt () + $3 = token ')' () + -> $$ = nterm primary () + Stack now 0 17 + Entering state 25 + Reading a token: Next token is token op_mult () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 17 + Entering state 24 + Next token is token op_mult () + Shifting token op_mult () + Entering state 61 + Reading a token: Next token is token '(' () + Shifting token '(' () + Entering state 17 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 17 24 61 17 + Entering state 25 + Reading a token: Next token is token op_div () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 17 24 61 17 + Entering state 24 + Next token is token op_div () + Shifting token op_div () + Entering state 62 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 17 24 61 17 24 62 + Entering state 25 + Reading a token: Next token is token ')' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 17 24 61 17 24 62 + Entering state 98 + Reducing stack by rule 18 (line 107): + $1 = nterm expr () + $2 = token op_div () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 17 24 61 17 + Entering state 24 + Next token is token ')' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 17 24 61 17 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 17 24 61 17 + Entering state 21 + Next token is token ')' () + Reducing stack by rule 70 (line 181): + -> $$ = nterm opt_terms () + Stack now 0 17 24 61 17 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 17 24 61 17 + Entering state 42 + Next token is token ')' () + Shifting token ')' () + Entering state 82 + Reducing stack by rule 46 (line 145): + $1 = token '(' () + $2 = nterm compstmt () + $3 = token ')' () + -> $$ = nterm primary () + Stack now 0 17 24 61 + Entering state 25 + Reading a token: Next token is token ')' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 17 24 61 + Entering state 97 + Reducing stack by rule 17 (line 106): + $1 = nterm expr () + $2 = token op_mult () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 17 + Entering state 24 + Next token is token ')' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 17 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 17 + Entering state 21 + Next token is token ')' () + Reducing stack by rule 70 (line 181): + -> $$ = nterm opt_terms () + Stack now 0 17 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 17 + Entering state 42 + Next token is token ')' () + Shifting token ')' () + Entering state 82 + Reducing stack by rule 46 (line 145): + $1 = token '(' () + $2 = nterm compstmt () + $3 = token ')' () + -> $$ = nterm primary () + Stack now 0 + Entering state 25 + Reading a token: Next token is token op_mod () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token op_mod () + Shifting token op_mod () + Entering state 63 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 24 63 + Entering state 25 + Reading a token: Next token is token '\n' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 24 63 + Entering state 99 + Reducing stack by rule 19 (line 108): + $1 = nterm expr () + $2 = token op_mod () + $3 = nterm expr () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token '\n' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 + Entering state 21 + Next token is token '\n' () + Shifting token '\n' () + Entering state 52 + Reducing stack by rule 75 (line 190): + $1 = token '\n' () + -> $$ = nterm term () + Stack now 0 21 + Entering state 55 + Reducing stack by rule 72 (line 185): + $1 = nterm term () + -> $$ = nterm terms () + Stack now 0 21 + Entering state 54 + Reading a token: Now at end of input. + Reducing stack by rule 71 (line 182): + $1 = nterm terms () + -> $$ = nterm opt_terms () + Stack now 0 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 + Entering state 20 + Reducing stack by rule 1 (line 80): + $1 = nterm compstmt () + -> $$ = nterm program () + Stack now 0 + Entering state 19 + Now at end of input. + Stack now 0 19 + Cleanup: popping nterm program () + Syntax OK + +Streem should recognise lists: + $ echo '[1, 2, 3, 4]' | $TESTDIR/../bin/streem + Starting parse + Entering state 0 + Reading a token: Next token is token '[' () + Shifting token '[' () + Entering state 18 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 18 + Entering state 25 + Reading a token: Next token is token ',' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 18 + Entering state 30 + Next token is token ',' () + Reducing stack by rule 41 (line 138): + $1 = nterm expr () + -> $$ = nterm args () + Stack now 0 18 + Entering state 47 + Next token is token ',' () + Shifting token ',' () + Entering state 76 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 18 47 76 + Entering state 25 + Reading a token: Next token is token ',' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 18 47 76 + Entering state 112 + Next token is token ',' () + Reducing stack by rule 42 (line 139): + $1 = nterm args () + $2 = token ',' () + $3 = nterm expr () + -> $$ = nterm args () + Stack now 0 18 + Entering state 47 + Next token is token ',' () + Shifting token ',' () + Entering state 76 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 18 47 76 + Entering state 25 + Reading a token: Next token is token ',' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 18 47 76 + Entering state 112 + Next token is token ',' () + Reducing stack by rule 42 (line 139): + $1 = nterm args () + $2 = token ',' () + $3 = nterm expr () + -> $$ = nterm args () + Stack now 0 18 + Entering state 47 + Next token is token ',' () + Shifting token ',' () + Entering state 76 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 18 47 76 + Entering state 25 + Reading a token: Next token is token ']' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 18 47 76 + Entering state 112 + Next token is token ']' () + Reducing stack by rule 42 (line 139): + $1 = nterm args () + $2 = token ',' () + $3 = nterm expr () + -> $$ = nterm args () + Stack now 0 18 + Entering state 47 + Next token is token ']' () + Shifting token ']' () + Entering state 86 + Reducing stack by rule 47 (line 146): + $1 = token '[' () + $2 = nterm args () + $3 = token ']' () + -> $$ = nterm primary () + Stack now 0 + Entering state 25 + Reading a token: Next token is token '\n' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token '\n' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 + Entering state 21 + Next token is token '\n' () + Shifting token '\n' () + Entering state 52 + Reducing stack by rule 75 (line 190): + $1 = token '\n' () + -> $$ = nterm term () + Stack now 0 21 + Entering state 55 + Reducing stack by rule 72 (line 185): + $1 = nterm term () + -> $$ = nterm terms () + Stack now 0 21 + Entering state 54 + Reading a token: Now at end of input. + Reducing stack by rule 71 (line 182): + $1 = nterm terms () + -> $$ = nterm opt_terms () + Stack now 0 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 + Entering state 20 + Reducing stack by rule 1 (line 80): + $1 = nterm compstmt () + -> $$ = nterm program () + Stack now 0 + Entering state 19 + Now at end of input. + Stack now 0 19 + Cleanup: popping nterm program () + Syntax OK + +Streem should recognise funciton calls: + $ echo 'fnc(1, 2, 3)' | $TESTDIR/../bin/streem + Starting parse + Entering state 0 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 13 + Reading a token: Next token is token '(' () + Shifting token '(' () + Entering state 36 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 13 36 + Entering state 25 + Reading a token: Next token is token ',' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 13 36 + Entering state 30 + Next token is token ',' () + Reducing stack by rule 41 (line 138): + $1 = nterm expr () + -> $$ = nterm args () + Stack now 0 13 36 + Entering state 32 + Next token is token ',' () + Shifting token ',' () + Entering state 76 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 13 36 32 76 + Entering state 25 + Reading a token: Next token is token ',' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 13 36 32 76 + Entering state 112 + Next token is token ',' () + Reducing stack by rule 42 (line 139): + $1 = nterm args () + $2 = token ',' () + $3 = nterm expr () + -> $$ = nterm args () + Stack now 0 13 36 + Entering state 32 + Next token is token ',' () + Shifting token ',' () + Entering state 76 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 13 36 32 76 + Entering state 25 + Reading a token: Next token is token ')' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 13 36 32 76 + Entering state 112 + Next token is token ')' () + Reducing stack by rule 42 (line 139): + $1 = nterm args () + $2 = token ',' () + $3 = nterm expr () + -> $$ = nterm args () + Stack now 0 13 36 + Entering state 32 + Next token is token ')' () + Reducing stack by rule 40 (line 135): + $1 = nterm args () + -> $$ = nterm opt_args () + Stack now 0 13 36 + Entering state 77 + Next token is token ')' () + Shifting token ')' () + Entering state 113 + Reducing stack by rule 52 (line 151): + $1 = token identifier () + $2 = token '(' () + $3 = nterm opt_args () + $4 = token ')' () + -> $$ = nterm primary () + Stack now 0 + Entering state 25 + Reading a token: Next token is token '\n' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token '\n' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 + Entering state 21 + Next token is token '\n' () + Shifting token '\n' () + Entering state 52 + Reducing stack by rule 75 (line 190): + $1 = token '\n' () + -> $$ = nterm term () + Stack now 0 21 + Entering state 55 + Reducing stack by rule 72 (line 185): + $1 = nterm term () + -> $$ = nterm terms () + Stack now 0 21 + Entering state 54 + Reading a token: Now at end of input. + Reducing stack by rule 71 (line 182): + $1 = nterm terms () + -> $$ = nterm opt_terms () + Stack now 0 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 + Entering state 20 + Reducing stack by rule 1 (line 80): + $1 = nterm compstmt () + -> $$ = nterm program () + Stack now 0 + Entering state 19 + Now at end of input. + Stack now 0 19 + Cleanup: popping nterm program () + Syntax OK + +Streem should recognise method calls: + $ echo 'obj.meth(1, 2, 3)' | $TESTDIR/../bin/streem + Starting parse + Entering state 0 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 13 + Reading a token: Next token is token '.' () + Reducing stack by rule 45 (line 144): + $1 = token identifier () + -> $$ = nterm primary () + Stack now 0 + Entering state 25 + Next token is token '.' () + Shifting token '.' () + Entering state 74 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 110 + Reading a token: Next token is token '(' () + Shifting token '(' () + Entering state 122 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 25 74 110 122 + Entering state 25 + Reading a token: Next token is token ',' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 25 74 110 122 + Entering state 30 + Next token is token ',' () + Reducing stack by rule 41 (line 138): + $1 = nterm expr () + -> $$ = nterm args () + Stack now 0 25 74 110 122 + Entering state 32 + Next token is token ',' () + Shifting token ',' () + Entering state 76 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 25 74 110 122 32 76 + Entering state 25 + Reading a token: Next token is token ',' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 25 74 110 122 32 76 + Entering state 112 + Next token is token ',' () + Reducing stack by rule 42 (line 139): + $1 = nterm args () + $2 = token ',' () + $3 = nterm expr () + -> $$ = nterm args () + Stack now 0 25 74 110 122 + Entering state 32 + Next token is token ',' () + Shifting token ',' () + Entering state 76 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 25 74 110 122 32 76 + Entering state 25 + Reading a token: Next token is token ')' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 25 74 110 122 32 76 + Entering state 112 + Next token is token ')' () + Reducing stack by rule 42 (line 139): + $1 = nterm args () + $2 = token ',' () + $3 = nterm expr () + -> $$ = nterm args () + Stack now 0 25 74 110 122 + Entering state 32 + Next token is token ')' () + Reducing stack by rule 40 (line 135): + $1 = nterm args () + -> $$ = nterm opt_args () + Stack now 0 25 74 110 122 + Entering state 125 + Next token is token ')' () + Shifting token ')' () + Entering state 128 + Reducing stack by rule 53 (line 152): + $1 = nterm primary () + $2 = token '.' () + $3 = token identifier () + $4 = token '(' () + $5 = nterm opt_args () + $6 = token ')' () + -> $$ = nterm primary () + Stack now 0 + Entering state 25 + Reading a token: Next token is token '\n' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token '\n' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 + Entering state 21 + Next token is token '\n' () + Shifting token '\n' () + Entering state 52 + Reducing stack by rule 75 (line 190): + $1 = token '\n' () + -> $$ = nterm term () + Stack now 0 21 + Entering state 55 + Reducing stack by rule 72 (line 185): + $1 = nterm term () + -> $$ = nterm terms () + Stack now 0 21 + Entering state 54 + Reading a token: Now at end of input. + Reducing stack by rule 71 (line 182): + $1 = nterm terms () + -> $$ = nterm opt_terms () + Stack now 0 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 + Entering state 20 + Reducing stack by rule 1 (line 80): + $1 = nterm compstmt () + -> $$ = nterm program () + Stack now 0 + Entering state 19 + Now at end of input. + Stack now 0 19 + Cleanup: popping nterm program () + Syntax OK + +Streem should recognise map: + $ echo '[ "foo": 1, "bar": "BAZ" ]' | $TESTDIR/../bin/streem + Starting parse + Entering state 0 + Reading a token: Next token is token '[' () + Shifting token '[' () + Entering state 18 + Reading a token: Next token is token lit_string () + Shifting token lit_string () + Entering state 43 + Reading a token: Next token is token ':' () + Shifting token ':' () + Entering state 83 + Reading a token: Next token is token lit_number () + Shifting token lit_number () + Entering state 11 + Reducing stack by rule 43 (line 142): + $1 = token lit_number () + -> $$ = nterm primary () + Stack now 0 18 43 83 + Entering state 25 + Reading a token: Next token is token ',' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 18 43 83 + Entering state 117 + Next token is token ',' () + Reducing stack by rule 59 (line 160): + $1 = token lit_string () + $2 = token ':' () + $3 = nterm expr () + -> $$ = nterm map () + Stack now 0 18 + Entering state 48 + Reducing stack by rule 61 (line 164): + $1 = nterm map () + -> $$ = nterm map_args () + Stack now 0 18 + Entering state 49 + Next token is token ',' () + Shifting token ',' () + Entering state 87 + Reading a token: Next token is token lit_string () + Shifting token lit_string () + Entering state 119 + Reading a token: Next token is token ':' () + Shifting token ':' () + Entering state 83 + Reading a token: Next token is token lit_string () + Shifting token lit_string () + Entering state 12 + Reducing stack by rule 44 (line 143): + $1 = token lit_string () + -> $$ = nterm primary () + Stack now 0 18 49 87 119 83 + Entering state 25 + Reading a token: Next token is token ']' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 18 49 87 119 83 + Entering state 117 + Next token is token ']' () + Reducing stack by rule 59 (line 160): + $1 = token lit_string () + $2 = token ':' () + $3 = nterm expr () + -> $$ = nterm map () + Stack now 0 18 49 87 + Entering state 121 + Reducing stack by rule 62 (line 165): + $1 = nterm map_args () + $2 = token ',' () + $3 = nterm map () + -> $$ = nterm map_args () + Stack now 0 18 + Entering state 49 + Next token is token ']' () + Shifting token ']' () + Entering state 88 + Reducing stack by rule 49 (line 148): + $1 = token '[' () + $2 = nterm map_args () + $3 = token ']' () + -> $$ = nterm primary () + Stack now 0 + Entering state 25 + Reading a token: Next token is token '\n' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token '\n' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 + Entering state 21 + Next token is token '\n' () + Shifting token '\n' () + Entering state 52 + Reducing stack by rule 75 (line 190): + $1 = token '\n' () + -> $$ = nterm term () + Stack now 0 21 + Entering state 55 + Reducing stack by rule 72 (line 185): + $1 = nterm term () + -> $$ = nterm terms () + Stack now 0 21 + Entering state 54 + Reading a token: Now at end of input. + Reducing stack by rule 71 (line 182): + $1 = nterm terms () + -> $$ = nterm opt_terms () + Stack now 0 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 + Entering state 20 + Reducing stack by rule 1 (line 80): + $1 = nterm compstmt () + -> $$ = nterm program () + Stack now 0 + Entering state 19 + Now at end of input. + Stack now 0 19 + Cleanup: popping nterm program () + Syntax OK + +Streem should recognise empty map: + $ echo '[ : ]' | $TESTDIR/../bin/streem + Starting parse + Entering state 0 + Reading a token: Next token is token '[' () + Shifting token '[' () + Entering state 18 + Reading a token: Next token is token ':' () + Shifting token ':' () + Entering state 46 + Reading a token: Next token is token ']' () + Shifting token ']' () + Entering state 85 + Reducing stack by rule 50 (line 149): + $1 = token '[' () + $2 = token ':' () + $3 = token ']' () + -> $$ = nterm primary () + Stack now 0 + Entering state 25 + Reading a token: Next token is token '\n' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token '\n' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 + Entering state 21 + Next token is token '\n' () + Shifting token '\n' () + Entering state 52 + Reducing stack by rule 75 (line 190): + $1 = token '\n' () + -> $$ = nterm term () + Stack now 0 21 + Entering state 55 + Reducing stack by rule 72 (line 185): + $1 = nterm term () + -> $$ = nterm terms () + Stack now 0 21 + Entering state 54 + Reading a token: Now at end of input. + Reducing stack by rule 71 (line 182): + $1 = nterm terms () + -> $$ = nterm opt_terms () + Stack now 0 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 + Entering state 20 + Reducing stack by rule 1 (line 80): + $1 = nterm compstmt () + -> $$ = nterm program () + Stack now 0 + Entering state 19 + Now at end of input. + Stack now 0 19 + Cleanup: popping nterm program () + Syntax OK + +Streem should recognise empty array: + $ echo '[ ]' | $TESTDIR/../bin/streem + Starting parse + Entering state 0 + Reading a token: Next token is token '[' () + Shifting token '[' () + Entering state 18 + Reading a token: Next token is token ']' () + Shifting token ']' () + Entering state 45 + Reducing stack by rule 48 (line 147): + $1 = token '[' () + $2 = token ']' () + -> $$ = nterm primary () + Stack now 0 + Entering state 25 + Reading a token: Next token is token '\n' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token '\n' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 + Entering state 21 + Next token is token '\n' () + Shifting token '\n' () + Entering state 52 + Reducing stack by rule 75 (line 190): + $1 = token '\n' () + -> $$ = nterm term () + Stack now 0 21 + Entering state 55 + Reducing stack by rule 72 (line 185): + $1 = nterm term () + -> $$ = nterm terms () + Stack now 0 21 + Entering state 54 + Reading a token: Now at end of input. + Reducing stack by rule 71 (line 182): + $1 = nterm terms () + -> $$ = nterm opt_terms () + Stack now 0 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 + Entering state 20 + Reducing stack by rule 1 (line 80): + $1 = nterm compstmt () + -> $$ = nterm program () + Stack now 0 + Entering state 19 + Now at end of input. + Stack now 0 19 + Cleanup: popping nterm program () + Syntax OK + +Streem should recognise multiple statements on one line: + $ echo 'puts("foo"); true' | $TESTDIR/../bin/streem + Starting parse + Entering state 0 + Reading a token: Next token is token identifier () + Shifting token identifier () + Entering state 13 + Reading a token: Next token is token '(' () + Shifting token '(' () + Entering state 36 + Reading a token: Next token is token lit_string () + Shifting token lit_string () + Entering state 12 + Reducing stack by rule 44 (line 143): + $1 = token lit_string () + -> $$ = nterm primary () + Stack now 0 13 36 + Entering state 25 + Reading a token: Next token is token ')' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 13 36 + Entering state 30 + Next token is token ')' () + Reducing stack by rule 41 (line 138): + $1 = nterm expr () + -> $$ = nterm args () + Stack now 0 13 36 + Entering state 32 + Next token is token ')' () + Reducing stack by rule 40 (line 135): + $1 = nterm args () + -> $$ = nterm opt_args () + Stack now 0 13 36 + Entering state 77 + Next token is token ')' () + Shifting token ')' () + Entering state 113 + Reducing stack by rule 52 (line 151): + $1 = token identifier () + $2 = token '(' () + $3 = nterm opt_args () + $4 = token ')' () + -> $$ = nterm primary () + Stack now 0 + Entering state 25 + Reading a token: Next token is token ';' () + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 + Entering state 24 + Next token is token ';' () + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 + Entering state 22 + Reducing stack by rule 4 (line 87): + $1 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 + Entering state 21 + Next token is token ';' () + Shifting token ';' () + Entering state 51 + Reducing stack by rule 74 (line 189): + $1 = token ';' () + -> $$ = nterm term () + Stack now 0 21 + Entering state 55 + Reducing stack by rule 72 (line 185): + $1 = nterm term () + -> $$ = nterm terms () + Stack now 0 21 + Entering state 54 + Reading a token: Next token is token keyword_true () + Shifting token keyword_true () + Entering state 7 + Reducing stack by rule 57 (line 156): + $1 = token keyword_true () + -> $$ = nterm primary () + Stack now 0 21 54 + Entering state 25 + Reading a token: Now at end of input. + Reducing stack by rule 34 (line 123): + $1 = nterm primary () + -> $$ = nterm expr () + Stack now 0 21 54 + Entering state 24 + Now at end of input. + Reducing stack by rule 13 (line 98): + $1 = nterm expr () + -> $$ = nterm stmt () + Stack now 0 21 54 + Entering state 89 + Reducing stack by rule 5 (line 88): + $1 = nterm stmts () + $2 = nterm terms () + $3 = nterm stmt () + -> $$ = nterm stmts () + Stack now 0 + Entering state 21 + Now at end of input. + Reducing stack by rule 70 (line 181): + -> $$ = nterm opt_terms () + Stack now 0 21 + Entering state 53 + Reducing stack by rule 2 (line 83): + $1 = nterm stmts () + $2 = nterm opt_terms () + -> $$ = nterm compstmt () + Stack now 0 + Entering state 20 + Reducing stack by rule 1 (line 80): + $1 = nterm compstmt () + -> $$ = nterm program () + Stack now 0 + Entering state 19 + Now at end of input. + Stack now 0 19 + Cleanup: popping nterm program () + Syntax OK diff --git a/vagrant/bootstrap.sh b/vagrant/bootstrap.sh index f455b6a..b7cc5f2 100755 --- a/vagrant/bootstrap.sh +++ b/vagrant/bootstrap.sh @@ -3,6 +3,6 @@ set -e apt-get update apt-get install --no-install-recommends -y build-essential flex bison -cd /streem/src +cd /streem make clean make