News for hackers. Stuff that matters.
Re:Mal – Make a Lisp by the-smug-one on Saturday April 24, 2021 @10:04AM (#26924898)
Regexes are at least useful for parsing numbers and symbols.

But yeah, that shouldn't be where you get stuck.

Re:Mal – Make a Lisp by macintux on Saturday April 24, 2021 @10:28AM (#26925065)
[\s,](~@|[\[\]{}()'`~^@]|"(?:\\.|[^\\"])"?|;.|[^\s\[\]{}('"`,;)])

Step 0, so I didn't get very far.

https://github.com/kanaka/mal/blob/master/process/guide.md#s...

Re:Mal – Make a Lisp by kanaka on Sunday April 25, 2021 @07:23PM (#26937680)
It's a long regex, but it's just whitespace followed by an alternation with 5 different types of data: split-unquote, special characters, strings, comments, symbols. The string tokenizing branch is a bit complicated because it has to allow internal escaping of quotes. Early iterations of the guide didn't explain the regex in detail but the section now describes each of the regex components.

There are online tools to help visualize regex's. Here is a recent tweet including a visualization of mal's tokenizer regex: https://twitter.com/Mehulwastaken/status/1382292764834996230

Re:Mal – Make a Lisp by cellularmitosis on Saturday April 24, 2021 @10:53AM (#26925276)
Whoa that regex is a monster. Try starting with simpler pieces and see if you get further this time around. Good luck! https://gist.github.com/cellularmitosis/75dc4aefe88438c14e94...
Re:Mal – Make a Lisp by the-smug-one on Sunday April 25, 2021 @05:39AM (#26931488)
Well, you certainly don't need that regex to implement a Lisp.