This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); |