develooper Front page | perl.perl6.language | Postings from July 2006

Re: Using Rules Today

Thread Previous | Thread Next
From:
Joshua Gatcomb
Date:
July 5, 2006 11:05
Subject:
Re: Using Rules Today
Message ID:
941eab840607051105x5068567es39802bd30f8161cf@mail.gmail.com
On 7/3/06, Paul Seamons <mail@seamons.com> wrote:
>
>
> It isn't specifically a parser designed for general language parsing, but
> CGI::Ex::Template does have a mathematical expression parser.


Thanks, but this falls into the realm of existing wheels which is a
different part of this project.


> perl -e 'use CGI::Ex::Template; $s=CGI::Ex::Template::dump_parse("3 * 4 **
> 2 +
> 5"); $s =~ s/\s+/ /g; print "$s\n"'
>
$VAR1 = [ \[ '+', [ \[ '*', '3', [ \[ '**', '4', '2' ], 0 ] ], 0 ], '5' ],
> 0 ];


Ok, but where is the evaluation?  I know it wouldn't be too hard to write
something that could evaluate this data structure to produce the correct
results but that is what this project is all about.  Some parsers make this
easier than others.  Some allow the expression to be evaluated as it is
parsed while some require additional homegrown code to parse the resulting
parse tree (data structure).

I have not had a chance to look at Flavio's links yet.  Since no one who
actually knows rules seemed to be inspired to write an example for me - I
will *eventually* figure it out on my own and post back to the list as an
FYI.

Paul Seamons


Cheers,
Joshua Gatcomb
a.k.a. Limbic~Region

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About