Python syntax in Lisp and Scheme

Dominic oblivious at web.de
Fri Oct 3 03:26:38 EDT 2003


mike420 at ziplip.com wrote:
> I think everyone who used Python will agree that its syntax is
> the best thing going for it. It is very readable and easy
> for everyone to learn. But, Python does not a have very good
> macro capabilities, unfortunately. I'd like to know if it may
> be possible to add a powerful macro system to Python, while 
> keeping its amazing syntax, and if it could be possible to
> add Pythonistic syntax to Lisp or Scheme, while keeping all
> of the functionality and convenience. If the answer is yes,
> would many Python programmers switch to Lisp or Scheme if
> they were offered identation-based syntax?

Well, there's always a programming language which has
more features than another. However documentation,
libraries, software-engineering tools and developer
community have also to be accounted for.

So whenever a special features is deemed necessary
but not available in the language I suggest to use
code generators.

   E.g. you cannot express grammars in C/Java for
   parsing so usually you stick to yacc/bison/flex/cups etc.

   In C++ BOOST provides capabilites to express a parser
   by means of template metaprogramming but compile times
   are huge. In my opinion are old fashioned parser
   generators more transparent.
   So it's probably not worth the trouble.

I have successfuly implemented a simple code generator
for real-time control applications in Python
which outputs C-source.
http://www-user.rhrk.uni-kl.de/~hillbr/public/

Today I'd suggest to use  XML-files to describe
the problem and generate source code from it.
Source code needed for assembling the final
result could also be embedded into the XML-files.

Eclipse uses a kind of JSP to generate code
from templates. (Examples exist
for generating source code for enumerations
which are not yet supported by Java)
However it's still very primitive.
At the rapid pace at which Eclipse
is developed I am curious what way it is going to take.


Ciao,
  Dominic









More information about the Python-list mailing list