about summary refs log tree commit diff stats
path: root/html/509bezier.mu.html
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-07-28 20:44:02 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-07-28 20:44:02 -0700
commitbec33a7067288570619c3c12fb0543e61bb562d2 (patch)
tree67e58909aeeaad542900ed8fcb334ff1ddd1a577 /html/509bezier.mu.html
parent267c74b59a5f148bd28233f25bc794a3a4893e8e (diff)
downloadmu-bec33a7067288570619c3c12fb0543e61bb562d2.tar.gz
shell: second notation for string literals
I've always been dissatisfied with the notion of escaping. It introduces
a special-case meta-notation within the tokenizer, and the conventional
approach leads to exponential "leaning toothpick syndrome" with each
level of escaping.

One potential "correct" solution is to keep string terminals
parameterizable:

  [abc]           => abc
  [=]             => =
  [=[abc]=]       => abc
  [=[a]bc]=]      => a]bc
  [==[a]=]bc]==]  => a]=]bc

..and so on. Basically the terminals grow linearly as the number of
escapings grow.

While this is workable, I'd like to wait until I actually need it, and
then gauge whether the need is a sign of the stack growing too complex,
with too many layers of notation/parsing. Mu's goal is just 3 notations,
and it's going to require constant vigilance to keep that from growing.

Therefore, for now, there are two notations for string literals, one
symmetric and one balanced:

  "abc"           => abc
  [abc]           => abc

The balancing notation permits nested brackets as long as they balance.
  [abc [def]]     => abc [def]

If you need unbalanced square brackets, use the symmetric terminals:
  "abc [def"      => abc [def

If you need double quotes inside strings, use the balanced notation:
  [abc "def]      => abc "def

If you need _both_ square brackets (whether balanced or unbalanced) and
double quotes, you're currently shit outta luck.
Diffstat (limited to 'html/509bezier.mu.html')
0 files changed, 0 insertions, 0 deletions