chain one wrote:
I found using the same lex rule,the size of the generated .Java file is much smaller than the generated .C file.
For example, the size of the generated  .Java file is 124K, while the size of .c file could reach to 14M!!!
It's an illusion. In C, the transitions tables are laid down statically, and you see their true size, in Java they are expanded at runtime from run length encoded assignments, so you see the size at run time and there is an associated overhead in building them that is not present in C.

I have a task outstanding to look at optimizing the reuse of tables that happen to be repeats of others - this happens quite a lot and should reduce the memory requirements substantially. You can also often do better by looking at your lexer rules and being less precise about the characters you accept (or perhaps exclude) from a token and checking these externally to the rule. This allows better error messages anyway. The lexer will just say "Unexpected character 'x' at ...", wheras your own check can say "The identifier 'aaaaaxaaaaa' contains an illegal character 'x' ...."

Jim


List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---



List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

Reply via email to