[antlr-interest] Java Grammar and how to use it to create a script language to my app

Randall R Schulz rschulz at sonic.net
Thu Oct 30 20:03:50 PDT 2008


On Thursday 30 October 2008 18:25, me tk82c wrote:
> Hello Everybody!
>
> I'm trying to create a new language to allow my users to write small
> scripts in our web app.
>
> There is any short way to do that? Something like, download the
> existent java grammar from ANTLR and implement the specific functions
> that users will use in my app with this "Java" version.

I don't think Java is a good model or pattern for an extension or 
application scripting language.

I am personally fond of Lisp and the general use of S-Expressions for 
programming languages of all stripes, but many people feel such 
languages cumbersome.

You'd probably be best advised to craft a language specific to the 
system it will control or drive and which will seem natural to its 
users.

ANTLR will help you detect and either eliminate or accommodate any 
abiguities in the grammar you devise, which is one of its many virtues.

And if Java really _is_ a good language for your purposes, then perhaps 
BeanShell would be appropriate. You should probably also consider, 
JavaScript or another JSR-223-compliant language before starting out 
from scratch inventing a scripting language.

Lastly, there are several dynamic languages that integrate well with 
Java and which can serve as scripting languages for programs written in 
Java. They include (but are by no means limited to) Groovy, Scala and 
Clojure.


In short, don't invent something you don't need and don't use a language 
that is too low-level (by which I mean Java itself) for your intended 
requirements and audience.


> Please, help!
>
> tk


Randall Schulz


More information about the antlr-interest mailing list