Symbols as parameters?

Carl Banks pavlovevidence at gmail.com
Fri Jan 22 04:18:33 EST 2010


On Jan 21, 11:43 pm, Martin Drautzburg <Martin.Drautzb... at web.de>
wrote:
> > Paul McGuire should be by to recommend PyParsing shortly.
>
> I looked it up and it seems to be about parsing strings. This is not
> what I am looking for as it would create a separate world outside of
> python. But I haven't looked deeply yet.

Well, it's not necessarily a whole world outside Python, since an
external DSL can be tied to the underlying to some degree.

For example, a simple external DSL might input a string like this:

"move up"

parse it (such as with PyParsing), and output a string like this:

"move(direction.up)"

which can then be execed.  It wouldn't be a whole new language, just
an altered syntax.

However, you are right in that, if you don't want to go creating your
own syntax, PyParsing will be of no help.  You'll have to shoehorn
your DSL in a language not well suited for the task as best you can.


Carl Banks



More information about the Python-list mailing list