views:

204

answers:

1

Hey all,

I'm looking for some ANTLR v3 examples, I tried googling a bit but I found certain things which didn't fit my requirments. I found the Mantra project, but it's statically typed and is 'too' big for me at this moment, then I found 'pie' as interpreter, which is dynamically typed, which what I want, but it uses a syntax-directed interpreter.

I'm looking for a pretty small language which is dynamically typed and uses AST's if possible. It doesn't need to be advanced, if it would have classes I would already be very happy.

I don't really care about the target language, as I already have experience with most of the target languages of ANTLR v3, and code isn't that hard to read much.

Thanks,

William van Doorn

+1  A: 

Physicalc sounds like it may be what you're after.

EDIT - as per comments: Here is my work-in-progress toy language.

etheros
Thanks, but the problem here is that they're using ANTLR v2.x, where there have been big changes from v2 to v3, so it's kind of unusable, thanks though, will keep this in mind.
wvd
I wrote a toy language based on Physicalc using ANTLR 3. It's not complete (ie. only supports variables, constants, and in-built functions), but I'd be happy to post it if you think it'd be of any use.
etheros
I would be happy with that, since classes aren't a that big requirment, if you don't mind posting it, could you please do that?
wvd
Thanks, but does this fully work with the existing Physicalc implementation, by just changing the grammar file?
wvd
While most of the underlying infrastructure is extremely similar, I doubt the interpreter implementation is interchangeable. I'll upload what I have in case it's of some use.
etheros
Do you still work on that project? I'm merely interested in how to handle those "return" statements in function blocks and such.
wvd
It's a perpetual work in progress. :) Physicalc does it with exceptions. See http://code.google.com/p/bcis/source/browse/trunk/src/physicalc/Function.java
etheros
I see -- I'm kind of starting my hobby project for now to write an implementation with ANTLR on the JVM, do you have any kind of IM/E-mail, so we could talk?
wvd
I don't really use IM, but I just added a reCAPTCHA link to my email to my profile.
etheros