by aktau · 8y ago · 0 comments
You seem to want to avoid either LLVM (understandable) or run-time compilation (would be great, but it's hard as you state).
I'd like to introduce you to ply(1). It's a DSL interpreter (think dtrace) that compiles an awk/dtrace like language to eBPF and wires up the necessary pipes/maps/... Link https://github.com/iovisor/ply.
Please take some time to read the code. It's tiny. Every time I come away with a renewed appreciation for well written C (and wkz).
Please allow me to follow up with one of my own https://wkz.github.io/ply/, where you can see some examples and read through the manual.
I'm currently working on a new version which will be easier to extend and will have a full C-compliant type system. Still tiny though. Hope to have a commit worthy of a git tag soon. :)