Skip to content

Commit

Permalink
vint ascii
Browse files Browse the repository at this point in the history
  • Loading branch information
tacheraSasi committed Nov 24, 2024
1 parent b057856 commit 3fedf3d
Show file tree
Hide file tree
Showing 35 changed files with 227 additions and 204 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ body:
- type: input
id: version
attributes:
label: Nuru version
label: vint version
description: |
Please make sure to use the latest version of Nuru before reporting any issues as it may have already been fixed.
Please make sure to use the latest version of vint before reporting any issues as it may have already been fixed.
validations:
required: true

Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ tutorials/en/*
config.json
*local*

# For Nuru executables
# For vint executables
/vint
/vint
/Nuru

dist/
16 changes: 16 additions & 0 deletions ascii.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
██╗ ██╗██╗███╗ ██╗████████╗██████╗ ██╗ ██╗██╗ ███████╗
██║ ██║██║████╗ ██║╚══██╔══╝██╔══██╗██║ ██║██║ ██╔════╝
██║ ██║██║██╔██╗ ██║ ██║ ██████╔╝██║ ██║██║ █████╗
╚██╗ ██╔╝██║██║╚██╗██║ ██║ ██╔══██╗██║ ██║██║ ██╔══╝
╚████╔╝ ██║██║ ╚████║ ██║ ██████╔╝██████╗ ██║██████╗ ███████╗
╚═══╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝╚═════╝ ╚══════╝




██╗ █████╗ ███╗ ██╗
██║ ██╔══██╗████╗ ██║
██║ ███████║██╔██╗ ██║
██║ ██╔══██║██║╚██╗██║
██████╗ ██║ ██║██║ ╚████║
╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═══╝
8 changes: 4 additions & 4 deletions evaluator/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import (
)

func evalPackage(node *ast.Package, env *object.Environment) object.Object {
pakeji := &object.Package{
Package := &object.Package{
Name: node.Name,
Env: env,
Scope: object.NewEnclosedEnvironment(env),
}

Eval(node.Block, pakeji.Scope)
env.Set(node.Name.Value, pakeji)
return pakeji
Eval(node.Block, Package.Scope)
env.Set(node.Name.Value, Package)
return Package
}
8 changes: 4 additions & 4 deletions examples/example.nr
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// basics

jina = "Nuru"
andika(jina) // Nuru
jina = "vint"
andika(jina) // vint

// lists

Expand Down Expand Up @@ -101,7 +101,7 @@ salamu = unda() {
salamu()

aina(2) // Output: "NAMBA"
aina("Nuru") // Output: "NENO"
aina("vint") // Output: "NENO"


orodha = {"jina": "Juma", "umri": 25}
Expand Down Expand Up @@ -323,7 +323,7 @@ andika(a == "mambo") // sikweli
a = "mambo"
a.idadi() // 5

a = "NURU"
a = "vint"
a.herufindogo() // vint

a = "vint mambo habari"
Expand Down
2 changes: 1 addition & 1 deletion examples/sudoku_solver.nr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
https://github.com/VictorKariuki
NURU program to solve Sudoku using Backtracking Algorithm
vint program to solve Sudoku using Backtracking Algorithm
The sudoku puzzle is represented as a 2D array. The empty
cells are represented by 0. The algorithm works by trying
Expand Down
4 changes: 2 additions & 2 deletions extensions/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Nuru Extensions For Various Editors
# vint Extensions For Various Editors

## [VSCODE](./vscode/)

Nuru syntax highlighting on VSCode
vint syntax highlighting on VSCode

## [VIM](./vim)

Expand Down
2 changes: 1 addition & 1 deletion extensions/vim/syntax/nuru.vim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
" Sintaksia ya vint kwenye programu ya "vim"
" Lugha: Nuru
" Lugha: vint

" Maneno tengwa
syntax keyword vintKeyword unda pakeji rudisha vunja endelea tupu
Expand Down
6 changes: 3 additions & 3 deletions extensions/vscode/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Nuru VSCode Extension
# vint VSCode Extension

This is a syntax highliting extension for Nuru on vscode. It detects `.nr` and `.sw` files.
This is a syntax highliting extension for vint on vscode. It detects `.nr` and `.sw` files.


## How To Install

### Download From Market Place

- Simply download the Nuru Extension from VSCode Market Place
- Simply download the vint Extension from VSCode Market Place

### Windows

Expand Down
106 changes: 56 additions & 50 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package main


import (
"fmt"
"os"
Expand All @@ -11,63 +12,68 @@ import (
)

var (
Title = styles.TitleStyle.
Render(`
█░░ █░█ █▀▀ █░█ ▄▀█   █▄█ ▄▀█   █▄░█ █░█ █▀█ █░█
█▄▄ █▄█ █▄█ █▀█ █▀█   ░█░ █▀█   █░▀█ █▄█ █▀▄ █▄█`)
Version = styles.VersionStyle.Render("v0.1.0")
Author = styles.AuthorStyle.Render("by ekilie")
NewLogo = lipgloss.JoinVertical(lipgloss.Center, Title, lipgloss.JoinHorizontal(lipgloss.Center, Author, " | ", Version))
Help = styles.HelpStyle.Italic(false).Render(fmt.Sprintf(`💡 Namna ya kutumia vint:
%s: Kuanza programu ya vint
%s: Kuendesha faili la vint
%s: Kusoma nyaraka za vint
%s: Kufahamu toleo la vint
Title = styles.TitleStyle.
Render(`
██╗ ██╗██╗███╗ ██╗████████╗
██║ ██║██║████╗ ██║╚══██╔══╝
██║ ██║██║██╔██╗ ██║ ██║
╚██╗ ██╔╝██║██║╚██╗██║ ██║
╚████╔╝ ██║██║ ╚████║ ██║
╚═══╝ ╚═╝╚═╝ ╚═══╝ ╚═╝
`)
Version = styles.VersionStyle.Render("v0.1.0")
Author = styles.AuthorStyle.Render("by ekilie")
NewLogo = lipgloss.JoinVertical(lipgloss.Center, Title, lipgloss.JoinHorizontal(lipgloss.Center, Author, " | ", Version))
Help = styles.HelpStyle.Italic(false).Render(fmt.Sprintf(`💡 How to use vint:
%s: Start the vint program
%s: Run a vint file
%s: Read vint documentation
%s: Know vint version
`,
styles.HelpStyle.Bold(true).Render("vint"),
styles.HelpStyle.Bold(true).Render("vint jinaLaFile.vint"),
styles.HelpStyle.Bold(true).Render("vint --nyaraka"),
styles.HelpStyle.Bold(true).Render("vint --toleo")))
styles.HelpStyle.Bold(true).Render("vint"),
styles.HelpStyle.Bold(true).Render("vint filename.vint"),
styles.HelpStyle.Bold(true).Render("vint --docs"),
styles.HelpStyle.Bold(true).Render("vint --version")))
)

func main() {

args := os.Args
if len(args) < 2 {
args := os.Args
if len(args) < 2 {

help := styles.HelpStyle.Render("💡 Tumia exit() au toka() kuondoka")
fmt.Println(lipgloss.JoinVertical(lipgloss.Left, NewLogo, "\n", help))
repl.Start()
return
}
help := styles.HelpStyle.Render("💡 Use exit() or quit() to exit")
fmt.Println(lipgloss.JoinVertical(lipgloss.Left, NewLogo, "\n", help))
repl.Start()
return
}

if len(args) == 2 {
switch args[1] {
case "msaada", "-msaada", "--msaada", "help", "-help", "--help", "-h":
fmt.Println(Help)
case "version", "-version", "--version", "-v", "v", "--toleo", "-toleo":
fmt.Println(NewLogo)
case "-docs", "--docs", "-nyaraka", "--nyaraka":
repl.Docs()
default:
file := args[1]
if len(args) == 2 {
switch args[1] {
case "help", "-help", "--help", "-h":
fmt.Println(Help)
case "version", "-version", "--version", "-v", "v":
fmt.Println(NewLogo)
case "--docs", "-docs":
repl.Docs()
default:
file := args[1]

if strings.HasSuffix(file, ".vint") {
contents, err := os.ReadFile(file)
if err != nil {
fmt.Println(styles.ErrorStyle.Render("Error: vint Failed to read the file: ", args[1]))
os.Exit(1)
}
if strings.HasSuffix(file, ".vint") {
contents, err := os.ReadFile(file)
if err != nil {
fmt.Println(styles.ErrorStyle.Render("Error: vint Failed to read the file: ", args[1]))
os.Exit(1)
}

repl.Read(string(contents))
} else {
fmt.Println(styles.ErrorStyle.Render("'"+file+"'", "is not a correct file type use '.vint' "))
os.Exit(1)
}
}
} else {
fmt.Println(styles.ErrorStyle.Render("Error: Operation failed."))
fmt.Println(Help)
os.Exit(1)
}
repl.Read(string(contents))
} else {
fmt.Println(styles.ErrorStyle.Render("'"+file+"'", "is not a correct file type. Use '.vint'"))
os.Exit(1)
}
}
} else {
fmt.Println(styles.ErrorStyle.Render("Error: Operation failed."))
fmt.Println(Help)
os.Exit(1)
}
}
2 changes: 1 addition & 1 deletion repl/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ func (pg playground) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
// editor code
pg.editor = textarea.New()
if pg.language == "en" {
pg.editor.Placeholder = "Write Nuru code here..."
pg.editor.Placeholder = "Write vint code here..."
} else {
pg.editor.Placeholder = "Andika code yako hapa..."
}
Expand Down
36 changes: 18 additions & 18 deletions repl/docs/en/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# NURU PROGRAMMING LANGUAGE DOCUMENTATION
# vint PROGRAMMING LANGUAGE DOCUMENTATION

This documentation is intended for people with some experience in programming. It describes the syntax, types and how to perform various operations using the language.

## Table Of Contents

- [Arrays in Nuru](arrays.md#arrays-in-vint)
- [Arrays in vint](arrays.md#arrays-in-vint)
- [Creating Arrays](arrays.md#creating-arrays)
- [Accessing and Modifying Array Elements](arrays.md#accessing-and-modifying-array-elements)
- [Concatenating Arrays](arrays.md#concatenating-arrays)
Expand All @@ -14,29 +14,29 @@ This documentation is intended for people with some experience in programming. I
- [idadi()](arrays.md#idadi())
- [sukuma()](arrays.md#sukuma())
- [yamwisho()](arrays.md#yamwisho())
- [Built-in Functions in Nuru](builtins.md#built-in-functions-in-vint)
- [Built-in Functions in vint](builtins.md#built-in-functions-in-vint)
- [The andika() Function](builtins.md#the-andika()-function)
- [The jaza() Function](builtins.md#the-jaza()-function)
- [The aina() Function](builtins.md#the-aina()-function)
- [The fungua() Function](builtins.md#the-fungua()-function)
- [Comments in Nuru](comments.md#comments-in-vint)
- [Comments in vint](comments.md#comments-in-vint)
- [Single-Line Comments](comments.md#single-line-comments)
- [Multi-Line Comments](comments.md#multi-line-comments)
- [Conditional Statements in Nuru](ifStatements.md#conditional-statements-in-vint)
- [Conditional Statements in vint](ifStatements.md#conditional-statements-in-vint)
- [If Statement (Kama)](ifStatements.md#if-statement-(kama))
- [Else If and Else Blocks (Au Kama and Sivyo)](ifStatements.md#else-if-and-else-blocks-(au-kama-and-sivyo))
- [Dictionaries in Nuru](dictionaries.md#dictionaries-in-vint)
- [Dictionaries in vint](dictionaries.md#dictionaries-in-vint)
- [Creating Dictionaries](dictionaries.md#creating-dictionaries)
- [Accessing Elements](dictionaries.md#accessing-elements)
- [Updating Elements](dictionaries.md#updating-elements)
- [Adding New Elements](dictionaries.md#adding-new-elements)
- [Concatenating Dictionaries](dictionaries.md#concatenating-dictionaries)
- [Checking If a Key Exists in a Dictionary](dictionaries.md#checking-if-a-key-exists-in-a-dictionary)
- [Looping Over a Dictionary](dictionaries.md#looping-over-a-dictionary)
- [Files in Nuru](files.md#files-in-vint)
- [Files in vint](files.md#files-in-vint)
- [Opening a File](files.md#opening-a-file)
- [Reading a File](files.md#reading-a-file)
- [For Loops in Nuru](for.md#for-loops-in-vint)
- [For Loops in vint](for.md#for-loops-in-vint)
- [Basic Syntax](for.md#basic-syntax)
- [Iterating Over Key-Value Pairs](for.md#iterating-over-key-value-pairs)
- [Dictionaries](for.md#dictionaries)
Expand All @@ -45,27 +45,27 @@ This documentation is intended for people with some experience in programming. I
- [Break (Vunja) and Continue (Endelea)](for.md#break-(vunja)-and-continue-(endelea))
- [Break (Vunja)](for.md#break-(vunja))
- [Continue (Endelea)](for.md#continue-(endelea))
- [Functions in Nuru](function.md#functions-in-vint)
- [Functions in vint](function.md#functions-in-vint)
- [Basic Syntax](function.md#basic-syntax)
- [Parameters](function.md#parameters)
- [Default Parameters](function.md#default-parameters)
- [Return (rudisha)](function.md#return-(rudisha))
- [Recursion](function.md#recursion)
- [Closures](function.md#closures)
- [HTTP with Nuru](net.md#http-with-vint)
- [HTTP with vint](net.md#http-with-vint)
- [Importing](net.md#importing)
- [Methods](net.md#methods)
- [peruzi()](net.md#peruzi())
- [tuma()](net.md#tuma())
- [Identifiers in Nuru](identifiers.md#identifiers-in-vint)
- [Identifiers in vint](identifiers.md#identifiers-in-vint)
- [Syntax Rules](identifiers.md#syntax-rules)
- [Best Practices](identifiers.md#best-practices)
- [INTEGERS (NAMBA) AND FLOATS (DESIMALI)](numbers.md#integers-(namba)-and-floats-(desimali))
- [PRECEDENCE](numbers.md#precedence)
- [UNARY INCREMENTS](numbers.md#unary-increments)
- [SHORTHAND ASSIGNMENT](numbers.md#shorthand-assignment)
- [NEGATIVE NUMBERS](numbers.md#negative-numbers)
- [JSON in Nuru](json.md#json-in-vint)
- [JSON in vint](json.md#json-in-vint)
- [Import JSONI](json.md#import-jsoni)
- [Decoding JSON with dikodi()](json.md#decoding-json-with-dikodi())
- [Encoding JSON with enkodi()](json.md#encoding-json-with-enkodi())
Expand All @@ -76,10 +76,10 @@ This documentation is intended for people with some experience in programming. I
- [KEYWORDS](keywords.md#keywords)
- [Reserved Keywords](keywords.md#reserved-keywords)
- [BuiltIns](keywords.md#builtins)
- [Null (Tupu) in Nuru](null.md#null-(tupu)-in-vint)
- [Null (Tupu) in vint](null.md#null-(tupu)-in-vint)
- [Definition](null.md#definition)
- [Evaluation](null.md#evaluation)
- [NURU PROGRAMMING LANGUAGE DOCUMENTATION](README.md#vint-programming-language-documentation)
- [vint PROGRAMMING LANGUAGE DOCUMENTATION](README.md#vint-programming-language-documentation)
- [Table Of Contents](README.md#table-of-contents)
- [OPERATORS](operators.md#operators)
- [ASSIGNMENT](operators.md#assignment)
Expand All @@ -88,7 +88,7 @@ This documentation is intended for people with some experience in programming. I
- [MEMBER OPERATOR](operators.md#member-operator)
- [LOGIC OPERATORS](operators.md#logic-operators)
- [PRECEDENCE OF OPERATORS](operators.md#precedence-of-operators)
- [Strings in Nuru](strings.md#strings-in-vint)
- [Strings in vint](strings.md#strings-in-vint)
- [Basic Syntax](strings.md#basic-syntax)
- [Concatenating Strings](strings.md#concatenating-strings)
- [Looping over a String](strings.md#looping-over-a-string)
Expand All @@ -98,11 +98,11 @@ This documentation is intended for people with some experience in programming. I
- [herufikubwa()](strings.md#herufikubwa())
- [herufindogo](strings.md#herufindogo)
- [gawa](strings.md#gawa)
- [Switch Statements in Nuru](switch.md#switch-statements-in-vint)
- [Switch Statements in vint](switch.md#switch-statements-in-vint)
- [Basic Syntax](switch.md#basic-syntax)
- [Multiple Values in a Case](switch.md#multiple-values-in-a-case)
- [Default Case (kawaida)](switch.md#default-case-(kawaida))
- [Time in Nuru](time.md#time-in-vint)
- [Time in vint](time.md#time-in-vint)
- [Importing Time](time.md#importing-time)
- [Time Methods](time.md#time-methods)
- [hasahivi()](time.md#hasahivi())
Expand All @@ -114,7 +114,7 @@ This documentation is intended for people with some experience in programming. I
- [Break (vunja) and Continue (endelea)](while.md#break-(vunja)-and-continue-(endelea))
- [Break (Vunja)](while.md#break-(vunja))
- [Continue (Endelea)](while.md#continue-(endelea))
- [Working with Booleans in Nuru](bool.md#working-with-booleans-in-vint)
- [Working with Booleans in vint](bool.md#working-with-booleans-in-vint)
- [Evaluating Boolean Expressions](bool.md#evaluating-boolean-expressions)
- [Evaluating Simple Expressions](bool.md#evaluating-simple-expressions)
- [Evaluating Complex Expressions](bool.md#evaluating-complex-expressions)
Expand Down
Loading

0 comments on commit 3fedf3d

Please sign in to comment.