Home | Download | ANTLRWorks | Wiki | About ANTLR | Feedback | Support | Bugs | v2


Latest version is 3.0.1
Download now! »

Download
» Home
» Download
» ANTLRWorks
» News
»Using ANTLR
» Documentation
» FAQ
» Articles
» Grammars
» File Sharing
» Runtime API
» Tech Support
» Bug Tracking
»About ANTLR
» What is ANTLR
» Why use ANTLR
» Showcase
» Testimonials
» Getting Started
» Software License
» ANTLR WebLogs
» ANTLR Workshops
»StringTemplate
»ANTLR v2
»Feedback
»Credits
»Contact


Support StringTemplate, ANTLR Project by making a donation! Terence often pays for things like the antlr.org server, conference travel, and this site design (that alone cost US$1000). Buy him a beer and pizza remotely ;)

Search



2007 Google Summer Of Code ANTLR Projects

ANTLR is a well-known project and students will gain a wide, ready-made audience for their work. Part of my motivation for offering these projects is the imminent release of ANTLR v3, a complete rewrite that I have been working on fiendishly for 4 years. In May 2007, Pragmatic Programmers will publish The Definitive ANTLR Reference: Building domain-specific-languages. You might be interested also in ANTLRWorks, a highly successful grammar development environment written by a University of San Francisco graduate student.

All projects must be released under the BSD license. With the exception of the gdiff program (which can be written in Java or Python), all projects must be written in Java.

Terence Parr is the maniac behind ANTLR and the StringTemplate template engine. He has been working on ANTLR and other open-source projects since 1989. He is a professor of computer science at the University of San Francisco. Terence will be the mentor for all Summer of Code ANTLR projects. About ANTLR.

gUnit -- Grammar Unit Testing

Skills needed: Some experience with grammars, parsing, and tree construction. Possible you might need knowledge of Java reflection and Runtime.exec(). A one-student project.

This project will do for grammar testing what jUnit did for unit testing. The idea is to provide a bunch of input output pairs for rules in a grammar. The output could be simply success or failure, a parse tree, an abstract syntax tree (AST), an expected syntax error, or even some text output.

rulename:
"..." -> OK
"..." -> a parse tree
"..." -> an AST
"..." -> FAIL
"..." -> EXCEPTION(NullPtrException)
"..." -> {condition must be true}?
"..." -> "some output string"

anotherrule :
    ....
For example
expr:
  "3+4" -> "7"
  "3+4" -> ^(+ 3 4)
  "-1"  -> "-1"
  "3++9"-> FAIL

Tasks:

  1. fully define the gUnit language
  2. build the gUnit grammar to recognize the syntax
  3. build StringTemplate templates to generate java
  4. hook templates into grammar with template construction syntax
  5. build the gUnit script to parse / translate gUnit tests and then run all the tests

Grammar (tree-based) gdiff Program

Skills needed: Strong background in algorithms and data structures. Experience with revision control systems. Two students can work on this one together: one that built the parsers and another to handle the tree diff algorithm. I suspect the necessary algorithm is known: you might have to read some technical papers to figure them out.

Reusing grammars is currently very difficult. The minute you add actions to a grammar it becomes very different from the original grammar lexically, even if the underlying grammar has not changed. To keep your grammar up-to-date, you would like to integrate changes from the "root" grammar on the ANTLR.org website. Because of the actions and other common formatting changes, simple revision control systems for grammars are insufficient. In some cases, you will have multiple tree grammars representing multiple phases in a complex translation. The tree grammar itself is identical for all phases because the trees are the same. But, the actions are different for every grammar. Changes to the structure of the tree currently requires manual changes across all tree grammars; clearly, this is an unacceptable situation.

I am looking for a student to write a gdiff program (analogous to diff3) that would compare to grammar files and push changes from the original grammar to the modified grammar. Is program would solve a really nasty grammar reuse problem.

ANTLR v3 grammars

Skills needed: Some experience with grammars would be helpful, but not necessary. You could use this opportunity to build grammars and parsing. Probably best with one student per project.

It would be great to get students building grammars for the standard languages. I am open to grammars for any language. Here are a few that come to mind.

  • SQL (an extremely popular grammar in v2; let's convert to ANTLR v3!)
  • VHDL
  • Verilog
  • Javascript
  • PHP
  • Fortran
  • C++ (not possible to complete in a summer, but a lot of progress could be made using existing grammars for C++ written in ANTLR v2). NetBeans project is currently working on a C++ grammar in v3; I am already cooperating with them.

ANTLR v3 backends (Code Generators)

Skills needed: Strong knowledge of parsing. It would be very helpful to have experience with ANTLR or another recursive descent parser generator such as JavaCC. One or more students could work on each backend.

There are a number of language targets already for ANTLR that generate parsers in Java, Objective-C, C, C#, and so on. Each backend has two components: a runtime library and a group of code generation templates. No code is necessary to build a target; only templates (amazing, huh?!) Targets have just begun for:

  • C++
  • Ruby
  • Python
  • Perl
It would be nice to see PHP and any other language you think would be cool. D?

Bring Python StringTemplate up to 3.0

Skills needed: Knowledge of StringTemplate very helpful, obviously, but general knowledge of template engines would probably suffice. A one-student project.

The C# and Java versions of StringTemplate are current, but the Python version is not. I would love to have a student bring the Python version up to date.