This is an interpreter of the language Ccure. Language with intention to be used in critical systems, with a focus on security and reliability. The language is based on the C language, but with some restrictions and additions. The interpreter is written in Haskell and uses the Alex library to generate the lexer.
In the ccure
directory, you will find a folder called problemas
, where there are some examples of programs written in Ccure. The ccure
directory contains the source code of the interpreter.
The ccure
directory contains the following files:
-
ccure.hs
: The main file of the interpreter. It contains the main function and the functions that interpret the program. -
Lexer.x
: The file that defines the lexer of the interpreter. It is used by the Alex library to generate the lexer. -
State.hs
: File that contains the data types that represent the state of the interpreter. Also the functions that manipulate the state. -
Compatibles.hs
: Files that contain the helper functions that check if two types are compatible. -
ErrorMessages.hs
: File that contains the error messages that can be generated by the interpreter. -
MatrixUtils.hs
: File that contains the functions that manipulate matrices. -
RegisterUtils.hs
: File that contains the functions that manipulate registers. -
SubprogramUtils.hs
: File that contains the functions that manipulate subprograms. -
Tokens.hs
: File that contains the functions that maniuplate tokens. -
Utils.hs
: File that contains the functions that are used by multiple files.
In the ccure
directory, do
./ccure.sh path_to_file.ccr
Where the path_to_file.ccr
should be substituted by the path to the file you want to interpret.
Alternatively, you can use Alex and GHC to compile the interpreter. To do so, in the ccure
directory do
alex Lexer.x
ghc ccure.hs
./ccure path_to_file.ccr
Where the path_to_file.ccr
should be substituted by the path to the file you want to interpret.
It is also possible to run all the tests in the problemas
directory by running the run_all.sh
script in the ccure
directory.