A mid-ware to help standard C compiler support nested-function definition

Welcome to Pallyc.org

Description:

Pallyc is a simplified C compiler that supports nested-function definition.
This is an open-source project. Under the agreement of the license, any one can download the binary executive file as well as its source code.
The whole project is written in pure C++ code with the support of STL, which makes Pallyc compiling and running compatible on almost every platform, particularly Windows and Linux.

Goal:

Currently, those prevailing C compilers, such as GNU gcc, MS cl, etc, have no nested-function definition support.
Sometimes, programmer would find that nested-function definition(as in Pascal) can be very useful in making the code concise and hierarchical.
The ultimate goal of this Pallyc Project is to help those compilers become compatible with nested-function definition, by generalizing recognizable assembly code for each of those C compilers as input, respectively.
At that time, the role of Pallyc can be thought of as a mid-ware which builds a bridge between those popular, well-developed compilers and the concise, convenient, nested, hierarchical coding style.

Latest Features:

Now Pallyc source code could be compiled online. Use the this form or go to this URL have new experience of nested function style!



  

Here is the top-level organization for Pallyc: It takes 3 input files: the source code input, key words table input and grammar specification input. And there are 5 distinctive stages:

  • In initiating stage, Pallyc calculates and constructs SLR(1) parsing table;
  • In lexer stage, source code input is converted into a token file, in which symbols are represented by tokens(integers), according to the key word table input;
  • In parsing stage, token file from lexer stage is parsed and semantic action sequence is generated;
  • In semantic process stage, a semantic handler process each semantic action in term of the sequence that parsing stage generates.
  • Finally, intermediate code of 4-element expression is output and converted to assembly code (assembly conversion is in progress).

See the following figure.

Here is the C language feature coverage status:

arraysupported
multidemensional arraysupported
functionsupported
nested-functionsupported
arithmetic operationsupported
boolean expressionsupported
if...else...supported
whilesupported
break/continuesupported
stringnot supported
negative integernot supported
structnot supported
float typenot supported
pointer typenot supported
bit operationnot supported

Compile Error Specification
Error IDError DescriptionError Type
0001parsing table record nullsyntax error
0002undefined keywordlexeme error
2040identifier redefinitionsemantic error
2043illegal breaksemantic error
2044illegal continuesemantic error
2064illegal function callsemantic error
2065undeclared identifiersemantic error
2065illegal array referencesemantic error
2118negative subscript for arraysemantic error
2440type conversion errorsemantic error
2440array reference doesn’t match array definitionsemantic error
2441illegal reference to arraysemantic error
2466cannot allocate an array of constant size 0semantic error
2660function argument number doesn’t matchsemantic error

Conundrum for Pallyc:

"p" stands for PASCAL's nested function definition, while "c" for C's grammar base frame; the word "ally" represents the combination of those features. And luckily the last 3 letters “lyc᾿happen to be the abbreviation of my name.

Contact the author:

If you have any questions about Pallyc or just interested in compiler implementation, please feel free to send me information. Email:



Copyright ©2006 Yangchun Luo
Last modified: January 02 2008