Skip to content

Instantly share code, notes, and snippets.

Complete stuff:
https://xmonader.github.io/letsbuildacompiler-pretty/
Lexers + DFAs:
https://gist.github.com/pervognsen/218ea17743e1442e59bb60d29b1aa725
Parsing:
https://eli.thegreenplace.net/2012/08/02/parsing-expressions-by-precedence-climbing
Backend:
import "core:fmt"
import "core:strings"
main :: proc() {
// Demo: Split `text` on any character in delimiter string.
{
text := "\nThis is a long text\nwith line breaks.";
lines_itr := split_iterator(text, "\n");
for line in split_any_next(&lines_itr) {
fmt.println(string(line));