|
Hi,
I would like to use Python to connect to jbase database and also be able to call python functions from jbase (somethin like CALLJ or CALLC?). Is it possible?
In jbase website I see there was an attempt but I am unable to download the component. If any one already have it, could you share it with me?
I would like this more for personal interest. I donot have any particular requirement now (as of now).
Thanks
Guru |
The problem with python is the stupid indent syntax, which reveals it was designed by someone who knows nothing about language design, despite what is said about “human readable” and “forces indent levels”, which is the equivalent of saying that it is amazing that a pedestrian crossing was marked out just where people are crossing the road.
Other than that it isn’t any worse than any of the other ‘scripting’ languages that have come up over the years and better than some of them. I think that by far the easiest and best thing to do would be to hook the python interpreter into a jBASE aware DLL/.so and then you can just call python scripts directly from jBC. Looks like a couple of days work from their documentation.
Jim
Guru,
You could always use the C output (http://www.antlr.org/wiki/display/ANTLR3/ANTLR3+Code+Generation+-+C) from ANTLR 3 as the guy the wrote that is most handsome and most exceptionally clever and made sure it works with jBASE. I have a lot of respect for that man K
In C you have access to the jBASE internal variable via some easy to use macros – passing data in to and out of ATNLR generated C parsers is easy, as is writing ANLTR actions that use jBASE macros. In fact, this is how jQL in jBASE 4.1 is parsed. I also use ANTLR, but (version 3 this time) for the Query parser in Caché, though it is completely different (and a lot easier) in ANTLR 3 – that is one of the reasons I write the C output for ANTLR 3.
The Python output for ANTLR is really intended for situations where you already have Python as your application. Python isn’t as fast as C and in order to use the Python output with jBASE you would need to start the Python interpreter etc. On the other hand a C function to call you C parser is trivial and well supported in jBASE. Also, unless you don’t know Java, the Java output from ANTLR would work pretty easily too.
But, as I said, adding a C function to spark up the Python interpreter looks pretty easy to me.
I have a complete parser for jBC/Pick BASIC in ANTLR 3 – I am currently debating whether to make this public domain or not (there are probably wrinkles in it yet) as I may yet use it for products of my own.
Jim
From: jB...@googlegroups.com
[mailto:jB...@googlegroups.com] On Behalf Of Guru Prasanna Nagarajan
Sent: Wednesday, June 13, 2007 6:57 AM
To: Jbase Groups
Subject: Re: Python integration with jBase
Hi Daniel,
</div
Jim,
Thanks for that Link. I will do further reading and on doubts now I know which ‘clever’ man to get hold of!!.
Of course I would look out for Pick Basic ANTLR 3, if you are going to make put it in Public domain!!
guru
I have a complete parser for jBC/Pick BASIC in ANTLR 3 – I am currently debating whether to make this public domain or not (there are probably wrinkles in it yet) as I may yet use it for products of my own.
Daniel,
Thanks for the attachment.
Rgds
Guru
From: jB...@googlegroups.com [mailto:jB...@googlegroups.com] On Behalf Of Daniel Klein
Sent: Friday, June 22, 2007 12:47
AM
To: jB...@googlegroups.com
Subject: Re: Python integration
with jBase
Guru,