File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed
Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ homepage = { workspace = true }
77repository = { workspace = true }
88
99[dependencies ]
10+ wat = " 1.222.0"
1011tree-sitter.workspace = true
1112tree-sitter-inference.workspace = true
1213inference-ast.workspace = true
Original file line number Diff line number Diff line change 1+ //! Inference is a programming language that is designed to be easy to learn and use.
2+
13pub fn compile_to_wat ( source_code : & str ) -> String {
24 let inference_language = tree_sitter_inference:: language ( ) ;
35 let mut parser = tree_sitter:: Parser :: new ( ) ;
@@ -10,3 +12,8 @@ pub fn compile_to_wat(source_code: &str) -> String {
1012 let ast = inference_ast:: builder:: build_ast ( root_node, code) ;
1113 inference_wat_codegen:: wat_generator:: generate_for_source_file ( & ast)
1214}
15+
16+ pub fn compile_to_wasm ( source_code : & str ) -> Vec < u8 > {
17+ let wat = compile_to_wat ( source_code) ;
18+ wat:: parse_str ( wat) . unwrap ( )
19+ }
You can’t perform that action at this time.
0 commit comments