Skip to content

KristonCosta/c-monkey

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Codacy Badge Build Status codecov

Based on Writing an Interpreter in Go

Install Conan

pip install conan

Build instructions

mkdir build 
cd build 
conan install ..
conan build ..
./bin/main

Test instructions

Run either command in build directory:

ctest 

or

./bin/CMonkeyTests

Importing scripts

Set 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.

Examples

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
>> 

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors