Chris Lambrou wrote: > Is there a recommended way of writing a grammar so that it can be used to > target different runtimes? I'd like to be able to use the same grammar to > target both C# (for use in an ASP.NET server application) and in JavaScript > (for use by clients). The ANTLR book is filled with examples of how useful > it can be to embed Java code within the grammar, but this couples the > grammar to a specific runtime, which is something I'm explicitly trying to > avoid. > > Regards, > > Chris >
I just started with ANTLR this week. I think the answer is along the lines of: use one grammar (lexer/parser) to create a AST (abstract syntax tree) for your intermediate language representation. Then, you just need to make multiple tree grammers to translate that AST into multiple target languages. 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 -~----------~----~----~----~------~----~------~--~---
