5 ms·
Preprocessors make language parsers cry.
by nerpderp82 2y ago
Preprocessors make language parsers cry.
- fargle 2y agoit would make me very happy if someday someone does a really comprehensive study of the places where specific techniques cannot be accomplished without a C/C++ style pre-processor. SV is very similar to C, but actually even less powerful. step #2, find a way to build a better macro/meta-coding system within the syntax of the language to eliminate the need for a textual pre-processor. in SV, generate constructs are exactly this concept and have reduced the need for macros significantly, but we still can't quite get rid of them. but at least for me they are pretty rare.
- nerpderp82 2y agoI'd love to see textual preprocessors kinda banned. Or at least done upstream and outside of the language. You can't both be <the language> and also have a textual preprocessor defined internally. It doesn't work. I really like what Zig and C++ are doing with `const`. https://ikrima.dev/dev-notes/zig/zig-metaprogramming/ https://ikrima.dev/dev-notes/zig/zig-metaprogramming/ Have you looked at Spinal? https://github.com/SpinalHDL/SpinalHDL https://github.com/SpinalHDL/SpinalHDL https://spinalhdl.github.io/SpinalDoc-RTD/master/index.html https://spinalhdl.github.io/SpinalDoc-RTD/master/index.html edit, I see in your post history that your first submission was on Prosser's macro expansion. https://www.spinellis.gr/blog/20060626/cpp.algo.pdf https://www.spinellis.gr/blog/20060626/cpp.algo.pdf :)
- fargle 2y agozig: yes, it's very interesting. there's other parts i'm not sold about, but that idea is very interesting. spinalHDL: yes, also interesting. although honestly, i really prefer SV. it's a shame that the language has become so complex, but a synthesizable subset still ends up being the best thing for me to efficiently describe hardware. what they did with generate() and parameterization (borrowed from VHDL?) is very nice. it's far, far, better than C++ templates for an analogous purposes. i very rarely need to use `if, `define in SV nowadays. cpp: oh yes, i'm a nerd about languages/macros/meta-programming/etc.