kdevelop-pg: first/* conflicts, grammar preview
Jakob Petsovits
jpetso at gmx.at
Thu Nov 3 11:20:13 UTC 2005
Hi Roberto,
I'm at it again, this time coming with first/follow and first/first conflicts.
The parser, at this time, recognizes Java annotations and import declarations.
(which is still not that much, but, well, I'm getting there.)
One issue that I stumbled over is that my preliminary implementation is
producing conflicts from the very beginning. The simple rule
(package_declaration | 0) !(import_declaration) !(type_declaration)
-> compilation_unit ;;
should not be ambiguous if package_declaration starts with AT or PACKAGE,
import_declaration starts with IMPORT and type_declaration starts with CLASS.
(CLASS just as an example, there are also other tokens, but none of them
interfering with the other tokens here.)
So everything should be parsable with one token lookahead.
Anyways, kdev-pg spits out these warnings:
** WARNING found FIRST/FOLLOW conflict in
Rule ``((package_declaration | 0) !import_declaration)''
Terminals [IMPORT]
** WARNING found FIRST/FOLLOW conflict in
Rule ``(((package_declaration |
0) !import_declaration) !type_declaration)''
Terminals [IMPORT, CLASS]
** WARNING found FIRST/FIRST conflict in
Rule ``(((package_declaration |
0) !import_declaration) !type_declaration) -> compilation_unit''
Terminals [0]
It even goes as far as not accepting the "empty" testcase if I don't tell
kdev-pg to take 0 when not encountering AT or PACKAGE at package_declaration.
Is this a bug? Am I doing something wrong? Alright, next question:
Where do I put C++ blocks when I need them, and when are they executed?
(I'd love having just a tiny little example for that.)
I attached the current state (which is not very extensive yet, but I already
said that) of the directory containing lexer, grammar, test cases and the
other sources. Could you please skip quickly through the files and tell me if
I'm roughly heading in the right direction or not?
Also attached is a somewhat reduced grammar file spitting out the conflicts
that I mentioned above. I'm quite curious about how to handle these.
So far, best wishes,
Jakob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: grammarconflicts.g.gz
Type: application/x-gzip
Size: 1063 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20051103/0a65b9bd/attachment.gz>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: java.tar.gz
Type: application/x-tgz
Size: 31917 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20051103/0a65b9bd/attachment.bin>
More information about the KDevelop-devel
mailing list