Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to new name #9

Merged
merged 1 commit into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project_name: chewa
project_name: duwa

dist: .builds

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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 ./...
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -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).

Expand All @@ -15,7 +15,7 @@ lemba("Moni Dziko");
Run you new application

```bash
chewa -f ./main.ny
duwa -f ./main.ny
```

## Zowerenga bwa?
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/sevenreup/chewa
module github.com/sevenreup/duwa

go 1.22.0

Expand Down
2 changes: 1 addition & 1 deletion src/ast/array.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package ast

import (
"bytes"
"github.com/sevenreup/chewa/src/token"
"github.com/sevenreup/duwa/src/token"
"strings"
)

Expand Down
2 changes: 1 addition & 1 deletion src/ast/ast_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/ast/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package ast

import (
"bytes"
"github.com/sevenreup/chewa/src/token"
"github.com/sevenreup/duwa/src/token"
)

type BlockStatement struct {
Expand Down
2 changes: 1 addition & 1 deletion src/ast/boolean.go
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/ast/call.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package ast

import (
"bytes"
"github.com/sevenreup/chewa/src/token"
"github.com/sevenreup/duwa/src/token"
"strings"
)

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

"github.com/sevenreup/chewa/src/token"
"github.com/sevenreup/duwa/src/token"
)

type ClassStatement struct {
Expand Down
3 changes: 1 addition & 2 deletions src/ast/compound.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ast

import "github.com/sevenreup/chewa/src/token"
import "github.com/sevenreup/duwa/src/token"

type Compound struct {
Expression
Expand All @@ -16,4 +16,3 @@ func (fl *Compound) TokenLiteral() string { return fl.Token.Literal }
func (fl *Compound) String() string {
return ""
}

2 changes: 1 addition & 1 deletion src/ast/expression.go
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/ast/for.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ast

import "github.com/sevenreup/chewa/src/token"
import "github.com/sevenreup/duwa/src/token"

type ForExpression struct {
Expression
Expand Down
2 changes: 1 addition & 1 deletion src/ast/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package ast

import (
"bytes"
"github.com/sevenreup/chewa/src/token"
"github.com/sevenreup/duwa/src/token"
"strings"
)

Expand Down
2 changes: 1 addition & 1 deletion src/ast/identifier.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ast

import "github.com/sevenreup/chewa/src/token"
import "github.com/sevenreup/duwa/src/token"

type Identifier struct {
AssignmentNode
Expand Down
2 changes: 1 addition & 1 deletion src/ast/if.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package ast

import (
"bytes"
"github.com/sevenreup/chewa/src/token"
"github.com/sevenreup/duwa/src/token"
)

type IfExpression struct {
Expand Down
2 changes: 1 addition & 1 deletion src/ast/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package ast

import (
"bytes"
"github.com/sevenreup/chewa/src/token"
"github.com/sevenreup/duwa/src/token"
)

type IndexExpression struct {
Expand Down
2 changes: 1 addition & 1 deletion src/ast/infix.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package ast

import (
"bytes"
"github.com/sevenreup/chewa/src/token"
"github.com/sevenreup/duwa/src/token"
)

type InfixExpression struct {
Expand Down
2 changes: 1 addition & 1 deletion src/ast/integer.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ast

import (
"github.com/sevenreup/chewa/src/token"
"github.com/sevenreup/duwa/src/token"
"github.com/shopspring/decimal"
)

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

import (
"github.com/sevenreup/chewa/src/token"
"github.com/sevenreup/duwa/src/token"
)

type MapExpression struct {
Expand Down
2 changes: 1 addition & 1 deletion src/ast/method.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package ast

import (
"bytes"
"github.com/sevenreup/chewa/src/token"
"github.com/sevenreup/duwa/src/token"
"strings"
)

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

import (
"github.com/sevenreup/chewa/src/token"
"github.com/sevenreup/duwa/src/token"
)

type PostfixExpression struct {
Expand Down
2 changes: 1 addition & 1 deletion src/ast/prefix.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package ast

import (
"bytes"
"github.com/sevenreup/chewa/src/token"
"github.com/sevenreup/duwa/src/token"
)

type PrefixExpression struct {
Expand Down
2 changes: 1 addition & 1 deletion src/ast/return.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package ast

import (
"bytes"
"github.com/sevenreup/chewa/src/token"
"github.com/sevenreup/duwa/src/token"
)

type ReturnStatement struct {
Expand Down
2 changes: 1 addition & 1 deletion src/ast/string.go
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/ast/variable_declaration.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package ast
import (
"bytes"

"github.com/sevenreup/chewa/src/token"
"github.com/sevenreup/duwa/src/token"
)

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

import "github.com/sevenreup/chewa/src/token"
import "github.com/sevenreup/duwa/src/token"

type WhileExpression struct {
Expression
Expand Down
26 changes: 13 additions & 13 deletions src/chewa/chewa.go → src/duwa/duwa.go
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -41,6 +41,6 @@ func (c *Chewa) Run() {
evaluator.Eval(program, env)
}

func (c *Chewa) registerEvaluator() {
func (c *Duwa) registerEvaluator() {
object.RegisterEvaluator(evaluator.Eval)
}
6 changes: 3 additions & 3 deletions src/evaluator/assignment.go
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/evaluator/block.go
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/evaluator/boolean.go
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/evaluator/class.go
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/evaluator/compound.go
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/evaluator/declation.go
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/evaluator/evaluator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading
Loading