File tree 12 files changed +3017
-296
lines changed
12 files changed +3017
-296
lines changed Original file line number Diff line number Diff line change @@ -21,41 +21,50 @@ jobs:
21
21
- uses : actions/setup-go@v3
22
22
with :
23
23
go-version : ' 1.19'
24
-
24
+
25
25
- uses : acifani/setup-tinygo@v1
26
26
with :
27
27
tinygo-version : 0.25.0
28
28
29
29
- uses : actions/setup-go@v3
30
30
with :
31
31
go-version : ' 1.19'
32
-
32
+
33
33
- name : Install wasm-opt
34
34
run : |
35
35
wget https://github.com/WebAssembly/binaryen/releases/download/version_110/binaryen-version_110-x86_64-linux.tar.gz
36
36
tar -xvzf binaryen-version_110-x86_64-linux.tar.gz
37
37
rm -rf binaryen-version_110-x86_64-linux.tar.gz
38
38
cp binaryen-version_110/bin/wasm-opt /usr/local/bin
39
39
rm -Rf binaryen-version_110
40
-
40
+
41
41
- name : Install tinyjson
42
42
run : go install github.com/CosmWasm/tinyjson/...@latest
43
43
44
44
- name : Install Apex CLI
45
- run : wget -q https://apexlang.io/install.sh -O - | /bin/bash
45
+ run : |
46
+ wget -q https://apexlang.io/install.sh -O - | /bin/bash
47
+ apex install @wapc/codegen
46
48
47
49
- name : Apex code generation
48
50
run : apex generate
49
-
51
+
50
52
- name : Build WebAssembly parser
51
53
run : |
52
54
tinygo build -o apex-parser.wasm -scheduler=none -target=wasi -wasm-abi=generic -no-debug cmd/apex-api/main.go
53
55
wasm-opt -O apex-parser.wasm -o apex-parser.wasm
54
56
57
+ - name : Build waPC module
58
+ run : |
59
+ tinygo build -o apex-wapc.wasm -scheduler=none -target=wasi -wasm-abi=generic -no-debug cmd/wapc/main.go
60
+ wasm-opt -O apex-wapc.wasm -o apex-wapc.wasm
61
+
55
62
- name : Release
56
63
uses : softprops/action-gh-release@v1
57
64
if : startsWith(github.ref, 'refs/tags/')
58
65
with :
59
66
files : |
60
67
apex-parser.wasm
68
+ apex-wapc.wasm
69
+ model.apexlang
61
70
LICENSE.txt
Original file line number Diff line number Diff line change 1
- .PHONY : all wasm-cli wasm-api codegen
1
+ .PHONY : all wasm-cli wasm-api wasm-wapc wasm-host codegen
2
2
3
- all : codegen wasm-cli wasm-api wasm-host
3
+ all : codegen wasm-cli wasm-api wasm-wapc wasm- host
4
4
5
5
wasm-cli :
6
6
tinygo build -o apex-cli.wasm -scheduler=none -target=wasi -wasm-abi=generic -no-debug cmd/apex-cli/main.go
@@ -11,6 +11,10 @@ wasm-api:
11
11
wasm-opt -O apex-api.wasm -o apex-api.wasm
12
12
cp apex-api.wasm cmd/host/apex-api.wasm
13
13
14
+ wasm-wapc :
15
+ tinygo build -o apex-wapc.wasm -scheduler=none -target=wasi -wasm-abi=generic -no-debug cmd/wapc/main.go
16
+ wasm-opt -O apex-wapc.wasm -o apex-wapc.wasm
17
+
14
18
wasm-host :
15
19
go build -o apex-host cmd/host/main.go
16
20
Original file line number Diff line number Diff line change 1
1
spec : model.apexlang
2
2
config :
3
3
package : model
4
- module : github.com/apexlang/apex-wasm
4
+ module : github.com/apexlang/apex-go
5
5
generates :
6
6
model/model.go :
7
7
module : ' @apexlang/codegen/go'
@@ -10,3 +10,15 @@ generates:
10
10
writeTypeInfo : false
11
11
runAfter :
12
12
- command : tinyjson -all model/model.go
13
+ model/msgpack.go :
14
+ module : ' @apexlang/codegen/go'
15
+ visitorClass : MsgPackVisitor
16
+ model/wapc.go :
17
+ module : ' @wapc/codegen/tinygo'
18
+ visitorClass : ExportVisitor
19
+ cmd/wapc/main.go :
20
+ module : ' @wapc/codegen/tinygo'
21
+ visitorClass : MainVisitor
22
+ config :
23
+ import : github.com/apexlang/apex-go/model
24
+ package : model
Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ "github.com/apexlang/apex-go/model"
5
+ )
6
+
7
+ func main () {
8
+ // Create providers
9
+ resolverProvider := model .NewResolver ()
10
+
11
+ // Create services
12
+ parserService := model .NewParser (resolverProvider )
13
+
14
+ // Register services
15
+ model .RegisterParser (parserService )
16
+ }
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ require (
6
6
github.com/CosmWasm/tinyjson v0.9.0
7
7
github.com/iancoleman/strcase v0.2.0
8
8
github.com/tetratelabs/tinymem v0.1.0
9
+ github.com/wapc/tinygo-msgpack v0.1.4
10
+ github.com/wapc/wapc-guest-tinygo v0.3.3
9
11
)
10
12
11
13
require github.com/josharian/intern v1.0.0 // indirect
Original file line number Diff line number Diff line change 1
1
github.com/apexlang/tinyjson v0.9.1-0.20220929010544-92ef7a6da107 h1:GljFiJysL3S8SBhXWU47Emj34D3pVZgJ+Amj+jhM4fQ =
2
2
github.com/apexlang/tinyjson v0.9.1-0.20220929010544-92ef7a6da107 /go.mod h1:5+7QnSKrkIWnpIdhUT2t2EYzXnII3/3MlM0oDsBSbc8 =
3
+ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c =
3
4
github.com/iancoleman/strcase v0.2.0 h1:05I4QRnGpI0m37iZQRuskXh+w77mr6Z41lwQzuHLwW0 =
4
5
github.com/iancoleman/strcase v0.2.0 /go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho =
5
6
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY =
6
7
github.com/josharian/intern v1.0.0 /go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y =
8
+ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM =
9
+ github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk =
7
10
github.com/tetratelabs/tinymem v0.1.0 h1:Qza1JAg9lquPPJ/CIei5qQYx7t18KLie83O2WR6CM58 =
8
11
github.com/tetratelabs/tinymem v0.1.0 /go.mod h1:WFFTZFhLod6lTL+UetFAopVbGaB+KFsVcIY+RUv7NeY =
12
+ github.com/wapc/tinygo-msgpack v0.1.4 h1:oiwtclAGh/A+x024gCFXxey/iNtRmGaE+nvtyAw2vvo =
13
+ github.com/wapc/tinygo-msgpack v0.1.4 /go.mod h1:2P4rQimy/6oQAkytwC2LdtVjLJ2D1dYkQHejfCtZXZQ =
14
+ github.com/wapc/wapc-guest-tinygo v0.3.3 h1:jLebiwjVSHLGnS+BRabQ6+XOV7oihVWAc05Hf1SbeR0 =
15
+ github.com/wapc/wapc-guest-tinygo v0.3.3 /go.mod h1:mzM3CnsdSYktfPkaBdZ8v88ZlfUDEy5Jh5XBOV3fYcw =
16
+ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA =
Original file line number Diff line number Diff line change 1
1
namespace "apexlang.v1"
2
2
3
+ interface Parser @service @uses([Resolver]) {
4
+ parse(source: string): ParserResult
5
+ }
6
+
7
+ interface Resolver @dependency {
8
+ resolve(location: string, from: string): string
9
+ }
10
+
11
+ type ParserResult {
12
+ namespace: Namespace?
13
+ errors: [Error]?
14
+ }
15
+
16
+ type Error {
17
+ message: string
18
+ positions: [u32]
19
+ locations: [Location]
20
+ }
21
+
22
+ type Location {
23
+ line: u32
24
+ column: u32
25
+ }
26
+
3
27
"Namespace encapsulates is used to identify and refer to elements contained in the Apex specification."
4
28
type Namespace {
5
29
name: string @quoted
You can’t perform that action at this time.
0 commit comments