Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/njbrown/loris
toy language used for making games, currently in development
https://github.com/njbrown/loris
bytecode c-plus-plus compiler interpreter language parser programming-language scripting-language virtual-machine
Last synced: 26 days ago
JSON representation
toy language used for making games, currently in development
- Host: GitHub
- URL: https://github.com/njbrown/loris
- Owner: njbrown
- License: mit
- Created: 2014-11-12T19:45:13.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2018-09-25T01:19:15.000Z (about 6 years ago)
- Last Synced: 2023-02-26T22:22:34.339Z (over 1 year ago)
- Topics: bytecode, c-plus-plus, compiler, interpreter, language, parser, programming-language, scripting-language, virtual-machine
- Language: C++
- Homepage:
- Size: 1.19 MB
- Stars: 12
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Loris
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat-square)](https://github.com/njbrown/loris/issues)
[![License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](https://github.com/njbrown/loris/blob/master/LICENSE)
[![HitCount](http://hits.dwyl.io/njbrown/loris.svg)](https://hits.dwyl.io/njbrown/loris)Easy scripting in C++.
## Features
* Simple and familiar syntax
* Object Oriented
* Auto-binding of c++ functions to Loris
* Mark and Sweep Garbage Collection
* Easy to embed in c++ applications
* Easy to extend## Future Features
* Pre-compilation## Example Usage
#include "loris/loris.hpp"
double multiply(double a, double b)
{
return a * b;
}int main()
{
loris::Loris loris;
loris.AddSource(R"(
def hello()
{
return multiply(5, 10);
}
)");loris.AddFunction("multiply", loris::Def(multiply));
loris.Compile();double result = loris.ExecuteFunction("hello");
}## Example Script
//class named Hello
class Hello
{
//constructor
Hello()
{
print("this is a constructor");
}
//member function
def Greet()
{
//call print function
print("hello world!");
}
}def main()
{
var hello = new Hello();
hello.Greet();
}## Syntax
https://github.com/njbrown/dragonscript/blob/master/SYNTAX.md
## Known Issues
* `or` and `and` statements are parsed but the bytecode isn't generated and will cause errors if used
* garbage collection sometimes causes random crashes