3 ms·
This strikes me as incredibly clever. The compiler and code-generation implementation seems equally straightforward and complex, my mind is racing trying to bu
by ttymck 3y ago
This strikes me as incredibly clever.
The compiler and code-generation implementation seems equally straightforward and complex, my mind is racing trying to build a mental model of the whole thing.
The code generation comes after a feature-packed parser and "compilation" step. Emitting go source code is nice because subsequent compilation tells you if its valid or not.
I'm wondering if there is a specific reason the "framework" source code is emitted via a series of printf calls[0]. A library of go template "fragments" might be easier to manage (and debug).
[0] https://github.com/adhocteam/pushup/blob/0519a782c1c9fc7987728f1a71d408b2388d8c72/codegen.go#L780 https://github.com/adhocteam/pushup/blob/0519a782c1c9fc79877...