Re: Lisp syntax, was A simpler way to tokenize and parse?

Kaz Kylheku <864-117-4973@kylheku.com>
Sun, 26 Mar 2023 00:46:40 -0000 (UTC)

          From comp.compilers

Related articles
A simpler way to tokenize and parse? costello@mitre.org (Roger L Costello) (2023-03-24)
Re: Lisp syntax, was A simpler way to tokenize and parse? spibou@gmail.com (Spiros Bousbouras) (2023-03-25)
Re: Lisp syntax, was A simpler way to tokenize and parse? anton@mips.complang.tuwien.ac.at (2023-03-25)
Re: Lisp syntax, was A simpler way to tokenize and parse? gah4@u.washington.edu (gah4) (2023-03-25)
Re: Lisp syntax, was A simpler way to tokenize and parse? 864-117-4973@kylheku.com (Kaz Kylheku) (2023-03-26)
| List of all articles for this month |
From: Kaz Kylheku <864-117-4973@kylheku.com>
Newsgroups: comp.compilers
Date: Sun, 26 Mar 2023 00:46:40 -0000 (UTC)
Organization: A noiseless patient Spider
References: 23-03-011 23-03-018
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="32712"; mail-complaints-to="abuse@iecc.com"
Keywords: Lisp, syntax
Posted-Date: 26 Mar 2023 05:15:06 EDT

On 2023-03-25, Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
>>[[...] The original plan was that Lisp 2
>>would have M expressions that looked more like a normal language but
>>it's over 50 years later and they still haven't gotten around to it.
>>-John]
>
> Actually they have. Some HOPL paper (or several of them) discuss
> this: There were several attempts at an Algol-like syntax, but Lisp
> proprammers found that they preferred programming in S-Expressions
> over the Algol-like syntax, whether it's M-Expressions, Dylan syntax,
> or several other attempts.


The situation is more nuanced. Common Lisp has programmable read tables
which let you have any surface syntax, and this is used. It's just not
the predominant mode of writing the bulk of the code. For instance, the
cl-interpol library provides string syntax with interpolation.


There exists an open source module for Common Lisp called
named-readtables which provides disciplined registration for managing
multiple read-tables. If a developer wants to mix multiple
read-table-based syntaxes in the same source, they can clash.


Racket is a popular language based on Scheme, which also has
programmable syntax. A Racket source file can begin with a #lang
directive which indicates which language module is being used;
that syntax then applies to the rest of the file. I have the
impression that this is farily widely used in the Racket world.


--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.