help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Newbie Question re: Transforming a domain specific language.


From: Matt Friedman
Subject: Newbie Question re: Transforming a domain specific language.
Date: Mon, 22 Nov 2004 15:21:16 -0500

Hi All,

I'm quite the newbie here. I'm an experienced programmer but have
recently found a need to implement a small domain specific language.
Not only do I need to implement the language but I need to transform
it into something a little more friendly for another group to
interpret.  If this is the wrong list or a bad topic perhaps you can
let me know and steer me in the right direction.

Here is the basic idea of the language. I need the user to be able to
specify sets of things as such:

Set1 UNION Set2 INTERSECTION Set3 UNION !Set4

So, as you can see this is fairly simple. However, the user also needs
to be able to group expressions using brackets:

Set3 INTERSECTION (Set1 UNION Set2)

In this case the usual order of operations is changed so that the
UNION happens before the intersection. Without the brackets the
INTERSECTION part would have happened first. (INTERSECTION has
precedence over UNION).

In particular, I need to be able to produce an equivalent expression
without the brackets. To demonstrate I can show that:

Set3 INTERSECTION (Set1 UNION Set2)

is the same as:

Set3 INTERSECTION Set1 UNION Set3 INTERSECTION Set2

This can be applied to any arbitrarily complicated expression that
uses brackets such that the resulting expression yields the same
result but has no brackets. The non-bracket version can be executed
step-wise, whereas the version with brackets has a hierarchical
structure. For legacy reasons, the group I am passing this onto wants
to be able to execute a series of steps in a linear fashion without
having to worry about the hierarchical part.

So finally, to my question: is this a job for a language
generator/parser and if not, has anyone been faced with this challenge
and how might I approach it? Any pointers would be greatly
appreciated.

Many thanks,
Matt Friedman




reply via email to

[Prev in Thread] Current Thread [Next in Thread]