Writing a rules parser in ActionScript/JavaScript

"Thomas Goorden" <thomas.goorden@gmail.com>
Wed, 29 Aug 2007 12:44:23 +0200

          From comp.compilers

Related articles
Writing a rules parser in ActionScript/JavaScript thomas.goorden@gmail.com (Thomas Goorden) (2007-08-29)
Re: Writing a rules parser in ActionScript/JavaScript dot@dotat.at (Tony Finch) (2007-08-30)
| List of all articles for this month |

From: "Thomas Goorden" <thomas.goorden@gmail.com>
Newsgroups: comp.compilers
Date: Wed, 29 Aug 2007 12:44:23 +0200
Organization: Compilers Central
Keywords: parse, question
Posted-Date: 29 Aug 2007 15:55:18 EDT

[Note to compiler types: Flex is Adobe's development framework,
not the lexer generator. -John]

We're trying to find the best approach to write/create a fairly simple
rules parser for the Flex 2 environment. The idea is to create a sort
of advanced validation engine that can process Drools-like notation,
specifically the left hand side (conditional) part, eg:

Cheese( type == "stilton" && price < 10, age == "mature" )

This would then be used for writing dynamic input validation. However,
because the running environment will be the Flex (Flash) engine, we
need to create something in ActionScript. (yes, I know, don't shoot
the messenger)

I have had some successes with the javacc parser before, but I can't
seem to find a precompiler that has ActionScript as the target
language (or something close enough like JavaScript). Does this exist?

Failing that, what would be the best approach to write a parser like
that from scratch? My guess is to follow a simple design pattern for
it, keeping the target environment in mind. Since I don't want to
reinvent the wheel, a simple but proven idea would be best.

Kind regards,
Thomas Goorden

PS: Interestingly, the rules engine we're going to (partly) emulate
has its parser written with javacc and those sources are available.

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.