Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C++ (http://www.velocityreviews.com/forums/f39-c.html)
-   -   compiler front-end (http://www.velocityreviews.com/forums/t644852-compiler-front-end.html)

vaib 11-17-2008 08:03 AM

compiler front-end
 
hi all ,

I am willing to write a compiler front-end for my semester
project . I am studying compilers in my present semester and I am
following the Dragon Book for the theory and Allen I. Holub's Compiler
Design in C for the _actual stuff_ .
.. Although I must admit that as of now I am not able to make out
much out of Holub's book since I am not through with the theory yet
but I have come to understand that it would be much easier to go
through it once I complete the theory . As of now I am almost done
with the front-end theory and so I want to design a compiler front-end
( lexer and parser ) .
Now there are certain issues that i am facing . First of all,
I need to have a grammar so that I would know what all terminals
( tokens ) I have to use . This would be required for the design of
the lexer . Having the grammar would also solve many issues regarding
the parser too .
Can anyone suggest me a simple context-free grammar ? I'd
highly appreciate it . I would also stick to this thread for any other
issues that I face while designing the front-end .
Thanking in anticipation . Vaib .

Jerry Coffin 11-19-2008 04:45 PM

Re: compiler front-end
 
In article <e35d57b1-6e9f-4ec7-9529-
b3212c68bb0d@c2g2000pra.googlegroups.com>, vaibhavpanghal@gmail.com
says...
> hi all ,
>
> I am willing to write a compiler front-end for my semester
> project . I am studying compilers in my present semester and I am
> following the Dragon Book for the theory and Allen I. Holub's Compiler
> Design in C for the _actual stuff_ .
> . Although I must admit that as of now I am not able to make out
> much out of Holub's book since I am not through with the theory yet
> but I have come to understand that it would be much easier to go
> through it once I complete the theory . As of now I am almost done
> with the front-end theory and so I want to design a compiler front-end
> ( lexer and parser ) .
> Now there are certain issues that i am facing . First of all,
> I need to have a grammar so that I would know what all terminals
> ( tokens ) I have to use . This would be required for the design of
> the lexer . Having the grammar would also solve many issues regarding
> the parser too .
> Can anyone suggest me a simple context-free grammar ? I'd
> highly appreciate it . I would also stick to this thread for any other
> issues that I face while designing the front-end .


The usual is to design a grammar for a small language of your own.
Usually for a start, you can basically just have the usual computations
(addition, subtraction, multiplication and division) and assignments to
variables, along with the ability to print out results (or possibly just
print out the result from every computation).

--
Later,
Jerry.

The universe is a figment of its own imagination.


All times are GMT. The time now is 09:57 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.