4 ms·
I'm writing a Haskell compiler in C as a hobby. I didn't take a look at GHC code but now I find the way they deal with optional indentation interesting. Nonethe
by arturogoosnargh 8y ago
I'm writing a Haskell compiler in C as a hobby. I didn't take a look at GHC code but now I find the way they deal with optional indentation interesting. Nonetheless I implemented the same thing in a simpler way having a function in my parser that checks for the presence or absence of curly braces and sets some state on the parser.
My implementation: https://github.com/angel-manuel/schc/blob/c1fa77b332a765b4767822bc90314bc62aebac33/src/parser.c#L216-L260 https://github.com/angel-manuel/schc/blob/c1fa77b332a765b476...
- kreetx 8y agoOut of curiosity, do you have a mathemathics background? I.e for me the scaryest part of this is type inference and type checking.