As part of my Ben Eater-like videotutorials on how GPUs work, I am practicing to eventually implement GLSL compiler for my (SimulIDE simulated) GPU. Trying to figure out how to implement it in a way that's legible & works.

So from my practice what's my current plan?

1. Pull in a library, for once, "Automa" to lex input text into tokens.
2. Postprocess those tokens to implement a C PreProcessor, after implementing parsing & constant propagation.
3. Use a Pratt parser via Dict lookups.

1/2

Follow

@alcinnz Would recommend using a PEG parser instead of a Pratt parser; it does make operator precedence harder (for left-associative operators anyway) but it makes everything else easier.

Sign in to participate in the conversation
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.