- Notifications
You must be signed in to change notification settings - Fork0
A simple scripting language
License
Jomy10/nootlang
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A simple scripting language, created specifically forNootBot.
// helloWorld.nootnoot!("Hello World")
Nootlang is a simple scripting language mainly developed forNootBot.The interpreter and parser are intentionally kept simple and readable as it is alsodeveloped as a learning project. Anyone interested in making programming languages orparsers and interpreters in general should be able to understand the code rather easily.The interpreter is therefore focussed on readability rather than speed.
- Types
- integers
- strings
- floats
- booleans
- functions
- anonymous functions
def myFunc() {}def myOtherFunc(fn) { fn() }myOtherFunc(myFunc)myOtherFunc(|| {})
- structs
- interfaces
- tuples
- type assertion
- Functions
- functions
- scopes
- modules
- Statements
- if/elsif/else
- match
Native functions (like the ones in thestandard library), are of thefollowing signature:
func(*runtime.Runtime,args []interface{}) (interface{},error)
The first argument passed to any function is always the runtime, this containsall 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 notreturn a value
If a runtime error occurs during execution, the function should return adescriptive error as its second argument
Contributions are always welcome.
- Additions (e.g. new syntax, etc.) to the language should be discussed first inan issue befoe submitting a pull request
- Speed improvements to the interpreter, parser or tokenizer will be accepted aslong as they do not compromise on readability. The focus of this project lies inreadability 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 interpreterso that they are separated. Here, readability can be compromised for speed (JITcompilation, caching, etc.)
- Documentation is highly needed at the moment
Nootlang is licensed under theMIT license.
About
A simple scripting language