1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202
|
From dallas.a.clement@gmail.com Tue Oct 9 01:20:26 2007
Received: from smtp1.rug.nl (smtp1.rug.nl [129.125.50.11])
by suffix.rc.rug.nl (8.14.1/8.14.1/Debian-9) with SMTP id l98NKQcR032365
for <frank@suffix.rc.rug.nl>; Tue, 9 Oct 2007 01:20:26 +0200
Received: from smtp1.rug.nl ([129.125.50.11])
by smtp1.rug.nl (SMSSMTP 4.1.0.19) with SMTP id M2007100901201923923
for <frank@suffix.rc.rug.nl>; Tue, 09 Oct 2007 01:20:19 +0200
Received: from mail3.rug.nl (mail3.rug.nl [129.125.50.14])
by smtp1.rug.nl (8.12.11.20060308/8.12.11) with ESMTP id l98NKI5a008704
for <frank@suffix.rc.rug.nl>; Tue, 9 Oct 2007 01:20:18 +0200 (MEST)
Resent-Message-Id: <200710082320.l98NKI5a008704@smtp1.rug.nl>
Received: from <p108703@rug.nl>
by mail3.rug.nl (CommuniGate Pro RULES 5.1.12)
with RULES id 55901028; Tue, 09 Oct 2007 01:20:18 +0200
X-Autogenerated: Mirror
Resent-From: <F.B.Brokken@rug.nl>
Resent-Date: Tue, 09 Oct 2007 01:20:18 +0200
Received: from smtp2.rug.nl ([129.125.50.12] verified)
by mail3.rug.nl (CommuniGate Pro SMTP 5.1.12)
with SMTP id 55901027 for f.b.brokken@rug.nl; Tue, 09 Oct 2007 01:20:18 +0200
Received: from smtp2.rug.nl ([129.125.50.12])
by smtp2.rug.nl (SMSSMTP 4.1.11.41) with SMTP id M2007100901201828757
for <f.b.brokken@rug.nl>; Tue, 09 Oct 2007 01:20:18 +0200
Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.178])
by smtp2.rug.nl (8.12.11.20060308/8.12.11) with ESMTP id l98NKG2I028040
for <f.b.brokken@rug.nl>; Tue, 9 Oct 2007 01:20:16 +0200 (MEST)
Received: by py-out-1112.google.com with SMTP id f47so2729326pye
for <f.b.brokken@rug.nl>; Mon, 08 Oct 2007 16:20:16 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=beta;
h=domainkey-signature:received:received:subject:from:reply-to:to:in-reply-to:references:content-type:organization:date:message-id:mime-version:x-mailer;
bh=LD3uTVyoVRXS18cMbdAEH/t5RfGGUuSFs6pDmj1RxTc=;
b=g0vH8DPCx3xG8SSKvAsd4Fw+E5FDBMFsf5KJSXGmIlR64OzH7Q/BxeRjntgyy/FVfcXhCId/6fvCEqOOOx9SLcZ+s1gWWMQr2R0Xsd8CpNP9vsCpfGTwkFw0UsHxWQG8+QTaooMqcdEB9C0qnmO9OJblnTStirnqtWNMxfz0gW0=
DomainKey-Signature: a=rsa-sha1; c=nofws;
d=gmail.com; s=beta;
h=received:subject:from:reply-to:to:in-reply-to:references:content-type:organization:date:message-id:mime-version:x-mailer;
b=Tkh422JxTs39Ghh5NhfwxU0szS4qz06ycc6wi7XKd6WfdyZHVC0ohGdo46UsTQ3qFdF4mk9naD3h9O1A3V0+oaHFT7a3AJag6owDD+lnc4310BTPSMj+DO6oZ/vksn2hDx4hJAERTyde35adMlqHiM0WdNIH6OJs79os9sCGS/0=
Received: by 10.35.87.10 with SMTP id p10mr2102442pyl.1191885615791;
Mon, 08 Oct 2007 16:20:15 -0700 (PDT)
Received: from debian.local ( [70.250.157.38])
by mx.google.com with ESMTPS id w29sm8012125pyg.2007.10.08.16.20.12
(version=SSLv3 cipher=RC4-MD5);
Mon, 08 Oct 2007 16:20:13 -0700 (PDT)
Subject: Re: Small bisonc++ question
From: Dallas Clement <dallas.a.clement@gmail.com>
Reply-To: dallas.a.clement@gmail.com
To: f.b.brokken@rug.nl
In-Reply-To: <20071008221446.GD27245@rc.rug.nl>
References: <20070919073747.GC17408@rc.rug.nl>
<1191222419.3468.43.camel@localhost> <20071001190610.GA6195@rc.rug.nl>
<1191278771.3605.15.camel@localhost> <20071003072550.GC29648@rc.rug.nl>
<1191450509.3474.48.camel@localhost> <20071004064310.GB23564@rc.rug.nl>
<1191505247.3505.15.camel@localhost> <20071005101005.GA25725@rc.rug.nl>
<1191853606.3413.47.camel@localhost> <20071008221446.GD27245@rc.rug.nl>
Content-Type: multipart/mixed; boundary="=-WkuJNQQGw+AXQ14kxZP8"
Organization: Clements
Date: Mon, 08 Oct 2007 13:20:10 -0500
Message-Id: <1191867610.3413.66.camel@localhost>
Mime-Version: 1.0
X-Mailer: Evolution 2.6.3
X-Spam-Flag: NO
X-Scanned-By: milter-spamc/1.4.366 (smtp1.rug.nl [129.125.50.11]); Tue, 09 Oct 2007 01:20:19 +0200
X-Scanned-By: milter-spamc/1.4.366 (smtp2.rug.nl [129.125.50.12]); Tue, 09 Oct 2007 01:20:18 +0200
X-Spam-Status: NO, hits=-7.00 required=4.00
X-Spam-Report: Spam detection software on "smtp1.rug.nl". Questions: postmaster@rug.nl
Content analysis details: (-7.0 points, 4.0 required)
USER_IN_WHITELIST=-7
__
Status: RO
Content-Length: 2401
Lines: 129
--=-WkuJNQQGw+AXQ14kxZP8
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Hello Frank,
I have been able to reproduce the mysterious problem I have been
bothering you about this past many days. I can do it with a slight
modification of the example code you provided. I have attached the
modified grammar file.
This grammar should be able to parse the following expression:
const abc j = xyz;
The output of the parsing should produce:
type_specifier j scoped_identifier
This is exactly what I would expect.
However, if you were to uncomment the last two alternatives in the
'scoped_identifier' rule, you will observe a completely different
output.
Please uncomment as follows:
scoped_identifier:
IDENTIFIER
{
$$ = new Ident("scoped_identifier");
}
|
':' IDENTIFIER
{
$$ = new Ident("scoped_identifier");
}
|
scoped_identifier ':' IDENTIFIER
{
$$ = new Ident("scoped_identifier");
}
;
Now you will observe the following output when executed:
type_specifier type_specifier scoped_identifier
This is definitely not what I would expect. The identifier 'j' is
definitely not a 'type_specifier'.
This example reproduces the exact problem I have been struggling to
explain to you this past several days.
Now I may be doing something really stupid, but I'm not able to
recognize what it is. What do you think?
Thanks,
Dallas
--=-WkuJNQQGw+AXQ14kxZP8
Content-Disposition: attachment; filename=grammar
Content-Type: text/plain; name=grammar; charset=utf-8
Content-Transfer-Encoding: 7bit
%class-name Parser
%filenames parser
%parsefun-source parse.cc
%scanner ../scanner/scanner.h
%baseclass-preinclude preinclude.h
%stype SemVal
%token BOOL INT ENUM CONST IDENTIFIER
%%
constant_definition:
CONST type_specifier IDENTIFIER '=' scoped_identifier ';'
{
cout << $2 << " " << $3 << " " << $5 << endl;
}
;
type_specifier:
BOOL
{
$$ = new Ident("type_specifier");
}
|
INT
{
$$ = new Ident("type_specifier");
}
|
scoped_identifier
{
$$ = new Ident("type_specifier");
}
;
scoped_identifier:
IDENTIFIER
{
$$ = new Ident("scoped_identifier");
}
/*
|
':' IDENTIFIER
{
$$ = new Ident("scoped_identifier");
}
|
scoped_identifier ':' IDENTIFIER
{
$$ = new Ident("scoped_identifier");
}
*/
;
--=-WkuJNQQGw+AXQ14kxZP8--
|