Skip to content

Educational imperative statically typed programming language.

License

Notifications You must be signed in to change notification settings

monadplus/CPP-lang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CPP lang

Project

CPP lang is a static type-checked general purpose programming language and my very first programming language.

The language is similar to C but missing lots of important features such as:

  • Arrays and pointers
  • Structs and unions
  • Syscalls and bindings with lib.c
  • Native execution on x86 architectures

The grammar of the language can be found at CPP.cf.

Structure

Compile

The compiler is written in Haskell. You can build the compiler using both Cabal:

$ cabal build

or Stack:

$ stack build

Run the interpreter

Have a look at the files from examples. All of them can be executed on the interpreter.

$ cabal run CPP -- <name>.cc --interpreter

Run on the JVM

First, generate the *.jar:

$ cabal run CPP -- <name>.cc --jvm

Then, run the *.jar:

$ java -jar <name>.jar

TODO

  • Arrays
  • Pointers
  • Add char as primitive type
  • =Value= should depend on =TExp=
  • The JVM backend is not properly tested