Re: Hacking BeanShell with JavaCC

"Daniel Leuck" <[email protected]> Thu, 17 Apr 2008 10:14:56 -1000
Newsgroups gmane.comp.java.beanshell.devel
Message-ID <[email protected]>
Hi fschmidt,

>  Yes but to create a MATLAB replacement, you need operator overloading too,
>  so that you can do things like add matrices.

I'm just writing a few blog posts about how to use JJTree to hack
BeanShell.  I'm not trying to create a new language or replace MATLAB.
 I hope these posts help you get started if you decide to take on this
ambitious project.  Note, if you are trying to do computationally
intensive tasks you might want to work with a language that generates
bytecode or even native code.  As someone mentioned earlier in this
thread, Groovy might be a good starting point.  BeanShell only emits a
minimal amount of bytecode to enable subclassing.

>  And by the way, "<>" is used for "not equal" in Basic, so maybe "<=>" would
>  be better for "equivalent", and this is the mathematical symbol for
>  equivalent propositions.  Then "<>" could be used for "not equivalent" (less
>  than or greater than).

Good point.  When I have time I'll make this change to the example.

>  > I could implement generic operator overloading, but that might be a
>  > long blog post :-)
>
>  But this might be quite useful.  It would be great to see a discussion about
>  what is the best way to do generic operator overloading, and then to
>  implement this in BeanShell.

I've used C#'s operator overloading for matrix operations.  Its well
designed.  If I were to implement such a feature I would probably use
C#'s approach as a basis.

Cheers,
Dan

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone