Follow

Long. Me talking about the programming language (SetTL) I'm developing 

Here’s a snippet of an e2ee (end-to-end execution) test for SetTL – the language I’m writing with set-algebra-isomorphic typing. Its in the earliest stage of development right now, and I haven’t added any of the actually unique features I’m developing yet. But this snippet is interesting itself, I think. Its syntax is guaranteed to be unattractive to most people for funny reasons: its sort of like a lisp (so unattractive to many, many people), but with the function heads on the outside of the parentheses, and the closing parentheses of multiline blocks on their own lines (blasphemous). And notice the inconsistent use of commas. Commas, semicolons, and newlines actually do absolutely nothing right now in the core syntax (they’re equivalent to a space), despite them being tokenized. They’re just immediately deleted after being tokenized. I’m a fan of adding extra information to aid in comprehension when programming (this is also one of the cool parts about tag types and set typing), so the commas help make the code comprehensible now (and I removed some here for demonstrative purposes)

do(  set(x, 100)  set(steps, 0)  while(>(x 0), do(    set(x, -(x 10))    set(steps, +(steps, 1))  ))  assert(==(x 0))  assert(==(steps, 10)))

This is the core syntax of SetTL and is a compromise between easily parsable syntax, and easily comprehensible syntax. Now I’m going to spend a few days / weeks (not weeks hopefully) incorporating some of the features of the extended syntax to make it faster and more smooth to program in. Specifically, I want to eliminate parethesis pairs so the actual path your cursor takes when writing or modifying any particular line is more linear. As it is you have to move your cursor around a lot when blocking any particular sequence of elements because you have to traverse the entire sequence to add the block opener and closer (ie: ( and ) )

In the (hopefully) near future, SetTL’s syntax will look more like this (when using extended syntax):

{  let x = 100  let steps = 0  while x > 0 {    x = x - 10    steps = steps + 1  }  assert x == 0  assert steps == 10}

Which involves, in no particular order:

  • Line call parsing: [\n,;]? foo x1 x2 ... xn [\n,;]? eq to foo(x1 x2 ... xn) in do blocks {...}
  • Line call parsing: [,;]? foo x1 x2 ... xn [,;]? eq to foo(x1 x2 ... xn) everywhere else
  • Curly brace do block replacement: {...} eq to do(...)
  • let(... = ...) normalization to set(... ...) (note: let will have a lot more power in the future if all goes well)
  • Infix operations a + b eq to +(a b)
  • Chained infix flattening x1 + x2 + ... + xn eq to +(x1 x2 ... xn) instead of +(x1 +(x2 +(x3 ...)))

These additions will make commas, semicolons, and newlines act like proper separators, so for instance you’ll be able to do set x 100; set steps 0. And the core syntax will still always work, so even without line call separators you could do set(x 100) set(steps 0)

If you have any questions or are interested in SetTL, feel free to talk to me :)

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.