Skip to content

Commit ead9410

Browse files
committed
Apex rebrand
1 parent b062dc3 commit ead9410

File tree

13 files changed

+55
-30
lines changed

13 files changed

+55
-30
lines changed

README.md

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,38 @@
1-
# WebAssembly Interface Definition Language (WIDL) for Golang
1+
# Apex Language support for Golang
22

3-
WIDL is a schema format for describing [waPC](https://github.com/wapc) modules and used by the [CLI](https://github.com/wapc/cli) to generate code for the supported guest languages. It heavily resembles [GraphQL schema](https://graphql.org/learn/schema/) but with some variations to fit better in the WebAssembly ecosystem.
3+
TODO
44

5-
* Built-in WebAssembly numeric types (i8-64, i8-64, f32, f64) - no scalars required
6-
* Scalars explicitly alias a known type
7-
* Functions can return `void` instead of returning `Boolean` as a workaround
8-
* Fields are required by default instead of optional and `?` is used after the field name to denote that it is optional
9-
* Support for maps
10-
* Operations are defined in a single interface instead of separating query and mutation operations
11-
* Removed the concepts that do not apply from GraphQL schema (e.g. Queries vs. Mutations, Field arguments, Variables, Fragments)
5+
```golang
6+
package main
127

13-
Everything in this package was borrowed and retrofitted from the awesome [Golang GraphQL library](https://github.com/graphql-go/graphql). We thank the 70+ contributors to this project! It has enabled us to provide a succinct interface definition language to our users with minimal effort.
8+
import (
9+
"encoding/json"
10+
"fmt"
11+
"os"
12+
13+
"github.com/apexlang/apex-go/parser"
14+
)
15+
16+
func main() {
17+
schema, err := os.ReadFile("schema.apex")
18+
if err != nil {
19+
panic(err)
20+
}
21+
doc, err := parser.Parse(parser.ParseParams{
22+
Source: string(schema),
23+
Options: parser.ParseOptions{
24+
NoLocation: true,
25+
NoSource: true,
26+
},
27+
})
28+
if err != nil {
29+
panic(err)
30+
}
31+
32+
jsonBytes, err := json.MarshalIndent(doc, "", " ")
33+
if err != nil {
34+
panic(err)
35+
}
36+
fmt.Println(string(jsonBytes))
37+
}
38+
```

ast/definitions.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package ast
22

3-
import "github.com/wapc/widl-go/kinds"
3+
import "github.com/apexlang/apex-go/kinds"
44

55
type (
66
Definition interface {

ast/document.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package ast
22

33
import (
4-
"github.com/wapc/widl-go/kinds"
4+
"github.com/apexlang/apex-go/kinds"
55
)
66

77
// Document implements Node

ast/location.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package ast
22

33
import (
4-
"github.com/wapc/widl-go/source"
4+
"github.com/apexlang/apex-go/source"
55
)
66

77
type Location struct {

ast/nodes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package ast
22

3-
import "github.com/wapc/widl-go/kinds"
3+
import "github.com/apexlang/apex-go/kinds"
44

55
type Node interface {
66
GetKind() kinds.Kind

ast/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package ast
22

33
import (
4-
"github.com/wapc/widl-go/kinds"
4+
"github.com/apexlang/apex-go/kinds"
55
)
66

77
type Type interface {

ast/values.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package ast
22

3-
import "github.com/wapc/widl-go/kinds"
3+
import "github.com/apexlang/apex-go/kinds"
44

55
type Value interface {
66
Node

errors/error.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import (
44
"fmt"
55
"reflect"
66

7-
"github.com/wapc/widl-go/ast"
8-
"github.com/wapc/widl-go/location"
9-
"github.com/wapc/widl-go/source"
7+
"github.com/apexlang/apex-go/ast"
8+
"github.com/apexlang/apex-go/location"
9+
"github.com/apexlang/apex-go/source"
1010
)
1111

1212
type Error struct {

errors/syntax.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import (
55
"regexp"
66
"strings"
77

8-
"github.com/wapc/widl-go/ast"
9-
"github.com/wapc/widl-go/location"
10-
"github.com/wapc/widl-go/source"
8+
"github.com/apexlang/apex-go/ast"
9+
"github.com/apexlang/apex-go/location"
10+
"github.com/apexlang/apex-go/source"
1111
)
1212

1313
func NewSyntaxError(s *source.Source, position uint, description string) *Error {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
module github.com/wapc/widl-go
1+
module github.com/apexlang/apex-go
22

33
go 1.16

lexer/lexer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import (
77
"strings"
88
"unicode/utf8"
99

10-
"github.com/wapc/widl-go/errors"
11-
"github.com/wapc/widl-go/source"
10+
"github.com/apexlang/apex-go/errors"
11+
"github.com/apexlang/apex-go/source"
1212
)
1313

1414
const (

location/location.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package location
33
import (
44
"regexp"
55

6-
"github.com/wapc/widl-go/source"
6+
"github.com/apexlang/apex-go/source"
77
)
88

99
type SourceLocation struct {

parser/parser.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import (
44
"fmt"
55
"strconv"
66

7-
"github.com/wapc/widl-go/ast"
8-
"github.com/wapc/widl-go/errors"
9-
"github.com/wapc/widl-go/lexer"
10-
"github.com/wapc/widl-go/source"
7+
"github.com/apexlang/apex-go/ast"
8+
"github.com/apexlang/apex-go/errors"
9+
"github.com/apexlang/apex-go/lexer"
10+
"github.com/apexlang/apex-go/source"
1111
)
1212

1313
type parseFn func(parser *Parser) (interface{}, error)

0 commit comments

Comments
 (0)