Thanks (again!) Jim. I'll take that under advisement. I've had the LIPs ebook for some time now (just received the hardcopy this week) but haven't dug too deep in it. I'll do that now.
-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Jim Idle Sent: Friday, January 08, 2010 2:31 PM To: [email protected] Subject: Re: [antlr-interest] Can ST be used to generate binary output? It is usually better to produce an intermediate assembler representation of your byte code then have a parser that can assemble that in to byte code. You will for instance need to resolve the targets of 'jmp' and things like that and having an assembly language listing of the 'byte code' lets you be more productive when debugging and so on. Such assembly/intermediate languages are also good for optimizing phases. When I need multiple different outputs like this then I create an Abstract class with common functionality for code generation and derive generators for each target from that. I have the code generator create StringTemplates when this is what is needed and also have a code generator that produces the byte code. Then I have the tree walker call the code generation methods rather than create templates directly in the tree grammar. You can then do multiple walks with different code generators. If you are trying to generate Java byte code then write a code generator that interfaces to the ASM package: http://asm.ow2.org/ which is very good. There is also LLVM of course. Finally I think that you would benefit greatly from reading the new book: http://pragprog.com/titles/tpdsl/language-implementation-patterns Which will guide you through some working of examples of all of this stuff. 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.
