Hacker News new | ask | show | jobs
by kazinator 569 days ago
If you don't allow the indentation based parsing to be nested within a bracket-based expression, it doesn't look too bad. At the top level you have the indentation-based parser. When that sees an open bracket, it recurses to the regular parser which doesn't care about indentation.
1 comments

This works until you start using macros.
I'm reasonably sure you could conceal this surface syntax so that macros don't know it exists and work fine. You can call a macro by writing the invocation syntax using the indented format, or by the bracketed format, or a mixture.

It's been done before; see Scheme SRFI-110, a.k.a. Sweet Expressions or t-expressions:

https://srfi.schemers.org/srfi-110/srfi-110.html

Yes, for a general language (such as abstraction algebra) you would want to allow mixing normal term language and blocks. In RX, that is easy to do: Just reuse the blocks that RX already gives you, while the lines of a block are there for the term language.