You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Introduce import system to support KernelScript and Python modules. Update AST, parser, and type checker to handle new import syntax and module calls. Enhance evaluation and IR generation for module function calls. Update symbol table to track imported modules and functions.
Copy file name to clipboardExpand all lines: SPEC.md
+54-3Lines changed: 54 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -89,6 +89,49 @@ fn main(args: Args) -> i32 {
89
89
}
90
90
```
91
91
92
+
### 1.4 Unified Import System
93
+
94
+
KernelScript supports importing both KernelScript modules and external language modules using a unified syntax. Import behavior is automatically determined by file extension:
95
+
96
+
```kernelscript
97
+
// Import KernelScript modules (.ks files)
98
+
import utils from "./common/utils.ks" // Functions, types, maps, configs
99
+
import packet_helpers from "../net/helpers.ks" // Shared across eBPF and userspace
100
+
101
+
// Import Python modules (.py files) - userspace only
102
+
import ml_analysis from "./ml/threat_analysis.py"
103
+
import data_processor from "./analytics/stats.py"
104
+
105
+
// Usage is identical regardless of source language
0 commit comments