A semi-serious dynamically-typed interpreted programming language. Made mostly for learning experience.
Check out the wiki for information about the language
- C++17
- g++ and Make
- The
Flex
scanner is used, alongside theBison
parser generator.
- Functional. Check out the examples page for working examples.
- All common programming language features are implemented:
- Variables and scopes
string
,number
,bool
,null
,array ([])
,object ({})
andfunction (() => {})
literals.- If statements and ternery
for
andwhile
loops, combined in a single keyword (loop
)- All types have properties.
- Detailed and useful error messages
- An actual call stack
Get a number in the fibonacci sequence in mafiascript:
const fibonacci = (n) => {
if (!n) return 0;
const arr = [0, 1];
loop (let i=2, i <= n, i += 1) {
arr[i] = arr[i - 1] + arr[i - 2];
};
return arr[n];
};
fibonacci(10); // 55
Requirements:
- gcc or any other
C++
compiler that supports C++17. Flex
andBison
installed and included in path.
Setup:
- Clone this repository
- In the root directory of this repo, run
make
. You may have to edit themake
file accordingly if you are using a different compiler. - Run
./dist
- You can edit
script.ms
to run something different.