From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Transfer-Encoding: 7bit Content-Type: multipart/alternative; boundary=Apple-Mail-AE173861-0805-4916-8D58-5415E59E7636 From: Bakul Shah Mime-Version: 1.0 (1.0) Date: Thu, 26 Nov 2015 09:48:08 -0800 Message-Id: References: <20151125160347.GN20646@sigint.cs.purdue.edu> <79F2255E-5E76-43E8-83B3-0DFB2CD34AC7@bitblocks.com> <3175949A-26D0-4C4A-BB7D-4E5A3EA7F8B7@me.com> In-Reply-To: <3175949A-26D0-4C4A-BB7D-4E5A3EA7F8B7@me.com> To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Subject: Re: [9fans] Undefined Behaviour in C Topicbox-Message-UUID: 77e17b8a-ead9-11e9-9d60-3106f5b1d025 --Apple-Mail-AE173861-0805-4916-8D58-5415E59E7636 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Good points! Though 0 was a valid address on pdp11, right? May be if they ha= d used ~0 as nil and not put any peripheral device at that address, *nil wo= uld've had more immediate failures! Many ~0+offset errors would be caught on= machines that trap 2 or 4 byte fetch/store to odd addresses. I guess the real problem is that compilers don't generate tests to catch *ni= l (unless they can prove a ptr can't be nil). That + not generating bounds c= hecks. No comment on the Bay Area :-) Especially since we are trying to hire people= ! > On Nov 26, 2015, at 3:22 AM, Brantley Coile wrote: >=20 > Hi Bakul. Long time since our Bay Area plan 9 hacking sessions. I've avoi= ded the valley all together for a year and a half now. Not quite long enough= yet.=20 >=20 > I thought the same thing, using ~0 for nil, but realized two things. First= , that's a valid address on the PDP11 where the convention developed. It's t= he unibus space. Second, ~0 + member offest is still in page zero.=20 >=20 > By the way, are there any structs more than 4K in Linux? Are there any in p= lan 9? >=20 > Sent from my iPad >=20 >> On Nov 26, 2015, at 2:27 AM, Bakul Shah wrote: >>=20 >> Using 0xfff...f instead of 0 for a null ptr might've been less "disgustin= g"!=20 >>=20 >>> On Nov 25, 2015, at 6:04 PM, Prof Brucee wrote: >>>=20 >>> gcc is indeed a very sad tome. The mmap of 0 is disgusting. I like kenc.= It just works. My behaviour this afternoon will be undefined but not as stu= pid as that of some programmers. >>>=20 >>>> On 26/11/2015 5:43 AM, "Brantley Coile" wrote: >>>> Align it to column 7 and it looks like all the code I saw when I starte= d.=20 >>>>=20 >>>> iPhone email >>>>=20 >>>>> On Nov 25, 2015, at 12:13 PM, Ryan Gonzalez wrote: >>>>>=20 >>>>> Neither! It's what happens when you run sed 's/^\s*//' on your whole c= ode base, yielding results like (from cmd/yacc.c): >>>>>=20 >>>>>=20 >>>>> void >>>>> setup(int argc, char *argv[]) >>>>> { >>>>> long c, t; >>>>> int i, j, fd, lev, ty, ytab, *p; >>>>> int vflag, dflag, stem; >>>>> char actnm[8], *stemc, *s, dirbuf[128]; >>>>> Biobuf *fout; >>>>>=20 >>>>> ytab =3D 0; >>>>> vflag =3D 0; >>>>> dflag =3D 0; >>>>> stem =3D 0; >>>>> stemc =3D "y"; >>>>> foutput =3D 0; >>>>> fdefine =3D 0; >>>>> fdebug =3D 0; >>>>> ARGBEGIN{ >>>>> case 'v': >>>>> case 'V': >>>>> vflag++; >>>>> break; >>>>> case 'D': >>>>> yydebug =3D ARGF(); >>>>> break; >>>>> case 'a': >>>>> yyarg =3D 1; >>>>> break; >>>>> case 'd': >>>>> dflag++; >>>>> break; >>>>> case 'l': >>>>> yyline =3D 0; >>>>> break; >>>>> case 'o': >>>>> ytab++; >>>>> ytabc =3D ARGF(); >>>>> break; >>>>> case 's': >>>>> stem++; >>>>> stemc =3D ARGF(); >>>>> break; >>>>> case 'S': >>>>> parser =3D PARSERS; >>>>> break; >>>>> default: >>>>> error("illegal option: %c", ARGC()); >>>>> }ARGEND >>>>> openup(stemc, dflag, vflag, ytab, ytabc); >>>>> fout =3D dflag?fdefine:ftable; >>>>> if(yyarg){ >>>>> Bprint(ftable, "#define\tYYARG\t1\n\n"); >>>>> } >>>>> if((fd =3D mkstemp(ttempname)) >=3D 0){ >>>>> tempname =3D ttempname; >>>>> ftemp =3D Bfdopen(fd, OWRITE); >>>>> } >>>>> if((fd =3D mkstemp(tactname)) >=3D 0){ >>>>> actname =3D tactname; >>>>> faction =3D Bfdopen(fd, OWRITE); >>>>> } >>>>> if(ftemp =3D=3D 0 || faction =3D=3D 0) >>>>> error("cannot open temp file"); >>>>> if(argc < 1) >>>>> error("no input file"); >>>>> infile =3D argv[0]; >>>>> if(infile[0] !=3D '/' && getwd(dirbuf, sizeof dirbuf)!=3Dnil){ >>>>> i =3D strlen(infile)+1+strlen(dirbuf)+1+10; >>>>> s =3D malloc(i); >>>>> if(s !=3D nil){ >>>>> snprint(s, i, "%s/%s", dirbuf, infile); >>>>> cleanname(s); >>>>> infile =3D s; >>>>> } >>>>> } >>>>> finput =3D Bopen(infile, OREAD); >>>>> if(finput =3D=3D 0) >>>>> error("cannot open '%s'", argv[0]); >>>>> cnamp =3D cnames; >>>>>=20 >>>>> defin(0, "$end"); >>>>> extval =3D PRIVATE; /* tokens start in unicode 'private use' */= >>>>> defin(0, "error"); >>>>> defin(1, "$accept"); >>>>> defin(0, "$unk"); >>>>> mem =3D mem0; >>>>> i =3D 0; >>>>>=20 >>>>> for(t =3D gettok(); t !=3D MARK && t !=3D ENDFILE;) >>>>> switch(t) { >>>>> case ';': >>>>> t =3D gettok(); >>>>> break; >>>>>=20 >>>>> case START: >>>>> if(gettok() !=3D IDENTIFIER) >>>>> error("bad %%start construction"); >>>>> start =3D chfind(1, tokname); >>>>> t =3D gettok(); >>>>> continue; >>>>>=20 >>>>> case TYPEDEF: >>>>> if(gettok() !=3D TYPENAME) >>>>> error("bad syntax in %%type"); >>>>> ty =3D numbval; >>>>> for(;;) { >>>>> t =3D gettok(); >>>>> switch(t) { >>>>> case IDENTIFIER: >>>>> if((t=3Dchfind(1, tokname)) < NTBASE) { >>>>> j =3D TYPE(toklev[t]); >>>>> if(j !=3D 0 && j !=3D ty) >>>>> error("type redeclaration of token %s", >>>>> tokset[t].name); >>>>> else >>>>> SETTYPE(toklev[t], ty); >>>>> } else { >>>>> j =3D nontrst[t-NTBASE].value; >>>>> if(j !=3D 0 && j !=3D ty) >>>>> error("type redeclaration of nonterminal %s", >>>>> nontrst[t-NTBASE].name ); >>>>> else >>>>> nontrst[t-NTBASE].value =3D ty; >>>>> } >>>>> case ',': >>>>> continue; >>>>> case ';': >>>>> t =3D gettok(); >>>>> default: >>>>> break; >>>>> } >>>>> break; >>>>> } >>>>> continue; >>>>>=20 >>>>> case UNION: >>>>> /* copy the union declaration to the output */ >>>>> cpyunion(); >>>>> t =3D gettok(); >>>>> continue; >>>>>=20 >>>>> case LEFT: >>>>> case BINARY: >>>>> case RIGHT: >>>>> i++; >>>>>=20 >>>>> case TERM: >>>>> /* nonzero means new prec. and assoc. */ >>>>> lev =3D t-TERM; >>>>> ty =3D 0; >>>>>=20 >>>>> /* get identifiers so defined */ >>>>> t =3D gettok(); >>>>>=20 >>>>> /* there is a type defined */ >>>>> if(t =3D=3D TYPENAME) { >>>>> ty =3D numbval; >>>>> t =3D gettok(); >>>>> } >>>>> for(;;) { >>>>> switch(t) { >>>>> case ',': >>>>> t =3D gettok(); >>>>> continue; >>>>>=20 >>>>> case ';': >>>>> break; >>>>>=20 >>>>> case IDENTIFIER: >>>>> j =3D chfind(0, tokname); >>>>> if(j >=3D NTBASE) >>>>> error("%s defined earlier as nonterminal", tokname); >>>>> if(lev) { >>>>> if(ASSOC(toklev[j])) >>>>> error("redeclaration of precedence of %s", tokname); >>>>> SETASC(toklev[j], lev); >>>>> SETPLEV(toklev[j], i); >>>>> } >>>>> if(ty) { >>>>> if(TYPE(toklev[j])) >>>>> error("redeclaration of type of %s", tokname); >>>>> SETTYPE(toklev[j],ty); >>>>> } >>>>> t =3D gettok(); >>>>> if(t =3D=3D NUMBER) { >>>>> tokset[j].value =3D numbval; >>>>> if(j < ndefout && j > 3) >>>>> error("please define type number of %s earlier", >>>>> tokset[j].name); >>>>> t =3D gettok(); >>>>> } >>>>> continue; >>>>> } >>>>> break; >>>>> } >>>>> continue; >>>>>=20 >>>>> case LCURLY: >>>>> defout(0); >>>>> cpycode(); >>>>> t =3D gettok(); >>>>> continue; >>>>>=20 >>>>> default: >>>>> error("syntax error"); >>>>> } >>>>> if(t =3D=3D ENDFILE) >>>>> error("unexpected EOF before %%"); >>>>>=20 >>>>> /* t is MARK */ >>>>> if(!yyarg) >>>>> Bprint(ftable, "extern int yyerrflag;\n"); >>>>> Bprint(ftable, "#ifndef YYMAXDEPTH\n"); >>>>> Bprint(ftable, "#define YYMAXDEPTH 150\n"); >>>>> Bprint(ftable, "#endif\n" ); >>>>> if(!ntypes) { >>>>> Bprint(ftable, "#ifndef YYSTYPE\n"); >>>>> Bprint(ftable, "#define YYSTYPE int\n"); >>>>> Bprint(ftable, "#endif\n"); >>>>> } >>>>> if(!yyarg){ >>>>> Bprint(ftable, "YYSTYPE yylval;\n"); >>>>> Bprint(ftable, "YYSTYPE yyval;\n"); >>>>> }else{ >>>>> if(dflag) >>>>> Bprint(ftable, "#include \"%s.%s\"\n\n", stemc, FILED); >>>>> Bprint(fout, "struct Yyarg {\n"); >>>>> Bprint(fout, "\tint\tyynerrs;\n"); >>>>> Bprint(fout, "\tint\tyyerrflag;\n"); >>>>> Bprint(fout, "\tvoid*\targ;\n"); >>>>> Bprint(fout, "\tYYSTYPE\tyyval;\n"); >>>>> Bprint(fout, "\tYYSTYPE\tyylval;\n"); >>>>> Bprint(fout, "};\n\n"); >>>>> } >>>>> prdptr[0] =3D mem; >>>>>=20 >>>>> /* added production */ >>>>> *mem++ =3D NTBASE; >>>>>=20 >>>>> /* if start is 0, we will overwrite with the lhs of the first rule */ >>>>> *mem++ =3D start; >>>>> *mem++ =3D 1; >>>>> *mem++ =3D 0; >>>>> prdptr[1] =3D mem; >>>>> while((t=3Dgettok()) =3D=3D LCURLY) >>>>> cpycode(); >>>>> if(t !=3D IDENTCOLON) >>>>> error("bad syntax on first rule"); >>>>>=20 >>>>> if(!start) >>>>> prdptr[0][1] =3D chfind(1, tokname); >>>>>=20 >>>>> /* read rules */ >>>>> while(t !=3D MARK && t !=3D ENDFILE) { >>>>> /* process a rule */ >>>>> rlines[nprod] =3D lineno; >>>>> if(t =3D=3D '|') >>>>> *mem++ =3D *prdptr[nprod-1]; >>>>> else >>>>> if(t =3D=3D IDENTCOLON) { >>>>> *mem =3D chfind(1, tokname); >>>>> if(*mem < NTBASE) >>>>> error("token illegal on LHS of grammar rule"); >>>>> mem++; >>>>> } else >>>>> error("illegal rule: missing semicolon or | ?"); >>>>> /* read rule body */ >>>>> t =3D gettok(); >>>>>=20 >>>>> more_rule: >>>>> while(t =3D=3D IDENTIFIER) { >>>>> *mem =3D chfind(1, tokname); >>>>> if(*mem < NTBASE) >>>>> levprd[nprod] =3D toklev[*mem]; >>>>> mem++; >>>>> t =3D gettok(); >>>>> } >>>>> if(t =3D=3D PREC) { >>>>> if(gettok() !=3D IDENTIFIER) >>>>> error("illegal %%prec syntax"); >>>>> j =3D chfind(2, tokname); >>>>> if(j >=3D NTBASE) >>>>> error("nonterminal %s illegal after %%prec", >>>>> nontrst[j-NTBASE].name); >>>>> levprd[nprod] =3D toklev[j]; >>>>> t =3D gettok(); >>>>> } >>>>> if(t =3D=3D '=3D') { >>>>> levprd[nprod] |=3D ACTFLAG; >>>>> Bprint(faction, "\ncase %d:", nprod); >>>>> cpyact(mem-prdptr[nprod]-1); >>>>> Bprint(faction, " break;"); >>>>> if((t=3Dgettok()) =3D=3D IDENTIFIER) { >>>>>=20 >>>>> /* action within rule... */ >>>>> sprint(actnm, "$$%d", nprod); >>>>>=20 >>>>> /* make it a nonterminal */ >>>>> j =3D chfind(1, actnm); >>>>>=20 >>>>> /* >>>>> * the current rule will become rule number nprod+1 >>>>> * move the contents down, and make room for the null >>>>> */ >>>>> for(p =3D mem; p >=3D prdptr[nprod]; --p) >>>>> p[2] =3D *p; >>>>> mem +=3D 2; >>>>>=20 >>>>> /* enter null production for action */ >>>>> p =3D prdptr[nprod]; >>>>> *p++ =3D j; >>>>> *p++ =3D -nprod; >>>>>=20 >>>>> /* update the production information */ >>>>> levprd[nprod+1] =3D levprd[nprod] & ~ACTFLAG; >>>>> levprd[nprod] =3D ACTFLAG; >>>>> if(++nprod >=3D NPROD) >>>>> error("more than %d rules", NPROD); >>>>> prdptr[nprod] =3D p; >>>>>=20 >>>>> /* make the action appear in the original rule */ >>>>> *mem++ =3D j; >>>>>=20 >>>>> /* get some more of the rule */ >>>>> goto more_rule; >>>>> } >>>>> } >>>>>=20 >>>>> while(t =3D=3D ';') >>>>> t =3D gettok(); >>>>> *mem++ =3D -nprod; >>>>>=20 >>>>> /* check that default action is reasonable */ >>>>> if(ntypes && !(levprd[nprod]&ACTFLAG) && nontrst[*prdptr[nprod]-NTBASE= ].value) { >>>>>=20 >>>>> /* no explicit action, LHS has value */ >>>>> int tempty; >>>>>=20 >>>>> tempty =3D prdptr[nprod][1]; >>>>> if(tempty < 0) >>>>> error("must return a value, since LHS has a type"); >>>>> else >>>>> if(tempty >=3D NTBASE) >>>>> tempty =3D nontrst[tempty-NTBASE].value; >>>>> else >>>>> tempty =3D TYPE(toklev[tempty]); >>>>> if(tempty !=3D nontrst[*prdptr[nprod]-NTBASE].value) >>>>> error("default action causes potential type clash"); >>>>> } >>>>> nprod++; >>>>> if(nprod >=3D NPROD) >>>>> error("more than %d rules", NPROD); >>>>> prdptr[nprod] =3D mem; >>>>> levprd[nprod] =3D 0; >>>>> } >>>>>=20 >>>>> /* end of all rules */ >>>>> defout(1); >>>>>=20 >>>>> finact(); >>>>> if(t =3D=3D MARK) { >>>>> Bprint(ftable, "\n"); >>>>> if(yyline) >>>>> Bprint(ftable, "#line\t%d\t\"%s\"\n", lineno, infile); >>>>> while((c=3DBgetrune(finput)) !=3D Beof) >>>>> Bputrune(ftable, c); >>>>> } >>>>> Bterm(finput); >>>>> } >>>>>=20 >>>>>=20 >>>>>> On Wed, Nov 25, 2015 at 10:03 AM, wro= te: >>>>>> On Wed, Nov 25, 2015 at 09:25:55AM -0500, Brantley Coile wrote: >>>>>> > unindented consequences >>>>>>=20 >>>>>> Is that a class of Python bugs or an awesome name for a Nerdcore band= ? >>>>>=20 >>>>>=20 >>>>>=20 >>>>> --=20 >>>>> Ryan >>>>> [ERROR]: Your autotools build scripts are 200 lines longer than your p= rogram. Something=E2=80=99s wrong. >>>>> http://kirbyfan64.github.io/ --Apple-Mail-AE173861-0805-4916-8D58-5415E59E7636 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
Good points! Though 0 was a valid address on pdp11, right? May be if they h= ad used ~0 as nil and not put any peripheral device at that address,  *= nil would've had more immediate failures! Many ~0+offset errors would be cau= ght on machines that trap 2 or 4 byte fetch/store to odd addresses.

I guess the real problem is that compilers don't generate t= ests to catch *nil (unless they can prove a ptr can't be nil). That + not ge= nerating bounds checks.

No comment on the Bay Area := -) Especially since we are trying to hire people!

On Nov 26, 2= 015, at 3:22 AM, Brantley Coile <= brantleycoile@me.com> wrote:

<= div>
Hi Bakul.  Long time since our Bay Area plan 9 hacking sessions. I= 've avoided the valley all together for a year and a half now. Not quite lon= g enough yet. 

I thought the same thing, using ~0 for nil, but realize= d two things. First, that's a valid address on the PDP11 where the conventio= n developed. It's the unibus space. Second, ~0 + member offest is still in p= age zero. 

By the way, are there any structs more than 4K in Linux? Ar= e there any in plan 9?

Sent from my iPad

On Nov 26, 201= 5, at 2:27 AM, Bakul Shah <bakul@b= itblocks.com> wrote:

Using 0xfff...f instead of 0 for a null ptr might've been less "dis= gusting"! 

On Nov 25, 2015, at 6:04 PM, Prof Brucee <<= a href=3D"mailto:prof.brucee@gmail.com">prof.brucee@gmail.com> wrote:=

gcc is indeed a v= ery sad tome. The mmap of 0 is disgusting. I like kenc. It just works. My be= haviour this afternoon will be undefined but not as stupid as that of some p= rogrammers.

On 26/11/2015 5:43 AM, "Brantley Coile" <brantleycoile@me.com> wrote:
Align it to column 7 and it= looks like all the code I saw when I started. 

iPhone em= ail

On Nov 25, 2015, at 12:13 PM, Ryan Gonzalez <rymg19@gmail.com> wrote:<= br>
Neither! It's w= hat happens when you run sed 's/^\s*//' on your whole code base, yielding re= sults like (from cmd/yacc.c):


void
setup(int argc, char *argv[])
{
long c, t;
=
int i, j, fd, lev, ty, ytab, *p;
int vflag, dflag, stem;
char actnm[8], *stemc, *s, dirbuf[128];
Biobuf *fout;
<= div>
ytab =3D 0;
vflag =3D 0;
dflag =3D 0;=
stem =3D 0;
stemc =3D "y";
foutput =3D 0;
fdefine =3D 0;
fdebug =3D 0;
ARGBEGIN{
= case 'v':
case 'V':
vflag++;
break;
= case 'D':
yydebug =3D ARGF();
break;
case 'a':=
yyarg =3D 1;
break;
case 'd':
dflag= ++;
break;
case 'l':
yyline =3D 0;
b= reak;
case 'o':
ytab++;
ytabc =3D ARGF();
break;
case 's':
stem++;
stemc =3D ARGF(= );
break;
case 'S':
parser =3D PARSERS;
<= div>break;
default:
error("illegal option: %c", ARGC());=
}ARGEND
openup(stemc, dflag, vflag, ytab, ytabc);
=
fout =3D dflag?fdefine:ftable;
if(yyarg){
Bprint(ft= able, "#define\tYYARG\t1\n\n");
}
if((fd =3D mkstemp(tte= mpname)) >=3D 0){
tempname =3D ttempname;
ftemp =3D B= fdopen(fd, OWRITE);
}
if((fd =3D mkstemp(tactname)) >= =3D 0){
actname =3D tactname;
faction =3D Bfdopen(fd, OW= RITE);
}
if(ftemp =3D=3D 0 || faction =3D=3D 0)
error("cannot open temp file");
if(argc < 1)
error(= "no input file");
infile =3D argv[0];
if(infile[0] !=3D '= /' && getwd(dirbuf, sizeof dirbuf)!=3Dnil){
i =3D strlen(i= nfile)+1+strlen(dirbuf)+1+10;
s =3D malloc(i);
if(s !=3D= nil){
snprint(s, i, "%s/%s", dirbuf, infile);
cleanname= (s);
infile =3D s;
}
}
finput =3D Bo= pen(infile, OREAD);
if(finput =3D=3D 0)
error("cannot op= en '%s'", argv[0]);
cnamp =3D cnames;

def= in(0, "$end");
extval =3D PRIVATE; /* tokens start in unicode 'private use' */
defin(= 0, "error");
defin(1, "$accept");
defin(0, "$unk");
mem =3D mem0;
i =3D 0;

for(t =3D ge= ttok(); t !=3D MARK && t !=3D ENDFILE;)
switch(t) {
<= div>case ';':
t =3D gettok();
break;

case START:
if(gettok() !=3D IDENTIFIER)
error("ba= d %%start construction");
start =3D chfind(1, tokname);
= t =3D gettok();
continue;

case TYPEDEF:
if(gettok() !=3D TYPENAME)
error("bad syntax in %%type");=
ty =3D numbval;
for(;;) {
t =3D gettok();
switch(t) {
case IDENTIFIER:
if((t=3Dchfind(1, to= kname)) < NTBASE) {
j =3D TYPE(toklev[t]);
if(j !=3D 0= && j !=3D ty)
error("type redeclaration of token %s",
tokset[t].name);
else
SETTYPE(toklev[t], ty);
} else {
j =3D nontrst[t-NTBASE].value;
if(j !=3D= 0 && j !=3D ty)
error("type redeclaration of nonterminal %= s",
nontrst[t-NTBASE].name );
else
nontrst[t-N= TBASE].value =3D ty;
}
case ',':
continue;
case ';':
t =3D gettok();
default:
brea= k;
}
break;
}
continue;
case UNION:
/* copy the union declaration to the outp= ut */
cpyunion();
t =3D gettok();
continue;

case LEFT:
case BINARY:
case RIGH= T:
i++;

case TERM:
/* nonzero m= eans new prec. and assoc. */
lev =3D t-TERM;
ty =3D 0;

/* get identifiers so defined */
t =3D get= tok();

/* there is a type defined */
if(t= =3D=3D TYPENAME) {
ty =3D numbval;
t =3D gettok();
}
for(;;) {
switch(t) {
case ',':
<= div>t =3D gettok();
continue;

case ';':
break;

case IDENTIFIER:
j =3D ch= find(0, tokname);
if(j >=3D NTBASE)
error("%s defined= earlier as nonterminal", tokname);
if(lev) {
if(ASSOC(t= oklev[j]))
error("redeclaration of precedence of %s", tokname);
SETASC(toklev[j], lev);
SETPLEV(toklev[j], i);
}=
if(ty) {
if(TYPE(toklev[j]))
error("redeclara= tion of type of %s", tokname);
SETTYPE(toklev[j],ty);
}<= /div>
t =3D gettok();
if(t =3D=3D NUMBER) {
tokset[j= ].value =3D numbval;
if(j < ndefout && j > 3)
<= div>error("please define type number of %s earlier",
tokset[j].nam= e);
t =3D gettok();
}
continue;
}
break;
}
continue;

case= LCURLY:
defout(0);
cpycode();
t =3D gettok();=
continue;

default:
error("synt= ax error");
}
if(t =3D=3D ENDFILE)
error("unex= pected EOF before %%");

/* t is MARK */
i= f(!yyarg)
Bprint(ftable, "extern int yyer= rflag;\n");
Bprint(ftable, "#ifndef YYMAXDEPTH\n");
Bprint(ftable, "#define YYMAXDEPTH 150\n");
Bprint(ftable, "#endif\n" );
if(!ntypes) {
Bprint(ftable, "#ifndef YYSTYPE\n");
Bprint(ftable, "#define YYSTYPE int\n");
Bprint(ftable, "#endif\n");
=
}
if(!yyarg){
Bprint(ftable, "YYSTYPE yylval;\n");
Bprint(ftable, "YYSTY= PE yyval;\n");
}else{=
if(dflag)
Bprint(ftable, "#include \"%s.%s\"\n\n", stem= c, FILED);
Bprint(fout, "struct Yyarg {\n");
Bprint(fout= , "\tint\tyynerrs;\n");
Bprint(fout, "\tint\tyyerrflag;\n");
=
Bprint(fout, "\tvoid*\targ;\n");
Bprint(fout, "\tYYSTYPE\tyyv= al;\n");
Bprint(fout, "\tYYSTYPE\tyylval;\n");
Bprint(fo= ut, "};\n\n");
}
prdptr[0] =3D mem;

=
/* added production */
*mem++ =3D NTBASE;

/* if start is 0, we will overwrite with the lhs of the first rule */<= /div>
*mem++ =3D start;
*mem++ =3D 1;
*mem++ =3D 0;<= /div>
prdptr[1] =3D mem;
while((t=3Dgettok()) =3D=3D LCURLY)
cpycode();
if(t !=3D IDENTCOLON)
error("bad syn= tax on first rule");

if(!start)
prdptr[0]= [1] =3D chfind(1, tokname);

/* read rules */
<= div>while(t !=3D MARK && t !=3D ENDFILE) {
/* process a ru= le */
rlines[nprod] =3D lineno;
if(t =3D=3D '|')
*mem++ =3D *prdptr[nprod-1];
else
if(t =3D=3D IDENTCO= LON) {
*mem =3D chfind(1, tokname);
if(*mem < NTBASE)=
error("token illegal on LHS of grammar rule");
mem++;
} else
error("illegal rule: missing semicolon or | ?");
/* read rule body */
t =3D gettok();

=
more_rule:
while(t =3D=3D IDENTIFIER) {
*mem =3D ch= find(1, tokname);
if(*mem < NTBASE)
levprd[nprod] =3D= toklev[*mem];
mem++;
t =3D gettok();
}
<= div>if(t =3D=3D PREC) {
if(gettok() !=3D IDENTIFIER)
err= or("illegal %%prec syntax");
j =3D chfind(2, tokname);
i= f(j >=3D NTBASE)
error("nonterminal %s illegal after %%prec",
nontrst[j-NTBASE].name);
levprd[nprod] =3D toklev[j];
t =3D gettok();
}
if(t =3D=3D '=3D') {
= levprd[nprod] |=3D ACTFLAG;
Bprint(faction, "\ncase %d:", nprod);<= /div>
cpyact(mem-prdptr[nprod]-1);
Bprint(faction, " break;");=
if((t=3Dgettok()) =3D=3D IDENTIFIER) {

/= * action within rule... */
sprint(actnm, "$$%d", nprod);

/* make it a nonterminal */
j =3D chfind(1, actnm)= ;

/*
* the current rule will become rule n= umber nprod+1
* move the contents down, and make room for the null=
*/
for(p =3D mem; p >=3D prdptr[nprod]; --p)
p[2] =3D *p;
mem +=3D 2;

/* enter null= production for action */
p =3D prdptr[nprod];
*p++ =3D j= ;
*p++ =3D -nprod;

/* update the producti= on information */
levprd[nprod+1] =3D levprd[nprod] & ~ACTFLAG= ;
levprd[nprod] =3D ACTFLAG;
if(++nprod >=3D NPROD)
error("more than %d rules", NPROD);
prdptr[nprod] =3D p;<= /div>

/* make the action appear in the original rule */
*mem++ =3D j;

/* get some more of the rule= */
goto more_rule;
}
}

while(t =3D=3D ';')
t =3D gettok();
*mem++ =3D -nprod= ;

/* check that default action is reasonable */
if(ntypes && !(levprd[nprod]&ACTFLAG) && nontrst[= *prdptr[nprod]-NTBASE].value) {

/* no explicit acti= on, LHS has value */
int tempty;

tempty =3D= prdptr[nprod][1];
if(tempty < 0)
error("must return a= value, since LHS has a type");
else
if(tempty >=3D N= TBASE)
tempty =3D nontrst[tempty-NTBASE].value;
else
tempty =3D TYPE(toklev[tempty]);
if(tempty !=3D nontrst[*pr= dptr[nprod]-NTBASE].value)
error("default action causes potential t= ype clash");
}
nprod++;
if(nprod >=3D NPROD= )
error("more than %d rules", NPROD);
prdptr[nprod] =3D m= em;
levprd[nprod] =3D 0;
}

/* e= nd of all rules */
defout(1);

finact();
if(t =3D=3D MARK) {
Bprint(ftable, "\n");
if(yy= line)
Bprint(ftable, "#line\t%d\t\"%s\"\n", lineno, infile);
=
while((c=3DBgetrune(finput)) !=3D Beof)
Bputrune(ftable, c);<= /div>
}
Bterm(finput);
}

<= /div>

On Wed, Nov 2= 5, 2015 at 10:03 AM, <plannine@sigint.cs.purdue.edu> wrote:
On Wed, Nov 25, 2015 at 09:25:55= AM -0500, Brantley Coile wrote:
> unindented consequences

Is that a class of Python bugs or an awesome name for a Nerdcore band?




--
Ryan
<= div dir=3D"ltr">[ERROR]: Your autotools build scripts are 200 lines longer t= han your program. Something=E2=80=99s wrong.
= --Apple-Mail-AE173861-0805-4916-8D58-5415E59E7636--