I've finally got my full grammar up earlier today and ran into the "String is too long" Java issue.
I understand that this problem has been resolved but I was afraid of running into other limitations so I decided to switch to using the C# target. I'm an experienced C++ programmer and learned Java to be able to use Antlr4, switching to C# is no big deal, just a new syntax to learn.
I am now getting the message: 1>CSC : fatal error CS1647: An expression is too long or complex to compile
There's no other information provided. Has anyone seen this one before with code generated by Antlr4? I searched the web for the message but found nothing that could help (many references to older bugs that are supposed to be fixed).
My project is currently composed of a single .cs file along with 2 .g4 file (lexer and parser grammars).
The grammar is pretty complex (implement a language define in an IEEE standard).
I originally implemented a subset of the grammar using the Java target without any issues.
Any pointers are appreciated.
Here's some additional information. I am using Visual Studio 2012. It seems to be the same a different version of the Java issue I originally saw.
I was able to create a sample C# file containing just the line :
public static readonly string _serializedATN =
"\x5\x3\x176\x234A\x4\x2\t\x2\x4\x3\t\x3\x4\x4\t\x4\x4\x5\t\x5\x4\x6\t"+
"\x6\x4\a\t\a\x4\b\t\b\x4\t\t\t\x4\n\t\n\x4\v\t\v\x4\f\t\f\x4\r\t\r\x4"+
"\xE\t\xE\x4\xF\t\xF\x4\x10\t\x10\x4\x11\t\x11\x4\x12\t\x12\x4\x13\t\x13"+
"\x4\x14\t\x14\x4\x15\t\x15\x4\x16\t\x16\x4\x17\t\x17\x4\x18\t\x18\x4\x19"+
"\t\x19\x4\x1A\t\x1A\x4\x1B\t\x1B\x4\x1C\t\x1C\x4\x1D\t\x1D\x4\x1E\t\x1E"+
"\x4\x1F\t\x1F\x4 \t \x4!\t!\x4\"\t\"\x4#\t#\x4$\t$\x4%\t%\x4&\t&\x4\'"+
"\t\'\x4(\t(\x4)\t)\x4*\t*\x4+\t+\x4,\t,\x4-\t-\x4.\t.\x4/\t/\x4\x30\t"+
"\x30\x4\x31\t\x31\x4\x32\t\x32\x4\x33\t\x33\x4\x34\t\x34\x4\x35\t\x35"+
...
...
"\x2316\x231E\x2324\x2328\x232D";
and the issue was reproducible. The line is over 4400 lines long. The C# compiler doesn't seem to be able to handle this many concat. I was trying to avoid removing the keyword from my language and creating a hash table with them. This might be my only solution at this time.
I have looked around a found that this could be due to a "deep recursion problem" thrown at the compiler. What this means is that the compiler has problems parsing an expression due to it being too complex. For more information, see Build error: "An expression is too long or complex to compile" and http://ayende.com/blog/3528/setting-out-to-break-the-compiler.