Skip to content

MohmedH/C-Compiler-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C-Compiler-

C program Compiler written in F#

  1. Is the input program a valid simple C program? True or false

  2. If the program is not valid, a syntax error message of the form “expecting X, but found Y”.

  3. If the program is valid, an equivalent simple ASM program. Note that “simple C” is really very simple C --- no pointers, no arrays, no types other than integer, no loops, very simple expressions, etc. Here’s an example simple C program

What A simple C program can look like:

Screen Shot 2019-05-15 at 7 58 21 AM

What the output of this F# program will be in case of #3 above: Screen Shot 2019-05-15 at 7 58 27 AM

Getting this output first we take the Simple C like above, and create the BNF Definition shown below: Screen Shot 2019-05-15 at 7 58 38 AM

Then we write a function for each rule or "Recursive descent parsing" which is done in F# in this case. Finally giving us the proper ASM program which was shown above as well.

About

C program Compiler written in F#

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published