diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 371f94c..4304748 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,4 +1,4 @@ -project_name: chewa +project_name: duwa dist: .builds diff --git a/Makefile b/Makefile index 5119999..1a2ec6f 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,11 @@ build: - @go build -C src -o ../bin/chewa + @go build -C src -o ../bin/duwa dev: @go run src/main.go run: build - @./bin/chewa + @./bin/duwa lint: @golangci-lint run -c ./golangci.yml ./... diff --git a/README.md b/README.md index 6eb5dea..21293e3 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -# Chewa Programming Language (in progress) -This project is an interpreter for the `chewa` language (Name still getting worked shopped), a language based on the Chewa Bantu language. +# Duwa Programming Language (in progress) +This project is an interpreter for the `duwa` language (Name still getting worked shopped), a language based on the Chewa Bantu language. This project is written in Golang. ## Setup and Moni ku dziko -Download the prebuilt binaries for your platform from the [release](https://github.com/sevenreup/chewa/releases) +Download the prebuilt binaries for your platform from the [release](https://github.com/sevenreup/duwa/releases) Create a new source file, `main.ny` (💀 for now the extension does not matter). @@ -15,7 +15,7 @@ lemba("Moni Dziko"); Run you new application ```bash -chewa -f ./main.ny +duwa -f ./main.ny ``` ## Zowerenga bwa? diff --git a/examples/array.ny b/examples/array.duwa similarity index 100% rename from examples/array.ny rename to examples/array.duwa diff --git a/examples/classes.ny b/examples/classes.duwa similarity index 100% rename from examples/classes.ny rename to examples/classes.duwa diff --git a/examples/console.ny b/examples/console.duwa similarity index 100% rename from examples/console.ny rename to examples/console.duwa diff --git a/examples/fibonacci.ny b/examples/fibonacci.duwa similarity index 100% rename from examples/fibonacci.ny rename to examples/fibonacci.duwa diff --git a/examples/functions.ny b/examples/functions.duwa similarity index 100% rename from examples/functions.ny rename to examples/functions.duwa diff --git a/examples/games/tictactoe.ny b/examples/games/tictactoe.duwa similarity index 100% rename from examples/games/tictactoe.ny rename to examples/games/tictactoe.duwa diff --git a/examples/map.ny b/examples/map.duwa similarity index 100% rename from examples/map.ny rename to examples/map.duwa diff --git a/examples/moni_dziko.ny b/examples/moni_dziko.duwa similarity index 100% rename from examples/moni_dziko.ny rename to examples/moni_dziko.duwa diff --git a/examples/search.ny b/examples/search.duwa similarity index 100% rename from examples/search.ny rename to examples/search.duwa diff --git a/examples/sorting.ny b/examples/sorting.duwa similarity index 100% rename from examples/sorting.ny rename to examples/sorting.duwa diff --git a/examples/variables.ny b/examples/variables.duwa similarity index 100% rename from examples/variables.ny rename to examples/variables.duwa diff --git a/go.mod b/go.mod index 18ca942..87eafcd 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/sevenreup/chewa +module github.com/sevenreup/duwa go 1.22.0 diff --git a/src/ast/array.go b/src/ast/array.go index 73cee8c..1210853 100644 --- a/src/ast/array.go +++ b/src/ast/array.go @@ -2,7 +2,7 @@ package ast import ( "bytes" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/token" "strings" ) diff --git a/src/ast/ast_test.go b/src/ast/ast_test.go index 7b5500d..0d93f3e 100644 --- a/src/ast/ast_test.go +++ b/src/ast/ast_test.go @@ -3,7 +3,7 @@ package ast import ( "testing" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/token" ) func TestString(t *testing.T) { diff --git a/src/ast/block.go b/src/ast/block.go index b89f557..d52d306 100644 --- a/src/ast/block.go +++ b/src/ast/block.go @@ -2,7 +2,7 @@ package ast import ( "bytes" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/token" ) type BlockStatement struct { diff --git a/src/ast/boolean.go b/src/ast/boolean.go index 4d5cd3d..bb3673d 100644 --- a/src/ast/boolean.go +++ b/src/ast/boolean.go @@ -1,6 +1,6 @@ package ast -import "github.com/sevenreup/chewa/src/token" +import "github.com/sevenreup/duwa/src/token" type Boolean struct { Token token.Token diff --git a/src/ast/call.go b/src/ast/call.go index 37e76c8..acf19c7 100644 --- a/src/ast/call.go +++ b/src/ast/call.go @@ -2,7 +2,7 @@ package ast import ( "bytes" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/token" "strings" ) diff --git a/src/ast/class.go b/src/ast/class.go index b9d159d..889edb4 100644 --- a/src/ast/class.go +++ b/src/ast/class.go @@ -3,7 +3,7 @@ package ast import ( "bytes" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/token" ) type ClassStatement struct { diff --git a/src/ast/compound.go b/src/ast/compound.go index b71d453..9197acb 100644 --- a/src/ast/compound.go +++ b/src/ast/compound.go @@ -1,6 +1,6 @@ package ast -import "github.com/sevenreup/chewa/src/token" +import "github.com/sevenreup/duwa/src/token" type Compound struct { Expression @@ -16,4 +16,3 @@ func (fl *Compound) TokenLiteral() string { return fl.Token.Literal } func (fl *Compound) String() string { return "" } - diff --git a/src/ast/expression.go b/src/ast/expression.go index 3b5b345..047573b 100644 --- a/src/ast/expression.go +++ b/src/ast/expression.go @@ -1,6 +1,6 @@ package ast -import "github.com/sevenreup/chewa/src/token" +import "github.com/sevenreup/duwa/src/token" type ExpressionStatement struct { Token token.Token // the first token of the expression diff --git a/src/ast/for.go b/src/ast/for.go index 94a56ee..b7a9a6a 100644 --- a/src/ast/for.go +++ b/src/ast/for.go @@ -1,6 +1,6 @@ package ast -import "github.com/sevenreup/chewa/src/token" +import "github.com/sevenreup/duwa/src/token" type ForExpression struct { Expression diff --git a/src/ast/function.go b/src/ast/function.go index 38e56b9..1f0ba5d 100644 --- a/src/ast/function.go +++ b/src/ast/function.go @@ -2,7 +2,7 @@ package ast import ( "bytes" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/token" "strings" ) diff --git a/src/ast/identifier.go b/src/ast/identifier.go index fe5b988..4503414 100644 --- a/src/ast/identifier.go +++ b/src/ast/identifier.go @@ -1,6 +1,6 @@ package ast -import "github.com/sevenreup/chewa/src/token" +import "github.com/sevenreup/duwa/src/token" type Identifier struct { AssignmentNode diff --git a/src/ast/if.go b/src/ast/if.go index ae6daff..2fb62f0 100644 --- a/src/ast/if.go +++ b/src/ast/if.go @@ -2,7 +2,7 @@ package ast import ( "bytes" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/token" ) type IfExpression struct { diff --git a/src/ast/index.go b/src/ast/index.go index a6d7a0a..74c0039 100644 --- a/src/ast/index.go +++ b/src/ast/index.go @@ -2,7 +2,7 @@ package ast import ( "bytes" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/token" ) type IndexExpression struct { diff --git a/src/ast/infix.go b/src/ast/infix.go index 5fff96b..4d06b74 100644 --- a/src/ast/infix.go +++ b/src/ast/infix.go @@ -2,7 +2,7 @@ package ast import ( "bytes" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/token" ) type InfixExpression struct { diff --git a/src/ast/integer.go b/src/ast/integer.go index 7097468..9920ebf 100644 --- a/src/ast/integer.go +++ b/src/ast/integer.go @@ -1,7 +1,7 @@ package ast import ( - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/token" "github.com/shopspring/decimal" ) diff --git a/src/ast/map.go b/src/ast/map.go index 58c5d17..0e766c9 100644 --- a/src/ast/map.go +++ b/src/ast/map.go @@ -1,7 +1,7 @@ package ast import ( - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/token" ) type MapExpression struct { diff --git a/src/ast/method.go b/src/ast/method.go index 671796b..0bd52e9 100644 --- a/src/ast/method.go +++ b/src/ast/method.go @@ -2,7 +2,7 @@ package ast import ( "bytes" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/token" "strings" ) diff --git a/src/ast/postfix.go b/src/ast/postfix.go index 9806e34..6383087 100644 --- a/src/ast/postfix.go +++ b/src/ast/postfix.go @@ -1,7 +1,7 @@ package ast import ( - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/token" ) type PostfixExpression struct { diff --git a/src/ast/prefix.go b/src/ast/prefix.go index 3304809..bc1c4f6 100644 --- a/src/ast/prefix.go +++ b/src/ast/prefix.go @@ -2,7 +2,7 @@ package ast import ( "bytes" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/token" ) type PrefixExpression struct { diff --git a/src/ast/return.go b/src/ast/return.go index dba9aae..8936de1 100644 --- a/src/ast/return.go +++ b/src/ast/return.go @@ -2,7 +2,7 @@ package ast import ( "bytes" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/token" ) type ReturnStatement struct { diff --git a/src/ast/string.go b/src/ast/string.go index 642b31f..a6fd2ba 100644 --- a/src/ast/string.go +++ b/src/ast/string.go @@ -1,6 +1,6 @@ package ast -import "github.com/sevenreup/chewa/src/token" +import "github.com/sevenreup/duwa/src/token" type StringLiteral struct { Token token.Token diff --git a/src/ast/variable_declaration.go b/src/ast/variable_declaration.go index fd921a1..3d9d022 100644 --- a/src/ast/variable_declaration.go +++ b/src/ast/variable_declaration.go @@ -3,7 +3,7 @@ package ast import ( "bytes" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/token" ) type VariableDeclarationStatement struct { diff --git a/src/ast/while.go b/src/ast/while.go index c763299..0ca637f 100644 --- a/src/ast/while.go +++ b/src/ast/while.go @@ -1,6 +1,6 @@ package ast -import "github.com/sevenreup/chewa/src/token" +import "github.com/sevenreup/duwa/src/token" type WhileExpression struct { Expression diff --git a/src/chewa/chewa.go b/src/duwa/duwa.go similarity index 55% rename from src/chewa/chewa.go rename to src/duwa/duwa.go index 5e03044..3b4e109 100644 --- a/src/chewa/chewa.go +++ b/src/duwa/duwa.go @@ -1,32 +1,32 @@ -package chewa +package duwa import ( "log" "os" - "github.com/sevenreup/chewa/src/evaluator" - "github.com/sevenreup/chewa/src/object" - "github.com/sevenreup/chewa/src/utils" + "github.com/sevenreup/duwa/src/evaluator" + "github.com/sevenreup/duwa/src/object" + "github.com/sevenreup/duwa/src/utils" - "github.com/sevenreup/chewa/src/lexer" - "github.com/sevenreup/chewa/src/parser" + "github.com/sevenreup/duwa/src/lexer" + "github.com/sevenreup/duwa/src/parser" ) -type Chewa struct { +type Duwa struct { file string Environment *object.Environment } -func New(file string) *Chewa { - chewa := &Chewa{ +func New(file string) *Duwa { + duwa := &Duwa{ file: file, Environment: object.NewEnvironment(), } - chewa.registerEvaluator() - return chewa + duwa.registerEvaluator() + return duwa } -func (c *Chewa) Run() { +func (c *Duwa) Run() { file, err := os.ReadFile(c.file) if err != nil { log.Fatal(err) @@ -41,6 +41,6 @@ func (c *Chewa) Run() { evaluator.Eval(program, env) } -func (c *Chewa) registerEvaluator() { +func (c *Duwa) registerEvaluator() { object.RegisterEvaluator(evaluator.Eval) } diff --git a/src/evaluator/assignment.go b/src/evaluator/assignment.go index 0e3b6f1..ff11230 100644 --- a/src/evaluator/assignment.go +++ b/src/evaluator/assignment.go @@ -1,9 +1,9 @@ package evaluator import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/object" - "github.com/sevenreup/chewa/src/values" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/object" + "github.com/sevenreup/duwa/src/values" ) func evaluateAssigment(node *ast.AssigmentStatement, env *object.Environment) object.Object { diff --git a/src/evaluator/block.go b/src/evaluator/block.go index 8c3bc86..3addee9 100644 --- a/src/evaluator/block.go +++ b/src/evaluator/block.go @@ -1,8 +1,8 @@ package evaluator import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/object" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/object" ) func evalBlockStatement(block *ast.BlockStatement, env *object.Environment) object.Object { diff --git a/src/evaluator/boolean.go b/src/evaluator/boolean.go index 4208b53..bf36e48 100644 --- a/src/evaluator/boolean.go +++ b/src/evaluator/boolean.go @@ -1,8 +1,8 @@ package evaluator import ( - "github.com/sevenreup/chewa/src/object" - "github.com/sevenreup/chewa/src/values" + "github.com/sevenreup/duwa/src/object" + "github.com/sevenreup/duwa/src/values" ) func nativeBoolToBooleanObject(input bool) *object.Boolean { diff --git a/src/evaluator/class.go b/src/evaluator/class.go index 02c9f28..96e9cb8 100644 --- a/src/evaluator/class.go +++ b/src/evaluator/class.go @@ -1,8 +1,8 @@ package evaluator import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/object" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/object" ) func evaluateClass(node *ast.ClassStatement, env *object.Environment) object.Object { diff --git a/src/evaluator/compound.go b/src/evaluator/compound.go index b2b822c..539dbb9 100644 --- a/src/evaluator/compound.go +++ b/src/evaluator/compound.go @@ -1,8 +1,8 @@ package evaluator import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/object" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/object" ) func evaluateCompound(node *ast.Compound, env *object.Environment) object.Object { diff --git a/src/evaluator/declation.go b/src/evaluator/declation.go index 1bc910f..eeb07a3 100644 --- a/src/evaluator/declation.go +++ b/src/evaluator/declation.go @@ -1,8 +1,8 @@ package evaluator import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/object" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/object" ) // TODO: Handle type diff --git a/src/evaluator/evaluator.go b/src/evaluator/evaluator.go index f3a8fb6..b8ae3e6 100644 --- a/src/evaluator/evaluator.go +++ b/src/evaluator/evaluator.go @@ -3,9 +3,9 @@ package evaluator import ( "fmt" - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/object" - "github.com/sevenreup/chewa/src/values" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/object" + "github.com/sevenreup/duwa/src/values" ) type Evaluator func(node ast.Node, env *object.Environment) object.Object diff --git a/src/evaluator/evaluator_test.go b/src/evaluator/evaluator_test.go index 9d4c009..4884c9f 100644 --- a/src/evaluator/evaluator_test.go +++ b/src/evaluator/evaluator_test.go @@ -1,10 +1,10 @@ package evaluator import ( - "github.com/sevenreup/chewa/src/lexer" - "github.com/sevenreup/chewa/src/object" - "github.com/sevenreup/chewa/src/parser" - "github.com/sevenreup/chewa/src/values" + "github.com/sevenreup/duwa/src/lexer" + "github.com/sevenreup/duwa/src/object" + "github.com/sevenreup/duwa/src/parser" + "github.com/sevenreup/duwa/src/values" "github.com/shopspring/decimal" "testing" ) diff --git a/src/evaluator/expression.go b/src/evaluator/expression.go index 3aed486..8b773ed 100644 --- a/src/evaluator/expression.go +++ b/src/evaluator/expression.go @@ -1,8 +1,8 @@ package evaluator import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/object" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/object" ) func evalExpressions( diff --git a/src/evaluator/for_loop.go b/src/evaluator/for_loop.go index a655cf1..e38606e 100644 --- a/src/evaluator/for_loop.go +++ b/src/evaluator/for_loop.go @@ -1,9 +1,9 @@ package evaluator import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/object" - "github.com/sevenreup/chewa/src/values" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/object" + "github.com/sevenreup/duwa/src/values" ) func evalForLoop(node *ast.ForExpression, env *object.Environment) object.Object { diff --git a/src/evaluator/function.go b/src/evaluator/function.go index 69ffaaa..b02e81a 100644 --- a/src/evaluator/function.go +++ b/src/evaluator/function.go @@ -1,9 +1,9 @@ package evaluator import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/object" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/object" + "github.com/sevenreup/duwa/src/token" ) func evaluateFunctionCall(node *ast.CallExpression, env *object.Environment) object.Object { diff --git a/src/evaluator/identifier.go b/src/evaluator/identifier.go index e4214bd..cfbc4e4 100644 --- a/src/evaluator/identifier.go +++ b/src/evaluator/identifier.go @@ -1,9 +1,9 @@ package evaluator import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/library" - "github.com/sevenreup/chewa/src/object" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/library" + "github.com/sevenreup/duwa/src/object" ) func evalIdentifier( diff --git a/src/evaluator/if.go b/src/evaluator/if.go index f5f6d22..f48fbd9 100644 --- a/src/evaluator/if.go +++ b/src/evaluator/if.go @@ -1,9 +1,9 @@ package evaluator import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/object" - "github.com/sevenreup/chewa/src/values" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/object" + "github.com/sevenreup/duwa/src/values" ) func evalIfExpression(ie *ast.IfExpression, env *object.Environment) object.Object { diff --git a/src/evaluator/index.go b/src/evaluator/index.go index 4260aee..2d53107 100644 --- a/src/evaluator/index.go +++ b/src/evaluator/index.go @@ -1,9 +1,9 @@ package evaluator import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/object" - "github.com/sevenreup/chewa/src/values" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/object" + "github.com/sevenreup/duwa/src/values" ) func evalIndexExpression(node *ast.IndexExpression, env *object.Environment) object.Object { diff --git a/src/evaluator/infix.go b/src/evaluator/infix.go index 7974584..715783f 100644 --- a/src/evaluator/infix.go +++ b/src/evaluator/infix.go @@ -1,8 +1,8 @@ package evaluator import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/object" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/object" ) func evalInfixExpression( diff --git a/src/evaluator/map.go b/src/evaluator/map.go index 66457c7..dc0181a 100644 --- a/src/evaluator/map.go +++ b/src/evaluator/map.go @@ -1,8 +1,8 @@ package evaluator import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/object" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/object" ) func evalMapExpression(node *ast.MapExpression, diff --git a/src/evaluator/methods.go b/src/evaluator/methods.go index 432a1e2..31b47fd 100644 --- a/src/evaluator/methods.go +++ b/src/evaluator/methods.go @@ -1,8 +1,8 @@ package evaluator import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/object" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/object" ) func evaluateMethod(node *ast.MethodExpression, env *object.Environment) object.Object { diff --git a/src/evaluator/number.go b/src/evaluator/number.go index bb848c1..bc9c46f 100644 --- a/src/evaluator/number.go +++ b/src/evaluator/number.go @@ -1,6 +1,6 @@ package evaluator -import "github.com/sevenreup/chewa/src/object" +import "github.com/sevenreup/duwa/src/object" func evalIntegerInfixExpression( operator string, diff --git a/src/evaluator/postfix.go b/src/evaluator/postfix.go index ac4baae..2b37452 100644 --- a/src/evaluator/postfix.go +++ b/src/evaluator/postfix.go @@ -1,8 +1,8 @@ package evaluator import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/object" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/object" "github.com/shopspring/decimal" ) diff --git a/src/evaluator/prefix.go b/src/evaluator/prefix.go index e8a667b..274f5df 100644 --- a/src/evaluator/prefix.go +++ b/src/evaluator/prefix.go @@ -1,8 +1,8 @@ package evaluator import ( - "github.com/sevenreup/chewa/src/object" - "github.com/sevenreup/chewa/src/values" + "github.com/sevenreup/duwa/src/object" + "github.com/sevenreup/duwa/src/values" ) func evalPrefixExpression(operator string, right object.Object) object.Object { diff --git a/src/evaluator/program.go b/src/evaluator/program.go index e3e26ed..2f4e97c 100644 --- a/src/evaluator/program.go +++ b/src/evaluator/program.go @@ -1,8 +1,8 @@ package evaluator import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/object" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/object" ) func evalProgram(program *ast.Program, env *object.Environment) object.Object { diff --git a/src/evaluator/return.go b/src/evaluator/return.go index 7629302..8641e4c 100644 --- a/src/evaluator/return.go +++ b/src/evaluator/return.go @@ -1,6 +1,6 @@ package evaluator -import "github.com/sevenreup/chewa/src/object" +import "github.com/sevenreup/duwa/src/object" func unwrapReturnValue(obj object.Object) object.Object { if returnValue, ok := obj.(*object.ReturnValue); ok { diff --git a/src/evaluator/string.go b/src/evaluator/string.go index d55ccf9..8b30aa6 100644 --- a/src/evaluator/string.go +++ b/src/evaluator/string.go @@ -1,6 +1,6 @@ package evaluator -import "github.com/sevenreup/chewa/src/object" +import "github.com/sevenreup/duwa/src/object" func evalStringInfixExpression( operator string, diff --git a/src/evaluator/while.go b/src/evaluator/while.go index 8f4f917..59c5b95 100644 --- a/src/evaluator/while.go +++ b/src/evaluator/while.go @@ -1,8 +1,8 @@ package evaluator import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/object" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/object" ) func evaluateWhile(node *ast.WhileExpression, env *object.Environment) object.Object { diff --git a/src/lexer/lexer.go b/src/lexer/lexer.go index 37ce872..d4c4d92 100644 --- a/src/lexer/lexer.go +++ b/src/lexer/lexer.go @@ -8,7 +8,7 @@ import ( "strings" "unicode" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/token" ) type Lexer struct { diff --git a/src/lexer/lexer_test.go b/src/lexer/lexer_test.go index dd7a36f..ba8b697 100644 --- a/src/lexer/lexer_test.go +++ b/src/lexer/lexer_test.go @@ -3,7 +3,7 @@ package lexer import ( "testing" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/token" ) func TestNextToken(t *testing.T) { diff --git a/src/library/functions/converters.go b/src/library/functions/converters.go index 19fa1bf..7671373 100644 --- a/src/library/functions/converters.go +++ b/src/library/functions/converters.go @@ -1,8 +1,8 @@ package functions import ( - "github.com/sevenreup/chewa/src/object" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/object" + "github.com/sevenreup/duwa/src/token" "github.com/shopspring/decimal" ) diff --git a/src/library/functions/print.go b/src/library/functions/print.go index 7fca2df..edc405f 100644 --- a/src/library/functions/print.go +++ b/src/library/functions/print.go @@ -2,8 +2,8 @@ package functions import ( "fmt" - "github.com/sevenreup/chewa/src/object" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/object" + "github.com/sevenreup/duwa/src/token" "os" "strings" ) diff --git a/src/library/library.go b/src/library/library.go index 831b4fb..ae390b4 100644 --- a/src/library/library.go +++ b/src/library/library.go @@ -1,9 +1,9 @@ package library import ( - "github.com/sevenreup/chewa/src/library/functions" - "github.com/sevenreup/chewa/src/library/modules" - "github.com/sevenreup/chewa/src/object" + "github.com/sevenreup/duwa/src/library/functions" + "github.com/sevenreup/duwa/src/library/modules" + "github.com/sevenreup/duwa/src/object" ) var Modules = map[string]*object.LibraryModule{} diff --git a/src/library/modules/console.go b/src/library/modules/console.go index b71b339..c5f2ee4 100644 --- a/src/library/modules/console.go +++ b/src/library/modules/console.go @@ -9,9 +9,9 @@ import ( "strconv" "strings" - "github.com/sevenreup/chewa/src/values" - "github.com/sevenreup/chewa/src/object" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/object" + "github.com/sevenreup/duwa/src/token" + "github.com/sevenreup/duwa/src/values" ) var ConsoleMethods = map[string]*object.LibraryFunction{} diff --git a/src/library/modules/math.go b/src/library/modules/math.go index 7a48251..47623ad 100644 --- a/src/library/modules/math.go +++ b/src/library/modules/math.go @@ -1,8 +1,8 @@ package modules import ( - "github.com/sevenreup/chewa/src/object" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/object" + "github.com/sevenreup/duwa/src/token" "github.com/shopspring/decimal" ) diff --git a/src/library/modules/modules.go b/src/library/modules/modules.go index 57d4221..86d5319 100644 --- a/src/library/modules/modules.go +++ b/src/library/modules/modules.go @@ -1,8 +1,8 @@ package modules import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/object" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/object" ) var evaluate func(node ast.Node, env *object.Environment) object.Object diff --git a/src/main.go b/src/main.go index e4ccc44..d49cfcd 100644 --- a/src/main.go +++ b/src/main.go @@ -4,7 +4,7 @@ import ( "flag" "log" - "github.com/sevenreup/chewa/src/chewa" + "github.com/sevenreup/duwa/src/duwa" ) var ( @@ -22,6 +22,6 @@ func main() { log.Fatal("Please provide a file to run") } - chewa := chewa.New(file) - chewa.Run() + duwa := duwa.New(file) + duwa.Run() } diff --git a/src/object/class.go b/src/object/class.go index 4543b1f..f690f64 100644 --- a/src/object/class.go +++ b/src/object/class.go @@ -1,6 +1,6 @@ package object -import "github.com/sevenreup/chewa/src/ast" +import "github.com/sevenreup/duwa/src/ast" const CLASS_OBJ = "CLASS" diff --git a/src/object/function.go b/src/object/function.go index 5012f26..692ffe3 100644 --- a/src/object/function.go +++ b/src/object/function.go @@ -2,7 +2,7 @@ package object import ( "bytes" - "github.com/sevenreup/chewa/src/ast" + "github.com/sevenreup/duwa/src/ast" "strings" ) diff --git a/src/object/object.go b/src/object/object.go index c4a6223..52d97e6 100644 --- a/src/object/object.go +++ b/src/object/object.go @@ -1,8 +1,8 @@ package object import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/token" ) var evaluator func(node ast.Node, env *Environment) Object diff --git a/src/parser/array.go b/src/parser/array.go index b1eb94b..ecbafdb 100644 --- a/src/parser/array.go +++ b/src/parser/array.go @@ -1,8 +1,8 @@ package parser import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/token" ) func (p *Parser) parseArrayLiteral() ast.Expression { diff --git a/src/parser/assign.go b/src/parser/assign.go index 95ba238..3ba4064 100644 --- a/src/parser/assign.go +++ b/src/parser/assign.go @@ -1,8 +1,8 @@ package parser import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/token" ) func (p *Parser) parseAssignmentStatement() *ast.AssigmentStatement { @@ -34,7 +34,7 @@ func (p *Parser) handleIndexAssigment(indexExp *ast.IndexExpression) *ast.Assigm } p.nextToken() - + statement.Identifier = indexExp if !p.curTokenIs(token.ASSIGN) { diff --git a/src/parser/block.go b/src/parser/block.go index 7d1804f..232268b 100644 --- a/src/parser/block.go +++ b/src/parser/block.go @@ -1,8 +1,8 @@ package parser import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/token" ) func (p *Parser) parseBlockStatement() *ast.BlockStatement { diff --git a/src/parser/boolean.go b/src/parser/boolean.go index 07af6e2..3abb85d 100644 --- a/src/parser/boolean.go +++ b/src/parser/boolean.go @@ -1,8 +1,8 @@ package parser import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/token" ) func (p *Parser) parseBoolean() ast.Expression { diff --git a/src/parser/call.go b/src/parser/call.go index de09b3a..82a4990 100644 --- a/src/parser/call.go +++ b/src/parser/call.go @@ -1,8 +1,8 @@ package parser import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/token" ) func (p *Parser) parseCallExpression(function ast.Expression) ast.Expression { diff --git a/src/parser/class.go b/src/parser/class.go index 0cd09d9..8dd44a0 100644 --- a/src/parser/class.go +++ b/src/parser/class.go @@ -1,8 +1,8 @@ package parser import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/token" ) func (p *Parser) classStatement() ast.Expression { diff --git a/src/parser/compound.go b/src/parser/compound.go index 34d7a0f..ffaed1d 100644 --- a/src/parser/compound.go +++ b/src/parser/compound.go @@ -1,7 +1,7 @@ package parser import ( - "github.com/sevenreup/chewa/src/ast" + "github.com/sevenreup/duwa/src/ast" ) func (parser *Parser) parseCompoundExpression(left ast.Expression) ast.Expression { diff --git a/src/parser/dot.go b/src/parser/dot.go index 1fb6209..8ceb626 100644 --- a/src/parser/dot.go +++ b/src/parser/dot.go @@ -1,8 +1,8 @@ package parser import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/token" ) func (parser *Parser) dotExpression(left ast.Expression) ast.Expression { diff --git a/src/parser/expression.go b/src/parser/expression.go index d0ce7e5..454fcbd 100644 --- a/src/parser/expression.go +++ b/src/parser/expression.go @@ -1,8 +1,8 @@ package parser import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/token" ) func (p *Parser) parseExpression(precedence int) ast.Expression { diff --git a/src/parser/for.go b/src/parser/for.go index 629b874..6fd3e4b 100644 --- a/src/parser/for.go +++ b/src/parser/for.go @@ -1,8 +1,8 @@ package parser import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/token" ) func (parser *Parser) parseForExpression() ast.Expression { @@ -42,7 +42,7 @@ func (parser *Parser) parseForExpression() ast.Expression { } parser.nextToken() - + // parse condition statement expression.Condition = parser.parseExpression(LOWEST) if expression.Condition == nil { diff --git a/src/parser/function.go b/src/parser/function.go index 54d28e4..fb5530a 100644 --- a/src/parser/function.go +++ b/src/parser/function.go @@ -1,8 +1,8 @@ package parser import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/token" ) func (p *Parser) parseFunctionLiteral() ast.Expression { diff --git a/src/parser/group.go b/src/parser/group.go index 9d8d3bb..f6767db 100644 --- a/src/parser/group.go +++ b/src/parser/group.go @@ -1,8 +1,8 @@ package parser import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/token" ) func (p *Parser) parseGroupedExpression() ast.Expression { diff --git a/src/parser/identifier.go b/src/parser/identifier.go index c08db8f..6be3560 100644 --- a/src/parser/identifier.go +++ b/src/parser/identifier.go @@ -1,6 +1,6 @@ package parser -import "github.com/sevenreup/chewa/src/ast" +import "github.com/sevenreup/duwa/src/ast" func (p *Parser) parseIdentifier() ast.Expression { return &ast.Identifier{Token: p.curToken, Value: p.curToken.Literal} diff --git a/src/parser/if.go b/src/parser/if.go index c3bf397..b120638 100644 --- a/src/parser/if.go +++ b/src/parser/if.go @@ -1,8 +1,8 @@ package parser import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/token" ) func (p *Parser) parseIfExpression() ast.Expression { diff --git a/src/parser/index.go b/src/parser/index.go index 4b6f224..5ea91bc 100644 --- a/src/parser/index.go +++ b/src/parser/index.go @@ -1,8 +1,8 @@ package parser import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/token" ) func (p *Parser) parseIndexExpression(left ast.Expression) ast.Expression { diff --git a/src/parser/map.go b/src/parser/map.go index 29c5243..c84e8e3 100644 --- a/src/parser/map.go +++ b/src/parser/map.go @@ -1,8 +1,8 @@ package parser import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/token" ) func (parser *Parser) mapLiteral() ast.Expression { @@ -15,7 +15,6 @@ func (parser *Parser) mapLiteral() ast.Expression { } parser.nextToken() - key := parser.parseExpression(LOWEST) if !parser.expectPeek(token.COLON) { diff --git a/src/parser/number.go b/src/parser/number.go index 416fd6c..fb0c85b 100644 --- a/src/parser/number.go +++ b/src/parser/number.go @@ -2,7 +2,7 @@ package parser import ( "fmt" - "github.com/sevenreup/chewa/src/ast" + "github.com/sevenreup/duwa/src/ast" "github.com/shopspring/decimal" ) diff --git a/src/parser/parser.go b/src/parser/parser.go index 113491f..d507435 100644 --- a/src/parser/parser.go +++ b/src/parser/parser.go @@ -3,9 +3,9 @@ package parser import ( "fmt" - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/lexer" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/lexer" + "github.com/sevenreup/duwa/src/token" ) type ( @@ -86,7 +86,7 @@ func New(l *lexer.Lexer) *Parser { p.registerPrefix(token.WHILE, p.parseWhileExpression) p.registerPrefix(token.FUNCTION, p.parseFunctionLiteral) p.registerPrefix(token.CLASS, p.classStatement) - + p.registerPrefix(token.OPENING_BRACE, p.mapLiteral) p.registerPrefix(token.OPENING_PAREN, p.parseGroupedExpression) p.registerPrefix(token.OPENING_BRACKET, p.parseArrayLiteral) diff --git a/src/parser/parser_test.go b/src/parser/parser_test.go index c92c23b..941d4f7 100644 --- a/src/parser/parser_test.go +++ b/src/parser/parser_test.go @@ -6,9 +6,9 @@ import ( "github.com/shopspring/decimal" - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/lexer" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/lexer" + "github.com/sevenreup/duwa/src/token" ) func checkParserErrors(t *testing.T, p *Parser) { diff --git a/src/parser/postfix.go b/src/parser/postfix.go index 92be58b..f84237f 100644 --- a/src/parser/postfix.go +++ b/src/parser/postfix.go @@ -1,7 +1,7 @@ package parser import ( - "github.com/sevenreup/chewa/src/ast" + "github.com/sevenreup/duwa/src/ast" ) func (parser *Parser) parsePostfixExpression() ast.Expression { diff --git a/src/parser/return.go b/src/parser/return.go index d9b39cb..e3f178c 100644 --- a/src/parser/return.go +++ b/src/parser/return.go @@ -1,8 +1,8 @@ package parser import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/token" ) func (p *Parser) parseReturnStatement() *ast.ReturnStatement { diff --git a/src/parser/statement.go b/src/parser/statement.go index d1df44f..d7fab1b 100644 --- a/src/parser/statement.go +++ b/src/parser/statement.go @@ -1,8 +1,8 @@ package parser import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/token" ) func (p *Parser) parseStatement() ast.Statement { diff --git a/src/parser/string.go b/src/parser/string.go index d18dc29..35afa3e 100644 --- a/src/parser/string.go +++ b/src/parser/string.go @@ -1,6 +1,6 @@ package parser -import "github.com/sevenreup/chewa/src/ast" +import "github.com/sevenreup/duwa/src/ast" func (p *Parser) parseStringLiteral() ast.Expression { return &ast.StringLiteral{Token: p.curToken, Value: p.curToken.Literal} diff --git a/src/parser/variable_declaration.go b/src/parser/variable_declaration.go index 80ee9d8..7f65c00 100644 --- a/src/parser/variable_declaration.go +++ b/src/parser/variable_declaration.go @@ -1,8 +1,8 @@ package parser import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/token" ) func (p *Parser) parseVariableDeclarationStatement() *ast.VariableDeclarationStatement { diff --git a/src/parser/while.go b/src/parser/while.go index 8bd4d00..8e6b578 100644 --- a/src/parser/while.go +++ b/src/parser/while.go @@ -1,8 +1,8 @@ package parser import ( - "github.com/sevenreup/chewa/src/ast" - "github.com/sevenreup/chewa/src/token" + "github.com/sevenreup/duwa/src/ast" + "github.com/sevenreup/duwa/src/token" ) func (parser *Parser) parseWhileExpression() ast.Expression { diff --git a/src/repl/repl.go b/src/repl/repl.go index 7afaa65..5d7a5ce 100644 --- a/src/repl/repl.go +++ b/src/repl/repl.go @@ -3,13 +3,13 @@ package repl import ( "bufio" "fmt" - "github.com/sevenreup/chewa/src/evaluator" - "github.com/sevenreup/chewa/src/object" - "github.com/sevenreup/chewa/src/parser" - "github.com/sevenreup/chewa/src/utils" + "github.com/sevenreup/duwa/src/evaluator" + "github.com/sevenreup/duwa/src/object" + "github.com/sevenreup/duwa/src/parser" + "github.com/sevenreup/duwa/src/utils" "io" - "github.com/sevenreup/chewa/src/lexer" + "github.com/sevenreup/duwa/src/lexer" ) const PROMPT = ">> " diff --git a/src/values/value.go b/src/values/value.go index fff5df9..e62eb22 100644 --- a/src/values/value.go +++ b/src/values/value.go @@ -1,6 +1,6 @@ package values -import "github.com/sevenreup/chewa/src/object" +import "github.com/sevenreup/duwa/src/object" var ( NULL = &object.Null{}