EBNF not working ?

6 views
Skip to first unread message

vabank

unread,
Jul 6, 2005, 4:10:57 AM7/6/05
to py...@googlegroups.com
Hi
Look like EBNF not working properly at last 0.4.1 version.

If rules rewrite without * and + extended symbols, then proctree begin
working

Alex

Tim Newsham

unread,
Jul 6, 2005, 3:03:56 PM7/6/05
to py...@googlegroups.com
> Look like EBNF not working properly at last 0.4.1 version.
>
> If rules rewrite without * and + extended symbols, then proctree begin
> working

I've used EBNF in this version many times (in fact, the current
source tree for pyggy uses EBNF for the pyggy and pylly grammars).

From the description you posted it sounds like you were having
problems with the production actions. When you use EBNF constructs
it automatically generates actions for your productions. In
particular:


X -> A B* C :
return kids
;

will expand into:

X -> A X.clos0 C :
return kids
;
X.clos0 -> X.clos0 B :
kids[0].append(kids[1])
return kids[0]
| : # <- empty production
return []
;

ie. the star closure generates a new production whose action
generates a list.

This sequence of code may not work particularly well with
ambiguous grammars. This is an issue I haven't yet figured
out. Could this be causing your problem? Have you looked
at the nature of the error in a debugger?

> Alex

Tim Newsham
http://www.lava.net/~newsham/

vabank

unread,
Jul 7, 2005, 6:58:55 AM7/7/05
to py...@googlegroups.com
> Could this be causing your problem? Have you looked
at the nature of the error in a debugger?
Yes, it is possible. Error occured at action where

kids[0].append(kids[1])

Below I put part of error message that I got:
File
"C:\Projects\StyleChecker\Python\pyggy-0.4.1\examples\ansic\ansic_gramtab
.py", line 31, in action6


kids[0].append(kids[1])

AttributeError: symnode instance has no attribute 'append'

Possible it is connected with ambiguous grammars... But I not found any
place where kids[0] would be initilized with list in pyggy code.

You can easily reproduce this error when try to parse C source code
like
void main(int argc, char **argv)
{
}

with sample of ansic.pyg grammar in pyggy-0.4.1 distribution.

Now I trying to use pyggy for my task(style checker) and I would be
very glad to help you in improvement of this package.

Alex

Reply all
Reply to author
Forward
0 new messages