Thank you. I didn't know about being
able to turn off
case sensitivity. That makes things
a lot easier just
by itself. I at one point put
the token strings in the rules,
but had problems with it. I'll
try it again, now that the
grammar is more debugged. I also
wasn't sure about
whether breaking things down further
was better or
worse. I assumed more rules would
be worse, so
I didn't break things down as far as
might have.
Thank you again for your help.
-- Larry
From:
Per Cederberg <address@hidden>
To:
address@hidden
Date:
04/03/2013 11:49 AM
Subject:
Re: [Grammatica-users]
Grammatica Hangs
Sent by:
address@hidden
Ah, yes. It is always java... Guess it shows how much
time has passed since I used Grammatica myself. ;-)
The problem is in the rule CellParameterList (found that
out by commenting out the suspicious rule bodies one by one). It seems
that the rule bodies "... (A B C?)? ..." are problematic, i.e.
using nested optional elements. Better to break this out as separate rules.
The reason for the loop here is probably related to the
Grammatica analysis of the tokens used in each rule. When too much is optional,
this set grows very large and risks triggering these kind of issues.
CellParameter = "width" "=" NUMBER
| "height" "="
NUMBER
| "verticaloffset" "="
NUMBER
...
Better still might be to break out these even further:
HeightParameter = "height" "=" NUMBER
;
VerticalOffsetParameter = "verticaloffset" "="
NUMBER ;
A few further comments:
1. XML is hard to parse properly with a tool like Grammatica,
since its structure cannot be fully captured in regex tokens and LL(k)
productions in a sensible manner. That said, it is still possible to create
something useful for machine-generated inputs.
2. The grammar would be easier and faster if fewer regexes
were used. Use case-insensitive tokens for example. And create tokens that
have a "higher level". Like this:
3. Use the token strings in the rules to make things more
readable. Such as in the example Cell* rules above.
Cheers,
/Per
On Wed, Apr 3, 2013 at 5:57 PM, <address@hidden>
wrote:
I'm generating C#, and I'm using it
on .Net, but my command line is:
"C:\Program Files (x86)\Java\jre6\bin\java" -jar lib/grammatica-1.5.jar
XSLTableCreator2.parser --parse Test.txt
The grammar is attached.
From: Per
Cederberg <address@hidden>
To: address@hidden
Date: 04/03/2013
10:47 AM
Subject: Re:
[Grammatica-users] Grammatica Hangs
Sent by: grammatica-users-bounces+lmaturo=address@hidden
If it's not secret or too large, try posting the grammar file to this group.
Also. Are you using the Java or the .NET version?
Cheers,
/Per
On Wed, Apr 3, 2013 at 5:44 PM, <address@hidden>
wrote:
I have a grammar I was debugging, and after a fix to the grammar, Grammitica
just hangs with no output. I've seen that it has code to detect infinite
loops, but
it sure looks like it's in one that isn't detected.