JavaCC
Encyclopedia
JavaCC is an open source
parser generator and lexical analyzer
generator for the Java programming language
. JavaCC is similar to yacc
in that it generates a parser from a formal grammar
written in EBNF notation, except the output is Java source code. Unlike yacc, however, JavaCC generates top-down parsers, which limits it to the LL(k)
class of grammars (in particular, left recursion
cannot be used). JavaCC also generates lexical analyzers in a fashion similar to lex. The tree builder that accompanies it, JJTree, constructs its trees from the bottom up.
JavaCC is licensed under a BSD license.
released a parser generator called Jack. The developers responsible for Jack created their own company called Metamata and changed the Jack name to JavaCC. Metamata eventually became part of WebGain
. After WebGain shut down its operations, JavaCC was moved to its current home.
Open source
The term open source describes practices in production and development that promote access to the end product's source materials. Some consider open source a philosophy, others consider it a pragmatic methodology...
parser generator and lexical analyzer
Lexical analysis
In computer science, lexical analysis is the process of converting a sequence of characters into a sequence of tokens. A program or function which performs lexical analysis is called a lexical analyzer, lexer or scanner...
generator for the Java programming language
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...
. JavaCC is similar to yacc
Yacc
The computer program yacc is a parser generator developed by Stephen C. Johnson at AT&T for the Unix operating system. The name is an acronym for "Yet Another Compiler Compiler." It generates a parser based on an analytic grammar written in a notation similar to BNF.Yacc used to be available as...
in that it generates a parser from a formal grammar
Formal grammar
A formal grammar is a set of formation rules for strings in a formal language. The rules describe how to form strings from the language's alphabet that are valid according to the language's syntax...
written in EBNF notation, except the output is Java source code. Unlike yacc, however, JavaCC generates top-down parsers, which limits it to the LL(k)
LL parser
An LL parser is a top-down parser for a subset of the context-free grammars. It parses the input from Left to right, and constructs a Leftmost derivation of the sentence...
class of grammars (in particular, left recursion
Left recursion
In computer science, left recursion is a special case of recursion.In terms of context-free grammar, a non-terminal r is left-recursive if the left-most symbol in any of r’s ‘alternatives’ either immediately or through some other non-terminal definitions rewrites to r again.- Definition :"A...
cannot be used). JavaCC also generates lexical analyzers in a fashion similar to lex. The tree builder that accompanies it, JJTree, constructs its trees from the bottom up.
JavaCC is licensed under a BSD license.
History
In 1996, Sun MicrosystemsSun Microsystems
Sun Microsystems, Inc. was a company that sold :computers, computer components, :computer software, and :information technology services. Sun was founded on February 24, 1982...
released a parser generator called Jack. The developers responsible for Jack created their own company called Metamata and changed the Jack name to JavaCC. Metamata eventually became part of WebGain
WebGain
WebGain was a jointly funded venture between Warburg Pincus and BEA Systems. The objective of the company was to acquire existing Java EE /Java programming language development tools and roll them together into a single application development environment: WebGain studio. A number of challenges,...
. After WebGain shut down its operations, JavaCC was moved to its current home.
See also
- ANTLRANTLRIn computer-based language recognition, ANTLR , or ANother Tool for Language Recognition, is a parser generator that uses LL parsing. ANTLR is the successor to the Purdue Compiler Construction Tool Set , first developed in 1989, and is under active development...
- SableCCSableCCSableCC is an open source compiler generator in Java. Stable version is licensed under the GNU Lesser General Public License...
- Coco/RCoco/RCoco/R is a compiler generator that takes an L-attributed Extended Backus–Naur Form grammar of a source language and generates a scanner and a parser for that language....
- parboiledParboiled (Java)parboiled is an open-source Java library released under an Apache License. It provides support for defining PEG parsers directly in Java source code....
External links
- Official JavaCC website - New site (as of January 2011) at java.net.
- Old Official JavaCC web site - Apparently most of the site was (re)moved...?
- A working snapshot of the old official website - Snapshot archived in 2008 by Internet Archives. Includes more useful content than the current state of the new site.
- JavaCC Tutorial
- JavaCC FAQ
- A JavaCC book - Generating Parsers with JavaCC