OCanada is a general-purpose programming language with syntax inspired by Canadian slang, eh?
With functions and keywords named after hosers
, canucks
and mounties
, OCanada provides the most authentic Canadian programming experience, eh?
It functions similarly to Lisp or Ruby, so if you know those languages you should be able to learn OCanada pretty easily, eh?
Here's some examples of OCanada code, eh?
Hello, World:
o_canada main []
apologize "Hello, World!"
eh?
please main []
Recursive Factorial:
o_canada factorial [value]
oot mountie[value 1]
1
aboot canuck
(value * please factorial [(value - 1)])
eh?
eh?
o_canada main []
apologize please factorial [10]
eh?
please main []
Fibonacci Sequence:
o_canada fibonacci [times]
syrup {numbers} [0 1]
syrup {temp} 0
syrup {i} 0
play_hockey not mountie[{i} times]
apologize loonie 0 {numbers}
apologize puck 10
syrup {temp} loonie 0 {numbers}
syrup {numbers} tuque {numbers} loonie 0 {numbers}
poutine {numbers}
syrup loonie 0 {numbers} (loonie 0 {numbers} + {temp})
syrup {i} ({i}+1)
eh?
eh?
o_canada main []
please fibonacci [99]
eh?
please main []
- Arbitrary precision integers and floats
- A built-in function for saving your programs as executables
- A standard library filled with useful utility functions
- Dynamic typing
- Eval function for metaprogramming shenanigans
- Local and global variables
- The ability to define custom structures
How to set up OCanada:
- Clone the OCanada repo to your local machine.
- Compile OCanada by running
build.lisp
in SBCL. - Keep the executable in the same directory as the
lib
andprograms
directories. - Type
./ocanada.exe programs/filename.canada
in your terminal to run a program.
Now that you have OCanada set up, refer to the Language Specification to learn how to write programs!