looking for tips on how to implement "ruby-style" Domain Specific Language in Python
J Kenneth King
james at agentultra.com
Wed Jan 7 15:50:10 EST 2009
Kay Schluehr <kay.schluehr at gmx.net> writes:
> On 7 Jan., 16:50, J Kenneth King <ja... at 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?
Of course.
> Macros have nothing to do with homoiconcity.
Not directly, no.
>> I can only write a python
>> program that parses some other string and generates code that can be run
>> by another interpreter.
>
> No, it is the same interpreter and it is also possible to modify
> python parsers on the fly. This is just not possible with Pythons
> builtin parser.
PyPy is probably the best bet when/if it gets finished.
>
>
>>
>> Consider:
>>
>> for i in range(0, 100):
>> do_something_interesting(i)
>>
>> That's a pretty straight forward Python expression, but I can't do
>> anything with it -- it's not a unit of data, it's a string.
>>
>> The distinction is not subtle by any means.
More information about the Python-list
mailing list