Phoebe is an experimental programming language built with Haskell. A dynamically typed language with a simple syntax based on the specification by Michael J.C. Gordon’s book The Denotational Description of Programming Languages
- [X] Control Structures (if-then-else, whiledo)
- [X] Blocks with multi-expressions
- [X] Functions (Call by ref/value)
- [X] Dynamic/Static binding
- [X] Escapes and Jumps
- [X] Data structures
- [X] Iteration constructs
- [X] Interprets a File
- [X] Regression tests
program
begin
proc print(str) -> output str;
print("Hello Pheobe")
end
Output: Result: [Str "Hello Pheobe"]
program
begin
fun add(x, y) -> x + y;
var result = add!(5, 3);
output result
end
Output: Result: [Numeric 8]
program
begin
var x = 10;
if x > 5 then
output x
else
output 0
end
Output: Result: [Numeric 10]
program
begin
array arr[0:5];
arr[0] := 1;
arr[1] := 2;
output arr
end
Output: Result: [Str "{0: Numeric 1, 1: Numeric 2, 2: Error \"Unassigned\", 3: Error \"Unassigned\", 4: Error \"Unassigned\", 5: Error \"Unassigned\"}"]
program
begin
record cats(loki, phoebe);
cats.loki := 5;
cats.phoebe := 3;
output cats
end
Output: Result: [Str "{loki: Numeric 5, phoebe: Numeric 3}"]
Run the interpreter in GHCi.
make interpreter
Example:
Run the following command to build the project. The executable will be available in the `dist` directory.
make build
Run tests
make test