This project has moved and is read-only. For the latest updates, please go here.

Possible bug in Parse method

Mar 28, 2011 at 4:24 PM



First thanks for a great project. Its definitely one of the open source projects I use the most.

I was just looking at how Irony operates and I noticed something strange. When Parser object is instantiated I also add my grammar, so like:


var myGrammar = new Parser(new MyGrammar());


Constructor then somewhere in the background uses SymbolTable class to add symbols. It has a static property Symbols of the same type.


Then when I parse text like:



It again uses SymoblTable, but the problem is that all identifiers are also added to the symbol dictionary, which is static. 

For example in IdentifierTerminal.cs file there is a method QuickParse and at the end there is the following line

token.Symbol = SymbolTable.Symbols.TextToSymbol(token.ValueString); 


Shouldn't this be 

token.Symbol = SymbolTable.Symbols.FindSymbol(token.ValueString); 


I wanted to create a fix, but I have so little knowledge about how its written I figured I'd rather ask if this is intended or if its a bug.

It feels strange that symbols are mixed with the query text. The biggest problem is that since it is static this is never collected until the app is closed. So if I parse a lot of text I will end up with a huge static dictionary.


Thanks for a great project.

Mar 28, 2011 at 5:15 PM

I am interested in this one too.  I wonder if this explains why when parsing one particular file of mine, I end up consuming 6Gb of memory before it finally crashes?  Which is strange because I wouldnt expect it to have generated much more than a couple hundred Megabytes, allowing for some overheads after structuring the data. 

My intention was to try a new approach to get around this issue and split my text file down into small chunks and parse them individually.  If what you are saying is true, then this approach wouldnt work either?  (I would need to mount Irony as an App Domain for each chunk to be processed?)


Mar 29, 2011 at 1:53 AM

Will look at this tonight

Mar 30, 2011 at 6:20 AM

unbelievable... that it's still there... unbe-freakin-lievable.... 

I vaguely remember seeing/creating this static member before, but I was absolutely sure I fixed that loong time ago. Yes, it's a bug, or more like initial design shortcut that was never fixed. Thanks guys for finding this, I'm working on a fix. 

Additionally, looks like move to Mercurial messed up the sources in tip, lot of extra files/folders appear that should be long gone. Need to fix that.

thanks again and sorry for this overlook


Jun 14, 2011 at 12:28 PM

Hi Roman,

Did you manage to get anywhere with a fix for this issue?


Jun 14, 2011 at 8:50 PM

Not yet, sorry. Had been busy with other things. I plan to get back to Irony in a week or two and fix all the outstanding issues that piled up. I think it's time to move to beta, finally