Here you can find a proof-of-concept implementation of ModelCC for Java. The provided implementation employs an optimized Earley-like chart parser, a dynamic programming algorithm for parsing context-free grammars that runs in cubic time for arbitrary context-free grammars, in quadratic time for unambiguous context-free grammars, and in linear time for most LR(k) grammars.
ModelCC is distributed under the Modified BSD License below. BSD licenses are a family of permissive free software licenses, imposing minimal restrictions on the redistribution of software. This license allows unlimited redistribution for any purpose as long as its copyright notices and the license's disclaimers of warranty are maintained. BSD Licenses allow proprietary use and allow the software released under the license to be incorporated into proprietary products (i.e. works based on this material may be released under a proprietary license as closed source software).
ModelCC Software License
Copyright (c) 2015, The ModelCC Development Team, http://www.modelcc.org/
This License governs use of the accompanying Software, and your use of the
Software constitutes acceptance of this license.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the ModelCC development team nor the names of
its contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE MODELCC DEVELOPMENT TEAM BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
ModelCC release notes
Comprehensive JUnit test suite, including all the examples in the ModelCC tutorial (see test.modelcc.language.*).
Improved lexer API for unlimited data streams (org.modelcc.lexer.Tokenizer), available both for FLEX and LAMB lexers.
Line number and offset information for debugging input streams (org.modelcc.lexer.Token)
Language grammar decoupled from Java object instantiation.
Generic Model & JavaModelReader, with LanguageModel & JavaLanguageReader subclasses for context-free languages.
Improved message logging facilities (org.modelcc.io.MessageLogger).
Support for separate compilation by means of predefined model elements, e.g.
Parser<Expression> parser = createParser();
parser.add(new Constant("pi", 3.1415927));
assertEquals(3.1415927, parser.parse("pi").eval(), EPSILON);
assertEquals(2*3.1415927, parser.parse("2*pi").eval(), EPSILON);