How to build and run the Openjdk Compiler Grammar workspace

The Compiler Grammar workspace is a branch from the main Openjdk workspace. It integrates an Antlr parser which builds the same AST trees as javac does.  

To build the workspace, you need the following prerequisites:

Antlr

    Antlr-3.1.1+ is needed. At the time this document is written, 3.1.1 is the latest version.
    Click this link to download the file directly. Or go to the Antlr website to get the latest version. You need the “Complete ANTLR 3.1.1 jar”, which contains the runtime, and the ANTLR tools.


Ant
    You must have Ant installed and properly set up so you can execute the command “ant” under command line.
    Go to the Ant website to download.

Mercurial
(optional)
    Mercurial is needed to get the latest source code. Or you can download the source archive from here.
    You can download Mercurial from here.
    Refer to this page for how to install and setup Mercurial.

Once you have everything installed and downloaded, you can start to build the workspace by following the steps listed bellow. It assumes that you are working on a linux or similar OS, although windows users should be able to build the workspace same way.

1) Create a work directory, for example "/workspace".

2) Place the downloaded antlr-3.1.1.jar under a “lib” directory, for example "/home/lib"
    NOTE: At the time this document is written, antlr-3.1.1 is the latest version and the build file is configured to search for a file with the name “antlr-3.1.1.jar”. You will have to change the file name accordingly in the build.xml if new antlr version comes out.
    ALSO NOTE that the antlr-3.1.1.jar must be placed under a “lib” directory. You have to set the parent directory of that "lib" directory to the antlr.home property. In the case of “/home/lib”, the antlr.home has to be set to “/home”

3) Go to "/workspace", run

    hg clone http://hg.openjdk.java.net/compiler-grammar/compiler-grammar/langtools

    this will download all the source into "/workspace/langtools"

    Or optionally, if you don't have Mercurial installed, you can download an archived version of the workspace from here.

4) Create a new file "/workspace/langtools/build.properties" with the following content

   boot.java.home = /absolute_path_to_your_jdk_home
   antlr.home = /absolute_path_to_your_antlr_home 


5) Go to /workspace/langtools/make, run

    ant

    This will build the workspace.

6) Run the new javac. Go to "/workspace/langtools/", run

    dist/bootstrap/bin/javac -XDantlrdebug=true -XDparser=antlr  /path_to_any_dot_java_file

    You should see “Parsing with antlr” printed out as a result of the -XDantlrdebug option. Also, try to set "-XDparser=default" to use the default javac parser.


Comments:

Is this workspace is open for other alternative parser than ANTLR ?

Rémi

Posted by Rémi Forax on October 12, 2008 at 03:59 AM PDT #

The langtools workspace has already been changed so it is possible to integrate other parsers into the javac. You just have to extend a Parser interface. The Antlr parser doesn't really change much of the langtools workspace.

Yang

Posted by Yang Jiang on October 12, 2008 at 04:25 AM PDT #

I'm new to PHP and recently setup my local machine with PHP and MySQL for doing development. I was sort of stuck when I needed to post my work for the user to test and review. After looking around a bit I found a site that hosts PHP and MySQL apps. I was surprised that it was free - it seems they're offering the service at no cost until 2012. At that point they'll change over to a fee-based service. However, in the meantime, it's a great place to do anything from demo and sandbox right up to posting sites for real.

Their pitch is as follows:

"This is absolutely free, there is no catch. You get 350 MB of disk space and 100 GB bandwidth. They also have cPanel control panel which is amazing and easy to use website builder. Moreover, there is no any kind of advertising on your pages."

Check it out using this link:

http://www.000webhost.com/83188.html

Important: There's one catch in that you must make sure you visit the account every 14 days - otherwise the account is marked 'Inactive' and the files are deleted!!!

Thanks and good luck!

Posted by donny on October 13, 2008 at 07:44 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Yang Jiang

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today