kfl / ebpf-tools

Experiments with eBPF bytecode
MIT License
10 stars 4 forks source link

Extend the AST and concrete syntax with support for annotations #9

Open kfl opened 2 years ago

kfl commented 2 years ago

The Instruction type in Ebpf.Asm with an annotation construction. For instance:

data Instruction =
    ...
  | Annotation String  

Alternatively Instruction could be parameterised with the kind of annotations:

data Instruction anno =
    ...
  | Annotation anno 

Likewise the concrete syntax should support annotations. For instance by using the prefix ;;*:

; a normal comment
;;* an annotation comment
;;* assume { r1 != 0 }
add r0 r1
exit