Skip to content

jiriklepl/Bachelor-Thesis

Repository files navigation

CHM Compiler

This program compiles programs written in the CHM language. For the proposal of the language, see the bachelor thesis repository Bachelor-Thesis-Text.

The purpose of this compiler is to demonstrate the possibility of implementing an alternative to the C language which uses a variant of the Hindley-Milner type system. This language aims to preserve the core nature of the C language: explicit memory management, high level of code transparency, and giving the user control over almost all computations the program performs (= minimal runtime overhead).

Dependencies

  • cabal-install (version at least 3.2)
  • ghc (version at least 8.10)
  • make (optional for make command, version at least 4.3)

Building

The program contains a Makefile configured to build the program independently on the platform.

It is run by the common command:

make build

Alternatively, it could be built by using the cabal directly:

cabal new-build all

Usage

The easiest way to run the compiler is to use the run.sh script (may require chmod):

./run.sh <arguments>

Or it can be run by using cabal:

cabal new-run CHM-main <arguments>

For more information on the possible options and syntax run with an argument --help:

./run.sh --help

Testing

There are several test files provided by this package:

test-bad-access.chm
test-good-access.chm
test-list-alloc-print.chm
test-vector.chm

Each of the test files begins with a comment explaining the purpose of the test and the expected behavior of compilation or runtime. Running Valgrind on any of the successfully compiled programs should not find any memory leaks or any bad reads/writes.

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages