# Pipple Pipple is a simple Lisp-family programming language. ## Getting started Pipple builds with CMake. Run the following to build Pipple: ```shell cmake -B build -DCMAKE_BUILD_TYPE=Release cmake --build build ``` The `pipple` executable will be placed in the build folder. ## Coding with Pipple Pipple's interpreter provides a REPL for fast prototyping. Try it out by running the `pipple` command without any arguments. ``` $ ./build/pipple pipple> ``` Pipple code you write will be run now. Try something like `(print "Hello, World!")`. See what happens! If you'd like to use Pipple with a file, just add the filename after the executable path, like `pipple path/to/code.ppl` Pipple also has an experimental transpiler, which will turn your Pipple code into C++. To use, run `pipple -c path/to/code.ppl`. This will print code to the console. To quickly compile Pipple code, try `pipple -c path/to/code.ppl | g++ -xc++ - -o exename`, where `exename` is the name of the executable to output to. ## Syntax Pipple's syntax looks like most other Lisps. You enclose your statements in `(` and `)`. ### Printing ``` (print "Hello, World!") (print 32) (print 3.141) ``` ### Setting and Changing Variables `let` initializes a variable for the first time. `set` changes that variable to something else. Note: `set` is currently unsupported by the Pipple transpiler. ``` (let x 3.141) (print x) (set x 2.712) (print x) ``` ### Math Remember: Polish notation is the key! Note: All math is currently unsupported by the Pipple transpiler. ``` (let x (+ 3 4)) (print x) (let y (* 5 6 2)) (print y) (print (/ 10 2)) (print (- 10 5)) ``` ### Conditionals In Pipple, `nil` is the only non-truthy value. Every non-`nil` value is truthy. Note: All conditionals are currently unsupported by the Pipple transpiler. ``` (let x 0) (if (== x 0) (print "x is zero") (set x 1) (print "now it is" x) ) (while (!= x 5) (print "x is currently" x "which is not 5. i must make it 5") (set x (+ x 1)) ) (print "now x is" x) ``` ### User console input Note: `input` is currently unsupported by the Pipple transpiler. ``` (let x (input)) (print "You said" x) ``` ### Lists Note: Lists are currently unsupported by the Pipple transpiler. ``` (list item1 item2 item3) (list "hi there" 32 nil) ``` ### Functions Pipple functions require type annotations. They are also first class. Functions are defined with the following syntax: `(function returntype [argtype argname argtype argname] (code) (morecode))` ``` (let x (function int [int x] (return (* x 5)) )) (print (x 3)) ``` Valid types in Pipple are: * int * double * string * list (Currently unsupported by the Pipple transpiler)