https://github.com/jomy10/nootlang
A simple scripting language
https://github.com/jomy10/nootlang
language programming-language scripting-language
Last synced: 8 months ago
JSON representation
A simple scripting language
- Host: GitHub
- URL: https://github.com/jomy10/nootlang
- Owner: Jomy10
- License: mit
- Created: 2022-05-20T08:41:40.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-01-01T15:17:25.000Z (about 3 years ago)
- Last Synced: 2025-06-07T17:51:15.066Z (8 months ago)
- Topics: language, programming-language, scripting-language
- Language: Go
- Homepage:
- Size: 178 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Noot lang
A simple scripting language, created specifically for [NootBot](https://github.com/unitoftime/nootbot).
## Hello World
```noot
// helloWorld.noot
noot!("Hello World")
```
## Description
Nootlang is a simple scripting language mainly developed for [NootBot](https://github.com/unitoftime/nootbot).
The interpreter and parser are intentionally kept simple and readable as it is also
developed as a learning project. Anyone interested in making programming languages or
parsers and interpreters in general should be able to understand the code rather easily.
The interpreter is therefore focussed on readability rather than speed.
## Roadmap
- **Types**
- [x] integers
- [x] **strings**
- [x] **floats**
- [x] **booleans**
- [x] functions
- [ ] anonymous functions
```noot
def myFunc() {}
def myOtherFunc(fn) { fn() }
myOtherFunc(myFunc)
myOtherFunc(|| {})
```
- [ ] structs
- [ ] interfaces
- [ ] tuples
- [ ] type assertion
- **Functions**
- [x] functions
- [x] **scopes**
- [ ] modules
- **Statements**
- [x] **if/elsif/else**
- [ ] **match**
## Native Function Interface
Native functions (like the ones in the [standard library](/stdlib)), are of the
following signature:
```go
func(*runtime.Runtime, args []interface{}) (interface{}, error)
```
- The first argument passed to any function is always the runtime, this contains
all the variables and functions available.
- The second is an array of all the arguments passed to this function
- The function can return a value as its first return type, or nil if it does not
return a value
- If a runtime error occurs during execution, the function should return a
descriptive error as its second argument
## Contributing
Contributions are always welcome.
- Additions (e.g. new syntax, etc.) to the language should be discussed first in
an issue befoe submitting a pull request
- Speed improvements to the interpreter, parser or tokenizer will be accepted as
long as they do not compromise on readability. The focus of this project lies in
readability for newcomers.
- However, if you are passionate about making a fast interpreter for nootlang,
this is encouraged. Just make a new folder in this project for the faster interpreter
so that they are separated. Here, readability can be compromised for speed (JIT
compilation, caching, etc.)
- Documentation is highly needed at the moment
## License
Nootlang is licensed under the [MIT license](LICENSE).