looking for tips on how to implement "ruby-style" Domain Specific Language in Python

J Kenneth King james at agentultra.com
Fri Jan 9 00:35:41 CET 2009


Kay Schluehr <kay.schluehr at gmx.net> writes:

> On 8 Jan., 16:25, J Kenneth King <ja... at agentultra.com> wrote:
>
>> As another poster mentioned, eventually PyPy will be done and then
>> you'll get more of an "in-Python" DSL.
>
> May I ask why you consider it as important that the interpreter is
> written in Python?

I don't think it's important for Python to have a meta-circular
interpreter (though it can't hurt).

> I see no connection between PyPy and syntactical
> Python extensions and the latter isn't an objective of PyPy. You can
> write Python extensions with virtually any Python aware parser.
> M.A.Lemburg already mentioned PLY and PLY is used for Cython. Then
> there is ANTLR which provides a Python grammar. I also know about two
> other Python aware parsers. One of them was written by myself.

Because... there is no connection to see? I never mentioned any such
relation.

DSL's tend to be a natural side-effect of languages which can manipulate
their own expressions without extensive parsing.

Creating a new parser that can generate Python AST's is certainly a
valid approach (and probably the easiest one). It's not the only one.

It depends on your definition of a DSL.

My definition isn't satisfied with creating a parser, and so my answers
reflect that.



More information about the Python-list mailing list