Well, it all depends of what you want to learn about of course: the JVM bytecode or the creation of a DSL. In the former case it might be a bit of an overkill to start learning about language parser frameworks. If you keep your syntax simple and straightforward you can quickly write your own basic parser and concentrate on the bytecode generation.
On Jan 7, 12:25 pm, Kram <[email protected]> wrote: > Thanks all very much, strangely, I was for some reason expecting a > whole heap of posts from people saying things like: > > "You must create your own c++ compiler that does A, B and C" (is javac > written in c++?) > > But I guess not... thanks for the links so far! I really appreciate > the help. > > Mark > > On Jan 7, 8:08 pm, "Jan Goyvaerts" <[email protected]> wrote: > > > Personally I don't know about Rats - but I would also advise to go for the > > language parser approach. A structured approach towards implementing a DSL. > > I certainly recommend the Antlr book of Pragmatic Programmers > > (http://www.pragprog.com/titles/tpantlr/the-definitive-antlr-reference). > > > You could be the first to create a DSL with a feature we all use but is > > provided by no language so far: Say "Hello World". ;-) > > > On Wed, Jan 7, 2009 at 9:21 AM, Reinier Zwitserloot > > <[email protected]>wrote: > > > > Personally i advise using rats instead of ANTLR, but, ymmv. > > > > On Jan 7, 3:16 am, RogerV <[email protected]> wrote: > > > > I've been using ANTLR for my "little" language, SFig: > > > > >http://code.google.com/p/sfig/ > > > > > I've used flex/bison (GUN lex and yacc clones) in the past to roll a > > > > XSLT parser and have very much liked working with ANTLR as a contrast. > > > > > ANTLR by default is geared toward creating language parsers that > > > > target the Java JVM, however, it can also target C/C++, C# .NET, > > > > ActionScript3. (This turns out to be quite advantageous to my > > > > particular language project.) > > > > > I like that lexical definitions are rolled into the same source file > > > > as the grammar. > > > > > I like the ANTLR concept of optionally being able to devise a tree > > > > grammar to process AST. I structured SFig in this manner. > > > > > The first pass creates tree structure AST, and then a second pass can > > > > be made over the AST to do actions. In ANTLR you actually encode a > > > > tree grammar that looks very similar to the language grammar. > > > > > For ultra simple languages with very minimalist purposes, doing a tree > > > > grammar might be overkill, but it's a handy way to structure things > > > > when you get to have a bit more complexity going on. > > > > > Also, if you buy the ANTLR book, it has a section on doing byte code > > > > enhancement, which is way to get introduced to messing with Java byte > > > > code. > > > > > Messing with ANTLR is bound to give inspiration for doing some > > > > actually practical language tools - in addition to being a good > > > > environment to learn language parsing with. > > > > > --Roger > > > > > On Jan 6, 3:43 am, Kram <[email protected]> wrote: > > > > > > For a while now, I've been wanting to get my hands dirty on Java and > > > > > the JVM, by this is mean getting to know bytecode, and how compilers > > > > > work, JIT, the JVM in general, etc... > > > > > > So the best thing I figure to do is to write my own, very basic, > > > > > language for the JVM. Even if it provides no real benefit to anyone, I > > > > > would really like to give this a try. > > > > > > Languages really interest me and any help on this topic would be > > > > > greatly appreciated. > > > > > > Thanks a lot, > > > > > Mark --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "The Java Posse" 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/javaposse?hl=en -~----------~----~----~----~------~----~------~--~---
