Skip to content

Experimental Programming Language Built with Haskell

License

Notifications You must be signed in to change notification settings

mrprofessor/phoebe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

phoebe

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

Features

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

Examples

Basic Program Structure

program
begin
  proc print(str) -> output str;
  print("Hello Pheobe")
end

Output: Result: [Str "Hello Pheobe"]

Functions and Procedures

program
begin
  fun add(x, y) -> x + y;
  var result = add!(5, 3);
  output result
end

Output: Result: [Numeric 8]

Control Structures

program
begin
  var x = 10;
  if x > 5 then
    output x
  else
    output 0
end

Output: Result: [Numeric 10]

Arrays

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\"}"]

Records

program
begin
   record cats(loki, phoebe);
   cats.loki := 5;
   cats.phoebe := 3;
   output cats
end

Output: Result: [Str "{loki: Numeric 5, phoebe: Numeric 3}"]

Development

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

About

Experimental Programming Language Built with Haskell

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published