|Interpreter needed for a simple Language written in C AND Java email@example.com (Thomas =?iso-8859-1?Q?Mart=EDnez?=) (2001-04-22)|
|Re: Interpreter needed for a simple Language written in C AND Java firstname.lastname@example.org (Sean Montgomery) (2001-04-26)|
|Re: Interpreter needed for a simple Language written in C AND Java email@example.com (Neal Bridges) (2001-04-26)|
|Re: Interpreter needed for a simple Language written in C AND Java firstname.lastname@example.org (2001-04-26)|
|Re: Interpreter needed for a simple Language written in C AND Java email@example.com (Friedrich Dominicus) (2001-05-18)|
|Re: Interpreter needed for a simple Language written in C AND Java firstname.lastname@example.org (2001-05-22)|
|Re: Interpreter needed for a simple Language written in C AND Java email@example.com (2001-05-30)|
|From:||Thomas =?iso-8859-1?Q?Mart=EDnez?= <firstname.lastname@example.org>|
|Date:||22 Apr 2001 23:49:16 -0400|
|Keywords:||interpreter, question, comment|
|Posted-Date:||22 Apr 2001 23:49:16 EDT|
Hi from a newbie :-)
Hoping not to disturb you too much but I am leader of a project which
has to implement a calculating kernel which has to be embedded into
various C and Java applications. The main task of this kernel is to
calculate one result from about 100 parameters. These parameters are
used in a quite complex formula to compute the result.
Why an interpreter?
The administrator will check from time to time if the results obtained
by the kernel are still good enough. It not, he will change the formula,
test it and eventually send the new formula to hundreds of clients,
which from this point on are going ti use the new formula.
What is a simple language?
I think we only need some calculating facilities like adding,
subtracting, mutltipling, dividing and some functions like sin, atan,
exp and ln. I have found a lot of calcualtors build with lex/yacc (jay,
jlex) doing this.
Next we need a language which allows us to define and use variables. I
found something called mfcalc which does this already.
What bothers we mostly is that we need control structures in our
language like if-then-else, for, etc. It isn't too difficult to write
(or find in the internet) a grammar for this control structures in a
yacc-like style. As I understand it, one has to build something like
trees in the actions of the yacc-grammar which are then
interpreted/parsed at a later time. Or is there another way? One even
find some C sources for doing this tree generating/parsing/interpreting.
But I need it not only for C but in Java too!
Why do we need an implementation in C and in Java?
Well - the fact is, that some of our customers insist on C and are NOT
willing to use Java on their hosts. On the other hand we have got a
broad variety of platforms for the kernel and think that we are going to
save a lot of porting, testing, etc. if we are using java.
We do write our interpreter in one language - say C - and convert it to
Java. Do you know of a converter transforming Java to C or C to Java?
We do write the interpreter in a meta-language which can be translated
to C and to Java. Do you know of a compiler which is capable of
generating C AND Java code from a meta-language?
I will be glad for any comments, hints of you.
Thanks in advance - Thomas Martínez
[My usual advice for questions like this is to use an existing interpretive
language like TCL and not to reinvent the wheel. TCL is freely available
with an interpreter in rather portable C. And if you think you can avoid
platform testing by writing in Java, you're a lot more optimistic than I
Return to the
Search the comp.compilers archives again.