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

2009-01-09 Thread Jonathan Gardner
On Jan 8, 7:25 am, J Kenneth King ja...@agentultra.com wrote: Jonathan Gardner jgard...@jonathangardner.net writes: It seems we're defining DSL in two different ways. You can't write a DSL in Python because you can't change the syntax and you don't have macros. You can write a compiler in

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

2009-01-09 Thread Jonathan Gardner
On Jan 8, 8:03 am, Kay Schluehr kay.schlu...@gmx.net wrote: On 8 Jan., 16:25, J Kenneth King ja...@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

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

2009-01-08 Thread J Kenneth King
Jonathan Gardner jgard...@jonathangardner.net writes: On Jan 7, 9:16 am, Chris Mellon arka...@gmail.com wrote: The OP wants a Ruby-style DSL by which he means something that lets me write words instead of expressions. The ruby syntax is amenable to this, python (and lisp, for that matter)

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

2009-01-08 Thread Kay Schluehr
On 8 Jan., 16:25, J Kenneth King ja...@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 see no connection between PyPy and

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

2009-01-08 Thread mark
So you can't make an internal DSL like this that uses Python's built- in grammar.  You'd have to hack the parser or settle for an external preprocessor. This time it is really hard for me but I begin accepting the fact that I will have to build an external DSL. I experimented some weeks ago

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

2009-01-08 Thread J Kenneth King
Kay Schluehr kay.schlu...@gmx.net writes: On 8 Jan., 16:25, J Kenneth King ja...@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

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

2009-01-08 Thread Kay Schluehr
O.K. Mark. Since you seem to accept the basic requirement to build an *external* DSL I can provide some help. I'm the author of EasyExtend ( EE ) which is a system to build external DSLs for Python. http://www.fiber-space.de/EasyExtend/doc/EE.html EE is very much work in progress and in the last

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

2009-01-07 Thread J Kenneth King
Jonathan Gardner jgard...@jonathangardner.net writes: On Jan 6, 12:24 pm, J Kenneth King ja...@agentultra.com wrote: Jonathan Gardner jgard...@jonathangardner.net writes: On Jan 6, 8:18 am, sturlamolden sturlamol...@yahoo.no wrote: On Jan 6, 4:32 pm, mark mark.fi...@googlemail.com wrote:

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

2009-01-07 Thread Kay Schluehr
On 7 Jan., 16:50, J Kenneth King ja...@agentultra.com wrote: Python expressions are not data types either and hence no macros -- I can't write a python function that generates python code at compile time. Have you ever considered there are languages providing macros other than Lisp? Macros

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

2009-01-07 Thread Chris Mellon
On Wed, Jan 7, 2009 at 9:50 AM, J Kenneth King ja...@agentultra.com wrote: Jonathan Gardner jgard...@jonathangardner.net writes: On Jan 6, 12:24 pm, J Kenneth King ja...@agentultra.com wrote: Jonathan Gardner jgard...@jonathangardner.net writes: On Jan 6, 8:18 am, sturlamolden

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

2009-01-07 Thread J Kenneth King
Kay Schluehr kay.schlu...@gmx.net writes: On 7 Jan., 16:50, J Kenneth King ja...@agentultra.com wrote: Python expressions are not data types either and hence no macros -- I can't write a python function that generates python code at compile time. Have you ever considered there are

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

2009-01-07 Thread Carl Banks
On Jan 6, 9:32 am, mark mark.fi...@googlemail.com wrote: I want to implement a internal DSL in Python. I would like the syntax as human readable as possible. This means no disturbing '.;()\' characters. I like to have the power of the hosting language as well. Thats why I want to build it as

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

2009-01-07 Thread Jonathan Gardner
On Jan 7, 7:50 am, J Kenneth King ja...@agentultra.com wrote: Jonathan Gardner jgard...@jonathangardner.net writes: On Jan 6, 12:24 pm, J Kenneth King ja...@agentultra.com wrote: Jonathan Gardner jgard...@jonathangardner.net writes: On Jan 6, 8:18 am, sturlamolden sturlamol...@yahoo.no

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

2009-01-07 Thread Jonathan Gardner
On Jan 7, 9:16 am, Chris Mellon arka...@gmail.com wrote: The OP wants a Ruby-style DSL by which he means something that lets me write words instead of expressions. The ruby syntax is amenable to this, python (and lisp, for that matter) syntax is not and you can't implement that style of

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

2009-01-06 Thread mark
I want to implement a internal DSL in Python. I would like the syntax as human readable as possible. This means no disturbing '.;()\' characters. I like to have the power of the hosting language as well. Thats why I want to build it as an internal DSL and NOT as a external DSL. I want the DSL as

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

2009-01-06 Thread sturlamolden
On Jan 6, 4:32 pm, mark mark.fi...@googlemail.com wrote: Is it possible to switch between the custom DSL and the standard Python interpreter? As far as I can tell, there are three different options: - Embed a Python and DSL interpreter in the same executable. - Write the DSL interpreter in

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

2009-01-06 Thread sturlamolden
On Jan 6, 4:32 pm, mark mark.fi...@googlemail.com wrote: I want to implement a internal DSL in Python. I would like the syntax as human readable as possible. Also beware that Python is not Lisp. You cannot define new syntax (yes I've seen the goto joke). --

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

2009-01-06 Thread Jonathan Gardner
On Jan 6, 8:13 am, sturlamolden sturlamol...@yahoo.no wrote: On Jan 6, 4:32 pm, mark mark.fi...@googlemail.com wrote: Is it possible to switch between the custom DSL and the standard Python interpreter? - Write the DSL interpreter in Python. There are Python modules out there that

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

2009-01-06 Thread Jonathan Gardner
On Jan 6, 8:18 am, sturlamolden sturlamol...@yahoo.no wrote: On Jan 6, 4:32 pm, mark mark.fi...@googlemail.com wrote: I want to implement a internal DSL in Python. I would like the syntax as human readable as possible. Also beware that Python is not Lisp. You cannot define new syntax (yes

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

2009-01-06 Thread Kay Schluehr
How would one approach this in Python? Do I need to build a custom loader which compiles *.dsl files to *.pyc files? Is it possible to switch between the custom DSL and the standard Python interpreter? Sure, but there is no way to avoid extending the Python parser and then your DSL becomes

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

2009-01-06 Thread M.-A. Lemburg
On 2009-01-06 20:42, Kay Schluehr wrote: How would one approach this in Python? Do I need to build a custom loader which compiles *.dsl files to *.pyc files? Is it possible to switch between the custom DSL and the standard Python interpreter? Sure, but there is no way to avoid extending the

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

2009-01-06 Thread J Kenneth King
Jonathan Gardner jgard...@jonathangardner.net writes: On Jan 6, 8:18 am, sturlamolden sturlamol...@yahoo.no wrote: On Jan 6, 4:32 pm, mark mark.fi...@googlemail.com wrote: I want to implement a internal DSL in Python. I would like the syntax as human readable as possible. Also beware

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

2009-01-06 Thread Steve Holden
J Kenneth King wrote: [...] I could go on a really long rant about how the two are worlds apart, but I'll let Google tell you if you're really interested. a) How is Google going to know if he's really interested? b) Put a space after the -- in your sig, please; that way my mailer won't yto to

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

2009-01-06 Thread Jonathan Gardner
On Jan 6, 12:24 pm, J Kenneth King ja...@agentultra.com wrote: Jonathan Gardner jgard...@jonathangardner.net writes: On Jan 6, 8:18 am, sturlamolden sturlamol...@yahoo.no wrote: On Jan 6, 4:32 pm, mark mark.fi...@googlemail.com wrote: I want to implement a internal DSL in Python. I would