Based on Writing an Interpreter in Go
pip install conan
mkdir build
cd build
conan install ..
conan build ..
./bin/mainRun either command in build directory:
ctest or
./bin/CMonkeyTestsSet the CMONKEY_INSTALL_DIR path to point to the lib folder in this project root.
Save script to the lib folder of this dir.
You can import any script by using @SCRIPT_NAME in the interpreter. Refer to examples below.
Set the CMONKEY_INSTALL_DIR path to point to the lib folder in this project root.
Build the project
Guesser game:
./bin/main
>> @guesser
Loading /Users/kristoncosta/workspace/projects/c-monkey/lib/guesser
>> guess(100)
Guessed 50 but it was too low.
Guessed 75 but it was too low.
Guessed 88 but it was too low.
Guessed 94 but it was too low.
Guessed 97 but it was too low.
Guessed 99 but it was too low.
Got the correct answer! 100
null
Basic lib game:
./bin/main
>> @prelude
Loading /Users/kristoncosta/workspace/projects/c-monkey/lib/prelude
>> map([1, 2, 3], fn(x) {x * 2})
[2, 4, 6]
>> reduce([1,2,3], 0, fn(x, y) { x + y})
6
>>