ParCinJ logo

powered by SourceForge.net Logo

ParCinJ

ParCinJ is a Java™ library for constructing parsers. It stands for Parser Constructor in Java.

  1. No grammar language
  2. Fluent Interface API with an EBNF-like internal DSL
  3. No code generation
Assuming you want to write a parser which parses nested lists like
(a, b, (c1, c2, ()), d) 
In an EBNF-like grammar language (like ANTLR) you would write
list: '(' (element (',' element)*)? ')';
element: ATOM | list;
With ParCinJ's fluent interface API you write following Java code:
    NonTerminalSymbol<P> list = new NonTerminalSymbol<P>("list")
    NonTerminalSymbol<P> element = new NonTerminalSymbol<P>("element");
    TerminalSymbol<P> atom = new TerminalSymbolByType<P>(NormalToken.NORMAL_TOKEN);
    TerminalSymbol<P> open = new TerminalSymbolByText<P>("(");
    TerminalSymbol<P> comma = new TerminalSymbolByText<P>(",");
    TerminalSymbol<P> close = new TerminalSymbolByText<P>(")");
    
    list.definedBy(open
                   .followedBy(element.followedBy(comma.followedBy(element).zeroOrMoreTimes()).optional())
                   .followedBy(close));
    element.definedBy(atom.or(list));
and are classes implementing the interface . It provides the method process which does the actual parsing. To do the job it needs a and a . The TokenIterator is provided by a which turns a stream of characters into a stream of . Processor is only a marker interface of classes which implement particular methods for processing Tokens in certain steps of the parsing process. All symbols are generic classes for a particular processor.

For details see the User Guide or study the examples in src.zip of the distribution.

ParCinJ 0.7

This is a major release from 7/3/2009.

New Features:
  • First application added: Simple Bean Language

Documentation:
  • Brief documentation of the new application.

ParCinJ 0.6

This is a major release from 5/5/2009.

New Features:
  • Improved Fluent Interface API

Documentation:
  • Extended with User Guide and one example.

ParCinJ 0.5

This is the initial release from 4/21/2009.