gold parser & java

4 views
Skip to first unread message

christoph...@yahoo.fr

unread,
Jun 13, 2008, 4:14:59 AM6/13/08
to GOLD Parsing System
How do you link a function call in a script with a java function ?

For example, if you have the "l = GetLength(str)" scipt line. How do
you link it with the "Integer GetLength(String str)" java function ?

Thanks for your help

Dave Dolan

unread,
Jun 13, 2008, 8:59:04 AM6/13/08
to gold-pars...@googlegroups.com
You have to write yourself an interpreter. A Parser is just the front end.  Use the parser to build an Abstract Syntax tree.  Each of the nodes in the syntax tree needs to have an Execute or Evaluate method, which recursively calls evaluate on it's children and then itself. passing the values or actions up the tree. 
 
You apparently have greatly underestimated what you're trying to do here ;)

--
---------------------------------------------------------------
Dave Dolan
Certified Computer Geek-inator
http://davedolan.com
dave....@gmail.com

christoph...@yahoo.fr

unread,
Jul 2, 2008, 9:34:52 AM7/2/08
to GOLD Parsing System
I'm using the hawkins java parser.
In the C langage, the link between the script and the functions is
done through a function pointers array.
How does it work in java ?

Thanks for your help


On 13 juin, 14:59, "Dave Dolan" <dave.do...@gmail.com> wrote:
> You have to write yourself an interpreter. A Parser is just the front end.
> Use the parser to build an Abstract Syntax tree.  Each of the nodes in the
> syntax tree needs to have an Execute or Evaluate method, which recursively
> calls evaluate on it's children and then itself. passing the values or
> actions up the tree.
>
> You apparently have greatly underestimated what you're trying to do here ;)
>
> On Fri, Jun 13, 2008 at 4:14 AM, <christophe_poti...@yahoo.fr> wrote:
>
> > How do you link a function call in a script with a java function ?
>
> > For example, if you have the "l = GetLength(str)" scipt line. How do
> > you link it with the "Integer GetLength(String str)" java function ?
>
> > Thanks for your help
>
> --
> ---------------------------------------------------------------
> Dave Dolan
> Certified Computer Geek-inatorhttp://davedolan.com
> dave.do...@gmail.com

Dave Dolan

unread,
Jul 2, 2008, 9:06:48 PM7/2/08
to gold-pars...@googlegroups.com
You build a tree. Check out the example that's on Devin's Site:

http://www.devincook.com/goldparser/engine/java/index.htm

Finally at the top you can either call an executable
dave....@gmail.com
Reply all
Reply to author
Forward
0 new messages