Phiras\’s Blog

January 10, 07

MiniJava ( javacc Implementation )

Filed under: Uncategorized — phiras @ 6:42 pm

Mini Java is a subset of Java. The meaning of a MiniJava program is given by its meaning as a Java program, Overloading is not allowed in MiniJava. The MiniJava statement System.out.println( … ); can only print integers. The MiniJava expression e.length only applies to expressions of type int [].

So we have to build a compiler witch can understand MiniJava programs.

Compiler building have to be divided into sequential steps :

o Lexical Analysis.

o Parsing.

o Building abstract syntax tree (AST).

o Symantec Analysis.

o Code generation.

In this time we are going to do first three steps, and off course we are going to use some tools to help us in our work ( Javacc, Jjtree ) .

The first one “Javacc” or “Java compiler compiler “, Helps me to build my parser easily.

“Javacc” is LL(k) parser.

The second one “Jjtree” Helps me to build my abstract syntax tree (AST)

MiniJava ( javacc Implementation report )

5 Comments »

  1. Nice piece of work!

    Comment by abraham — February 16, 07 @ 8:59 pm

  2. Have you used sablecc for parser generation.

    Comment by Javed — March 11, 08 @ 6:43 am

  3. hi man i am in computer science egypt cairo university and from egypt this is great work ;

    Comment by HZ — May 4, 08 @ 5:19 pm

  4. tr

    Comment by r — September 13, 08 @ 8:28 pm

  5. can u please send me the code ??

    Comment by marouane — March 3, 09 @ 11:10 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: