Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
simplyYan authored Sep 1, 2024
1 parent f5ee0aa commit 4ad6371
Show file tree
Hide file tree
Showing 33 changed files with 2,101 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/wysb/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module github.com/simplyYan/Wysb/src/cmd/wysb

go 1.22.4

require (
github.com/simplyYan/Wysb/src/environment v0.0.0-20240901150216-bb5b0847535b
github.com/simplyYan/Wysb/src/evaluator v0.0.0-20240901150216-bb5b0847535b
github.com/simplyYan/Wysb/src/parser v0.0.0-20240901150216-bb5b0847535b
github.com/simplyYan/Wysb/src/tokenizer v0.0.0-20240901150216-bb5b0847535b
)
16 changes: 16 additions & 0 deletions cmd/wysb/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
github.com/simplyYan/Wysb/src/environment v0.0.0-20240901145127-2a71514d9cab h1:RF2ERpzR6CPLlMi5F4m0idWl6axX5LxyRkwtk98W3rM=
github.com/simplyYan/Wysb/src/environment v0.0.0-20240901145127-2a71514d9cab/go.mod h1:B7eOq6DxQ5n0PDFI/tQQyvxALcVHQd6oMiTbFItxiuM=
github.com/simplyYan/Wysb/src/environment v0.0.0-20240901150216-bb5b0847535b h1:tDOkQ/+PKjQ0QYnHqYIhQ4XS7JQ8wGQ8O6VOrNZrnQo=
github.com/simplyYan/Wysb/src/environment v0.0.0-20240901150216-bb5b0847535b/go.mod h1:B7eOq6DxQ5n0PDFI/tQQyvxALcVHQd6oMiTbFItxiuM=
github.com/simplyYan/Wysb/src/evaluator v0.0.0-20240901145127-2a71514d9cab h1:YBQOK/FP2XPf5klds5zb5r8nPIflqFqmNPZPbDEbmm4=
github.com/simplyYan/Wysb/src/evaluator v0.0.0-20240901145127-2a71514d9cab/go.mod h1:MOKioqkwItjCzqMzufhXy5pnqBuDuiaZV/eZHd7yYG0=
github.com/simplyYan/Wysb/src/evaluator v0.0.0-20240901150216-bb5b0847535b h1:pdZy2oY2ztAWj9Csqynv/mGCJABBVdN2U1EMQlBrdbg=
github.com/simplyYan/Wysb/src/evaluator v0.0.0-20240901150216-bb5b0847535b/go.mod h1:OuB8YAeYmQ6xF3Kl4JD6gcH3hFrYBawsvSF49/QBfdE=
github.com/simplyYan/Wysb/src/parser v0.0.0-20240901145127-2a71514d9cab h1:rvsql9W0lFc4xVbTFDVbeD+yBtj57hs4E7zZC3HkbNA=
github.com/simplyYan/Wysb/src/parser v0.0.0-20240901145127-2a71514d9cab/go.mod h1:rnzjh9UrNJxoTVWCu3bJlIakiQpN/wwrtpbiAE1Wqn4=
github.com/simplyYan/Wysb/src/parser v0.0.0-20240901150216-bb5b0847535b h1:++odJZaWSPm6iTVg5flt8FpGBEWjmbfGTXMGy+1hlBo=
github.com/simplyYan/Wysb/src/parser v0.0.0-20240901150216-bb5b0847535b/go.mod h1:WM6Y5BWjD1QQYrQqCEGJuGTRTi4IEx6DmRLiQtc6efQ=
github.com/simplyYan/Wysb/src/tokenizer v0.0.0-20240901145127-2a71514d9cab h1:cFQwwsq/oRvghl9PErQrOBgVI5+siZCyXvN9ES3FVwI=
github.com/simplyYan/Wysb/src/tokenizer v0.0.0-20240901145127-2a71514d9cab/go.mod h1:U9rAituQIBCCbO1EAW+V5ZbGSg4T7j9RcvHlZA6wRd8=
github.com/simplyYan/Wysb/src/tokenizer v0.0.0-20240901150216-bb5b0847535b h1:bd0+onxpIERmoMUKcoK6QuhN3uAvJtpz5BuBU2OMs1Y=
github.com/simplyYan/Wysb/src/tokenizer v0.0.0-20240901150216-bb5b0847535b/go.mod h1:U9rAituQIBCCbO1EAW+V5ZbGSg4T7j9RcvHlZA6wRd8=
37 changes: 37 additions & 0 deletions cmd/wysb/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// cmd/wysb/main.go
package main

import (
"fmt"
"io/ioutil"
"os"

"github.com/simplyYan/Wysb/src/environment"
"github.com/simplyYan/Wysb/src/evaluator"
"github.com/simplyYan/Wysb/src/parser"
"github.com/simplyYan/Wysb/src/tokenizer"
)

func main() {
if len(os.Args) < 2 {
fmt.Println("Usage: wysb <file>")
return
}

filename := os.Args[1]
source, err := ioutil.ReadFile(filename)
if err != nil {
fmt.Println("Error reading file:", err)
return
}

tokens := tokenizer.Tokenize(string(source))
ast := parser.Parse(tokens)

env := environment.NewEnvironment()
for _, stmt := range ast {
evaluator.Eval(stmt, env)
}

fmt.Println("Execution finished. Environment state:", env.Variables())
}
9 changes: 9 additions & 0 deletions cmd/wysb/test.wys
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
let x: int = 10;
let y: int = 20;
let z: int = x + y;

if z > 15 {
print("z é maior que 15");
} else {
print("z é menor ou igual a 15");
}
121 changes: 121 additions & 0 deletions cmd/wysb/vendor/github.com/simplyYan/Wysb/src/environment/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

121 changes: 121 additions & 0 deletions cmd/wysb/vendor/github.com/simplyYan/Wysb/src/evaluator/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4ad6371

Please sign in to comment.