Skip to content

enginmanap/Pas2C

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pas2C pascal to C Source Code Converter

Build dependencies:

Bison, Yacc and gcc. astyle if you want to use the converter script.

How to Build:

Pas2C uses cmake. you can build the project with these steps:

    1. enter the project directory.
    2. mkdir build
    3. cd build
    4. cmake ../
    5. make
    
How To Use:

Use the converter as this:

sh converter.sh input_file output_file

if no output file given, it creates a file named output.c.

if you want to use stdin/stdout, you can call pas2c directly.


Current Features:

Converting program %program_name%; to int main()
Converting var and const blocks.
Converting any valid sequence of begin end block to proper {}
Converting statements, regardless of the position relative to blocks.
	except the main block. every statement has to be in it.
Converting integer value and variable operations:
	+,-,*,/ operations can be converted recursively.
Converting integer declarations.
Converting integer assignments:
Converting functions:
	currently write/ln and read/ln implemented.
	unlimited parameters can be passed, also mathematical expressions can be used as parameters.
Converting of strings:
        strings starting with single quotation marks and ends with it can be converted. 
        escaping not implemented. 

About

No description, website, or topics provided.

Resources

Stars

5 stars

Watchers

2 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors