Some checks failed
Deploy Landing Page to Storj / deploy (push) Failing after 2s
- Add speckl-compile.speckdl — compiler formally specified in SpeckDL - Generator: multi-enum detection, value→enum mapping, trailing comma cleanup - Emit blocks collapsed to single-line (parser limitation) - Generated artifacts: provenance, BOMs, WAT, TypeScript (2 known bugs → engineering#8)
151 lines
No EOL
4.9 KiB
Text
151 lines
No EOL
4.9 KiB
Text
;; Auto-generated by speckl-compile from SpecklCompiler
|
|
;; Compile: wat2wasm SpecklCompiler.wat -o SpecklCompiler.wasm
|
|
|
|
(module
|
|
;; Host imports for Map/Set/alloc
|
|
(import "speckl" "map_create" (func $map_create (result i32)))
|
|
(import "speckl" "map_set" (func $map_set (param i32 i32 i32)))
|
|
(import "speckl" "map_get" (func $map_get (param i32 i32) (result i32)))
|
|
(import "speckl" "map_has" (func $map_has (param i32 i32) (result i32)))
|
|
(import "speckl" "map_remove" (func $map_remove (param i32 i32)))
|
|
(import "speckl" "set_create" (func $set_create (result i32)))
|
|
(import "speckl" "set_add" (func $set_add (param i32 i32)))
|
|
(import "speckl" "set_has" (func $set_has (param i32 i32) (result i32)))
|
|
(import "speckl" "set_size" (func $set_size (param i32) (result i32)))
|
|
(import "speckl" "alloc" (func $alloc (param i32) (result i32)))
|
|
(import "speckl" "write_i32" (func $write_i32 (param i32 i32)))
|
|
(import "speckl" "write_f64" (func $write_f64 (param i32 f64)))
|
|
|
|
;; Linear memory (exported so host can read state)
|
|
(memory (export "memory") 1)
|
|
|
|
;; State globals
|
|
(global $phase (mut i32) (i32.const 0))
|
|
(global $sourcePath (mut i32) (i32.const 0))
|
|
(global $outputDir (mut i32) (i32.const 0))
|
|
(global $ast (mut i32) (i32.const 0))
|
|
(global $errors (mut i32) (i32.const 0))
|
|
(global $artifacts (mut i32) (i32.const 0))
|
|
|
|
;; ---- init ----
|
|
(func $init (export "init")
|
|
(i32.const 0)
|
|
(global.set $phase)
|
|
(i32.const 0)
|
|
(global.set $sourcePath)
|
|
(i32.const 0)
|
|
(global.set $outputDir)
|
|
(i32.const 0)
|
|
(global.set $ast)
|
|
(i32.const 0)
|
|
(global.set $errors)
|
|
(i32.const 0)
|
|
(global.set $artifacts)
|
|
)
|
|
|
|
;; ---- Actions ----
|
|
;; action: compile
|
|
(func $compile (export "compile") (param $sourcePath i32) (param $outputDir i32) (result i32)
|
|
|
|
;; require: phase === Idle
|
|
;; Complex right-hand side not compiled: phase === Idle
|
|
;; require: len(sourcePath) > 0
|
|
;; Complex guard not compiled: len(sourcePath) > 0
|
|
;; emit CompilationStarted { ... }
|
|
(i32.const 1)
|
|
)
|
|
|
|
;; action: parse
|
|
(func $parse (export "parse") (result i32)
|
|
|
|
;; require: phase === Parsing
|
|
;; Complex right-hand side not compiled: phase === Parsing
|
|
;; require: len(sourcePath) > 0
|
|
;; Complex guard not compiled: len(sourcePath) > 0
|
|
;; emit PhaseCompleted { ... }
|
|
(i32.const 1)
|
|
)
|
|
|
|
;; action: generateProvenance
|
|
(func $generateProvenance (export "generateProvenance") (result i32)
|
|
|
|
;; require: phase === Parsed || phase === TypeScriptGenerated || phase === WASMGenerated
|
|
;; Complex right-hand side not compiled: phase === Parsed || phase === TypeScriptGenerated || phase === WASMGenerated
|
|
;; emit ArtifactGenerated { ... }
|
|
(i32.const 1)
|
|
)
|
|
|
|
;; action: generateBOMs
|
|
(func $generateBOMs (export "generateBOMs") (result i32)
|
|
|
|
;; require: phase === ProvenanceGenerated || phase === Parsed
|
|
;; Complex right-hand side not compiled: phase === ProvenanceGenerated || phase === Parsed
|
|
;; emit ArtifactGenerated { ... }
|
|
;; emit ArtifactGenerated { ... }
|
|
(i32.const 1)
|
|
)
|
|
|
|
;; action: generateTypeScript
|
|
(func $generateTypeScript (export "generateTypeScript") (result i32)
|
|
|
|
;; require: phase === BOMsGenerated || phase === Parsed
|
|
;; Complex right-hand side not compiled: phase === BOMsGenerated || phase === Parsed
|
|
;; emit ArtifactGenerated { ... }
|
|
(i32.const 1)
|
|
)
|
|
|
|
;; action: generateWASM
|
|
(func $generateWASM (export "generateWASM") (result i32)
|
|
|
|
;; require: phase === TypeScriptGenerated || phase === BOMsGenerated || phase === Parsed
|
|
;; Complex right-hand side not compiled: phase === TypeScriptGenerated || phase === BOMsGenerated || phase === Parsed
|
|
;; emit ArtifactGenerated { ... }
|
|
(i32.const 1)
|
|
)
|
|
|
|
;; action: report
|
|
(func $report (export "report") (result i32)
|
|
|
|
;; require: phase === ProvenanceGenerated || phase === BOMsGenerated || phase === TypeScriptGenerated || phase === WASMGenerated
|
|
;; Complex right-hand side not compiled: phase === ProvenanceGenerated || phase === BOMsGenerated || phase === TypeScriptGenerated || phase === WASMGenerated
|
|
;; emit PhaseCompleted { ... }
|
|
(i32.const 1)
|
|
)
|
|
|
|
;; action: reset
|
|
(func $reset (export "reset") (result i32)
|
|
|
|
(i32.const 1)
|
|
)
|
|
|
|
;; ---- getState ----
|
|
(func $getState (export "getState") (result i32 i32)
|
|
(i32.const 0)
|
|
(global.get $phase)
|
|
(i32.store)
|
|
(i32.const 4)
|
|
(global.get $sourcePath)
|
|
(i32.store)
|
|
(i32.const 8)
|
|
(global.get $outputDir)
|
|
(i32.store)
|
|
(i32.const 12)
|
|
(global.get $ast)
|
|
(i32.store)
|
|
(i32.const 16)
|
|
(global.get $errors)
|
|
(i32.store)
|
|
(i32.const 20)
|
|
(global.get $artifacts)
|
|
(i32.store)
|
|
(i32.const 0)
|
|
(i32.const 24)
|
|
)
|
|
|
|
|
|
;; checkConstraints — runtime constraint evaluation stub
|
|
(func $checkConstraints (export "checkConstraints") (result i32)
|
|
;; TODO: evaluate constraint expressions at runtime
|
|
(i32.const 1)
|
|
)
|
|
) |