-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
2,101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
121
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.
Oops, something went wrong.
25 changes: 25 additions & 0 deletions
25
cmd/wysb/vendor/github.com/simplyYan/Wysb/src/environment/environment.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
121 changes: 121 additions & 0 deletions
121
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.
Oops, something went wrong.
35 changes: 35 additions & 0 deletions
35
cmd/wysb/vendor/github.com/simplyYan/Wysb/src/evaluator/evaluator.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.