Skip to content

Commit

Permalink
Apex rebrand
Browse files Browse the repository at this point in the history
  • Loading branch information
pkedy committed Feb 21, 2022
1 parent b062dc3 commit ead9410
Show file tree
Hide file tree
Showing 13 changed files with 55 additions and 30 deletions.
45 changes: 35 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,38 @@
# WebAssembly Interface Definition Language (WIDL) for Golang
# Apex Language support for Golang

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.
TODO

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

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.
import (
"encoding/json"
"fmt"
"os"

"github.com/apexlang/apex-go/parser"
)

func main() {
schema, err := os.ReadFile("schema.apex")
if err != nil {
panic(err)
}
doc, err := parser.Parse(parser.ParseParams{
Source: string(schema),
Options: parser.ParseOptions{
NoLocation: true,
NoSource: true,
},
})
if err != nil {
panic(err)
}

jsonBytes, err := json.MarshalIndent(doc, "", " ")
if err != nil {
panic(err)
}
fmt.Println(string(jsonBytes))
}
```
2 changes: 1 addition & 1 deletion ast/definitions.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ast

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

type (
Definition interface {
Expand Down
2 changes: 1 addition & 1 deletion ast/document.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ast

import (
"github.com/wapc/widl-go/kinds"
"github.com/apexlang/apex-go/kinds"
)

// Document implements Node
Expand Down
2 changes: 1 addition & 1 deletion ast/location.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ast

import (
"github.com/wapc/widl-go/source"
"github.com/apexlang/apex-go/source"
)

type Location struct {
Expand Down
2 changes: 1 addition & 1 deletion ast/nodes.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ast

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

type Node interface {
GetKind() kinds.Kind
Expand Down
2 changes: 1 addition & 1 deletion ast/types.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ast

import (
"github.com/wapc/widl-go/kinds"
"github.com/apexlang/apex-go/kinds"
)

type Type interface {
Expand Down
2 changes: 1 addition & 1 deletion ast/values.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ast

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

type Value interface {
Node
Expand Down
6 changes: 3 additions & 3 deletions errors/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"fmt"
"reflect"

"github.com/wapc/widl-go/ast"
"github.com/wapc/widl-go/location"
"github.com/wapc/widl-go/source"
"github.com/apexlang/apex-go/ast"
"github.com/apexlang/apex-go/location"
"github.com/apexlang/apex-go/source"
)

type Error struct {
Expand Down
6 changes: 3 additions & 3 deletions errors/syntax.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"regexp"
"strings"

"github.com/wapc/widl-go/ast"
"github.com/wapc/widl-go/location"
"github.com/wapc/widl-go/source"
"github.com/apexlang/apex-go/ast"
"github.com/apexlang/apex-go/location"
"github.com/apexlang/apex-go/source"
)

func NewSyntaxError(s *source.Source, position uint, description string) *Error {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/wapc/widl-go
module github.com/apexlang/apex-go

go 1.16
4 changes: 2 additions & 2 deletions lexer/lexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"strings"
"unicode/utf8"

"github.com/wapc/widl-go/errors"
"github.com/wapc/widl-go/source"
"github.com/apexlang/apex-go/errors"
"github.com/apexlang/apex-go/source"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion location/location.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package location
import (
"regexp"

"github.com/wapc/widl-go/source"
"github.com/apexlang/apex-go/source"
)

type SourceLocation struct {
Expand Down
8 changes: 4 additions & 4 deletions parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"fmt"
"strconv"

"github.com/wapc/widl-go/ast"
"github.com/wapc/widl-go/errors"
"github.com/wapc/widl-go/lexer"
"github.com/wapc/widl-go/source"
"github.com/apexlang/apex-go/ast"
"github.com/apexlang/apex-go/errors"
"github.com/apexlang/apex-go/lexer"
"github.com/apexlang/apex-go/source"
)

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

0 comments on commit ead9410

Please sign in to comment.