Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I made something very much like this! As I worked on it I slowly rewrote the transpiler in the sexpression language itself, which led to me using it to help guide new features. It's always tempting to write the compiler as the first program despite knowing that it produces a language designed for writing compilers. But it was just a fun programming project not designed to go anywhere.

I remember finding it was hard to remember how many parens to use where. For example is it (if (condition) (statement)) or is it (if (condition) (list of statements))? If it's the former you have to explicitly call out multi-statement if with something like progn, like (if (== foo 3) (progn (= foo 4) (return))), which doesn't feel very C-like, while if you pick the latter option it's easy to get the syntax wrong, when you have single-statement blocks because you need to double-paren them, like (if (== foo 3) ((return)). When you're writing scheme this isn't such a problem because it tends to be expression-oriented, but when you're writing C with a different syntax I found it pretty confusing.



You could use an if variant with keywords, like if* (http://franz.com/~jkf/ifstar.txt):

(if* (== foo 3) then (foo 4) (return))


That's the choice i made, with (if .. (else... )).




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: