Add bpf decorator, start rewrite

This commit is contained in:
Pragyansh Chaturvedi
2025-09-06 12:42:20 +05:30
parent 81f4a0a799
commit 88fa690493
2 changed files with 15 additions and 4 deletions

View File

@ -9,10 +9,15 @@ from .globals_pass import globals_processing
def processor(source_code, filename, module):
tree = ast.parse(source_code, filename)
print(ast.dump(tree, indent=4))
constants_processing(tree, module)
license_processing(tree, module)
globals_processing(tree, module)
functions_processing(tree, module)
# For now, we will parse the BPF specific parts of AST
# Big rewrite
# will worry later
# constants_processing(tree, module)
# license_processing(tree, module)
# globals_processing(tree, module)
# functions_processing(tree, module)
def compile_to_ir(filename: str, output: str):

View File

@ -1,3 +1,9 @@
def bpf(func):
"""Decorator to mark a function for BPF compilation."""
func._is_bpf = True
return func
def section(name: str):
def wrapper(fn):
fn._section = name