[plt-scheme] Code for Krishnamurthi's "Swine Before Perl"

From: Joe Marshall (jrm at ccs.neu.edu)
Date: Thu Jun 10 16:00:11 EDT 2004

Bruce Butterfield <bab at entricom.com> writes:

>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> Shriram Krishnamurthi wrote:
>> Have you considered writing some macros instead?  That way you can
>> better check the syntactic structure of inputs you send to
>> Mathematica...
> This brings up a point I would like some opinion on -- when designing
> a "little language" when do you decide to move from s-expression based
> syntax to using parser tools to lex other expression syntax? 

You don't.  The disadvantages of infix syntax are too numerous.

> For example, the automaton data example is wrapped in an s-expression
> which makes it trivial for Scheme to read but doesn't really add any
> value to the data itself.

True, but it doesn't take much away, either.

Adding infix notation to Scheme also makes it trivial to read the
data, but it not only adds no value to Scheme, it significantly
reduces the existing value.

The data does not need to be in sexp format; it is trivial to write
programs that can convert ad-hoc data formats to s-exps.  I have
written compilers where the front end parser is a simple tokenizer
based on lex that wraps parenthesis around the non-schemeish tokens.

> One of my projects uses mzscheme to generate reports from XML - the
> report template is written using Scheme syntax within CDATA tags. This
> is not a happy marriage. I'm reworking this to make the syntax more
> XML-friendly (yeah, I know, but I don't control the data source
> here...) somewhat like BRL but focused to our requirements. So AFAIK
> my "little language" can't merely rely on Scheme macros to do the
> transforms but it certainly can use them to define interesting
> functionality.

Wouldn't it be a whole lot easier to run the XML through XSLT and
convert the report template to something more Scheme-friendly?

Posted on the users mailing list.