EngFook/PythCparser
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
#------------------------------------------------------------------------------- # Name: PythCparser # Purpose: To parse and interpret C language by using Python. # # Author: Tunku Abdul Rahman University College # Microelectronics and Physics Division 2014 # Goh Eng Fook # Lim Bing Ran # # Supervise by: Dr. Poh Tze Ven # # Created: 07/03/2013 # Copyright: (c) 2013-2014, Goh Eng Fook & Lim Bing Ran # License: GPLv3 #------------------------------------------------------------------------------- PythCparser is used to parse C language program into Abstract Syntax Tree (AST) and implement an interpreter to execute the program statements on the AST by programmed in Python. C language expressions were tokenized by using Pratt Parser which is Top Down Operator Precedence algorithm to build the AST. AST of C language keywords were designed according to their behavior. Once the AST formed, the program statements were able to interpret. PythCparser has ability: 1) To parse any Expression included function definition, declaration and call: expression = 2 + 3 * 4 ; value = 2 * 3 + value / 3 % 7 << 1 ; function ( a , b ) ; -- value + - 1 ; 2) To parse keywords: if else while do while for loop switch case #define struct enum typedef size of primitive types : e.g. int , double & float
About
Cparser
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published