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 wrote: > On 8 Jan., 16:25, J Kenneth King 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

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 wrote: > Jonathan Gardner 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 Python that will compile your "DSL." >

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-08 Thread J Kenneth King
Kay Schluehr writes: > On 8 Jan., 16:25, J Kenneth King 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 importa

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 Kay Schluehr
On 8 Jan., 16:25, J Kenneth King 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 syntactical Python exte

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

2009-01-08 Thread J Kenneth King
Jonathan Gardner writes: > On Jan 7, 9:16 am, "Chris Mellon" 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 >> impl

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" 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 internal DSL i

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 wrote: > Jonathan Gardner writes: > > On Jan 6, 12:24 pm, J Kenneth King wrote: > >> Jonathan Gardner writes: > >> > On Jan 6, 8:18 am, sturlamolden wrote: > >> >> On Jan 6, 4:32 pm, mark wrote: > > >> >> > I want to implement a internal DSL in Python. I woul

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 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 an internal DSL and NOT

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

2009-01-07 Thread J Kenneth King
Kay Schluehr writes: > On 7 Jan., 16:50, J Kenneth King 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

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 wrote: > Jonathan Gardner writes: > >> On Jan 6, 12:24 pm, J Kenneth King wrote: >>> Jonathan Gardner writes: >>> > On Jan 6, 8:18 am, sturlamolden wrote: >>> >> On Jan 6, 4:32 pm, mark wrote: >>> >>> >> > I want to implement a internal DSL in Py

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 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 have nothing to do w

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

2009-01-07 Thread J Kenneth King
Jonathan Gardner writes: > On Jan 6, 12:24 pm, J Kenneth King wrote: >> Jonathan Gardner writes: >> > On Jan 6, 8:18 am, sturlamolden wrote: >> >> On Jan 6, 4:32 pm, mark wrote: >> >> >> > I want to implement a internal DSL in Python. I would like the syntax >> >> > as human readable as possi

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 wrote: > Jonathan Gardner writes: > > On Jan 6, 8:18 am, sturlamolden wrote: > >> On Jan 6, 4:32 pm, mark wrote: > > >> > I want to implement a internal DSL in Python. I would like the syntax > >> > as human readable as possible. > > >> Also beware that Python

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

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

2009-01-06 Thread J Kenneth King
Jonathan Gardner writes: > On Jan 6, 8:18 am, sturlamolden wrote: >> On Jan 6, 4:32 pm, mark 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

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

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 e

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 wrote: > On Jan 6, 4:32 pm, mark 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). This isn't

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 wrote: > On Jan 6, 4:32 pm, mark 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 make writing a language interpreter al

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 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). -- http://mail.python.org/mailman/listinfo/python-list

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 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 Python. - Expose the DSL

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 h