Skip to content

Zararest/2_5_ParaCL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ParaCL language interpreter

Description

This repository implements the C like language interpreter. The language consists of basic operations that make it Turing complete. Only int type variables are supported. Example of code:

n = ?;         //console input

if (n <= 0){

    print 0;
}

while (n > 0){

    print n;
    n = n - 1;
}

Implemented check of syntax and variables definitions:

error_var = 3
var = 1;
error = 1 + - 2;

if (undef_var > 0){

    print 3;
}

Result:

syntax error, unexpected variable, expecting ; [2, 1]
var = 1;
^
syntax error, unexpected -, expecting ( or ? or number or variable [3, 13]
error = 1 + - 2;
~~~~~~~~~~~~^
identifier "undef_var" is undefined [5]

Implementation

For lexical analysis, Bison and Flex code generators are used. Files to generate are in ./bin.

To work with the abstract syntax tree, a request system is used. Description of this system located in ./src/frontend/headers.

Build

Before building the program:

mkdir build 
cd ./build
cmake .

There are two build targets in the project:

make ParaCL
make Tests
  1. ParaCL - build a program to work with ParaCL code
  2. Tests - buuld tests for interpreter

The command line arguments contain a file with the source text of the ParaCL language program.

About

C like language interpreter

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published