Discussion:
[ragel-users] Grammer containing union of many expressions
Nico Verwer
2014-02-19 16:19:14 UTC
Permalink
Hello Ragel users,

I have a grammar that Ragel cannot generate (Java) code for. It just stops
working without any (visible) error message.

My grammar contains more than 30,000 rules of the form
nameX = "title 1" | "title 2" | ... ;
and then one rule which is the union of all of the 32,000 nameX:
allOfThese = nameX | nameY | ... | nameZ ;

It is the last rule (allOfThese) that makes Ragel crash.

I am using Ragel on a windows (64-bit) machine, and the system logs only
tells me that the application crashed.

Would it help to compile Ragel on a unix machine (which I don't have access
to at the moment) or under MinGW? Or will it never work with such an
insanely large union?

Your insights are much appreciated.

Best regards,
Nico Verwer

(CAPTCHA on gmane says "short", which is not true of my grammar.)
Adrian Thurston
2014-02-19 18:53:05 UTC
Permalink
You might try refactoring the strings to pull out common prefixes. When you're doing this, incrementally add in machines to see where the cost is.
------Original Message------
From: Nico Verwer
Sender: ragel-users-bounces at complang.org
To: ragel-users
ReplyTo: ragel-users
Subject: [ragel-users] Grammer containing union of many expressions
Sent: Feb 19, 2014 11:19 AM

Hello Ragel users,

I have a grammar that Ragel cannot generate (Java) code for. It just stops
working without any (visible) error message.

My grammar contains more than 30,000 rules of the form
nameX = "title 1" | "title 2" | ... ;
and then one rule which is the union of all of the 32,000 nameX:
allOfThese = nameX | nameY | ... | nameZ ;

It is the last rule (allOfThese) that makes Ragel crash.

I am using Ragel on a windows (64-bit) machine, and the system logs only
tells me that the application crashed.

Would it help to compile Ragel on a unix machine (which I don't have access
to at the moment) or under MinGW? Or will it never work with such an
insanely large union?

Your insights are much appreciated.

Best regards,
Nico Verwer

(CAPTCHA on gmane says "short", which is not true of my grammar.)
Nico Verwer
2014-02-21 09:09:27 UTC
Permalink
Post by Adrian Thurston
You might try refactoring the strings to pull out common prefixes. When you're doing this, incrementally add in machines to see where the cost is.
------Original Message------
I have a grammar that Ragel cannot generate (Java) code for. It just stops
working without any (visible) error message.
My grammar contains more than 30,000 rules of the form
nameX = "title 1" | "title 2" | ... ;
allOfThese = nameX | nameY | ... | nameZ ;
It is the last rule (allOfThese) that makes Ragel crash.
I think pulling out common prefixes will help. I thought the parser
generator would do that, but now I understand it doesn't.
Thanks for the suggestion!


---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com

Loading...