I would like to add syntax to Jython to enable a nicer API for users. For instance, matrix libraries like NumPy would benefit from having both matrix and elementwise operations like Matlab's :*
vs. *
infix operators.
You can create a matrix in Octave using:
A = [ 1, 1, 2; 3, 5, 8; 13, 21, 34 ]
which is considerably nicer than NumPy's:
b = array( [ (1.5,2,3), (4,5,6) ] )
R
uses formulas "y ~ x + z" for selecting variables in a matrix/data frame. This is considerably nicer than the alternative of ["y"] ["x","z"]
or parsing the string "y ~ x + y".
More complicated examples can be implemented in Cython using Easy Extend. But EasyExtend doesn't work on the JVM.
What is the easiest way but reasonably robust way to add syntax to Jython? It would be nice to have a framework to implement entirely new language constructs or define mini languages within jython.