FreeBSD Bugzilla – Attachment 142122 Details for
Bug 189101
yacc(1): In FreeBSD yacc, %nonassoc doesn't work correctly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
file.shar
file.shar (text/plain), 1.68 KB, created by
ksmakoto
on 2014-04-29 10:10:00 UTC
(
hide
)
Description:
file.shar
Filename:
MIME Type:
Creator:
ksmakoto
Created:
2014-04-29 10:10:00 UTC
Size:
1.68 KB
patch
obsolete
># This is a shell archive. Save it in a file, remove anything before ># this line, and then unpack it by entering "sh file". Note, it may ># create directories; files and directories will be owned by you and ># have default permissions. ># ># This archive contains: ># ># Makefile ># calc.y ># run_samples.sh ># >echo x - Makefile >sed 's/^X//' >Makefile << '' >XBYACC=/usr/bin/yacc >XBISON=/usr/local/bin/bison >XYACC9=/usr/local/9/bin/yacc >X >Xall: calc_by calc_bi calc_9y >X >Xcalc_by.c: calc.y >X ${BYACC} -o calc_by.c calc.y >X >Xcalc_bi.c: calc.y >X ${BISON} -o calc_bi.c calc.y >X >Xcalc_9y.c: calc.y >X ${YACC9} -o calc_9y.c calc.y >X >Xclean: >X rm -Rf calc_by* calc_bi* calc_9y* > >echo x - calc.y >sed 's/^X//' >calc.y << '' >X%{ >X#include <ctype.h> >X#include <stdio.h> >X#include <stdlib.h> >X >Xint yyparse(void); >Xstatic int yylex(void); >Xstatic void yyerror(char *s); >X%} >X >X%token NUM >X >X%nonassoc '-' >X >X%% >X >Xprog : expr { printf("%d\n", $1); } >X >Xexpr : expr '-' expr { $$ = $1 - $3; } >X | NUM >X ; >X >X%% >X >Xstatic int >Xyylex(void) >X{ >X static int lastchar = -2; >X >X if (lastchar == -2) { >X lastchar = getchar(); >X } >X >X if (lastchar == EOF) { >X return 0; >X } else if (isdigit(lastchar)) { >X int tmp = digittoint(lastchar); >X while (isdigit(lastchar = getchar())) { >X tmp = 10 * tmp + digittoint(lastchar); >X } >X yylval = tmp; >X return NUM; >X } else { >X yylval = lastchar; >X lastchar = getchar(); >X return yylval; >X } >X} >X >Xstatic void >Xyyerror(char *s) >X{ >X fprintf(stderr, "%s\n", s); >X} >X >Xint >Xmain(void) >X{ >X yyparse(); >X >X return 0; >X} > >echo x - run_samples.sh >sed 's/^X//' >run_samples.sh << '' >X#! /bin/sh >Xmake >Xecho -n "1-2-3" | ./calc_by >Xecho -n "1-2-3" | ./calc_9y >Xecho -n "1-2-3" | ./calc_bi > >exit
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 189101
: 142122