Menu

Tree [96329e] master 1.3.1 /
 History

HTTPS access


File Date Author Commit
 examples 2017-12-15 Jan Max Meyer Jan Max Meyer [e2559e] Removed #!language directive from expr.ast.par
 min_lalr1 2017-10-22 Jan Max Meyer Jan Max Meyer [9aaafa] min_lalr1 README fixed.
 packaging 2017-11-07 Jan Max Meyer Jan Max Meyer [11e291] Updating packaging files to Arch Linux...
 targets 2017-12-22 Jan Max Meyer Jan Max Meyer [96329e] Bugfix v1.3.1
 .gitignore 2017-11-17 Jan Max Meyer Jan Max Meyer [c228f4] Fixed XML code generator.
 .travis.sh 2017-09-25 Jan Max Meyer Jan Max Meyer [396f3a] Adding travis build files.
 .travis.yml 2017-12-17 Jan Max Meyer Jan Max Meyer [8a1639] Run travis with the correct libphorward version
 CHANGELOG.md 2017-12-22 Jan Max Meyer Jan Max Meyer [96329e] Bugfix v1.3.1
 LICENSE 2017-08-28 Jan Max Meyer Jan Max Meyer [0b0ba6] And again.
 Makefile.am 2017-12-05 Jan Max Meyer Jan Max Meyer [a7c3ee] Renaming templates to targets.
 Makefile.gnu 2017-11-07 Jan Max Meyer Jan Max Meyer [cd0bd6] Updated C parser template that allows for seman...
 Makefile.in 2017-12-05 Jan Max Meyer Jan Max Meyer [a7c3ee] Renaming templates to targets.
 README.md 2017-12-20 Jan Max Meyer Jan Max Meyer [84efa6] Updated README
 aclocal.m4 2017-10-20 Jan Max Meyer Jan Max Meyer [129766] Renamed several functions and removed the prece...
 build.c 2017-12-13 Jan Max Meyer Jan Max Meyer [fd7647] Improving the code generator and updating targets
 buildxml.c 2017-12-01 Jan Max Meyer Jan Max Meyer [6aaa59] Switching parser->lalr_states from a LIST* to a...
 compile 2016-09-09 Jan Max Meyer Jan Max Meyer [f4b870] Updating autotools build toolchain.
 configure 2017-12-21 Jan Max Meyer Jan Max Meyer [96497f] Arrangements for a v1.3 release
 configure.ac 2017-12-21 Jan Max Meyer Jan Max Meyer [96497f] Arrangements for a v1.3 release
 debug.c 2017-12-01 Jan Max Meyer Jan Max Meyer [6aaa59] Switching parser->lalr_states from a LIST* to a...
 depcomp 2016-09-09 Jan Max Meyer Jan Max Meyer [f4b870] Updating autotools build toolchain.
 error.c 2017-10-22 Jan Max Meyer Jan Max Meyer [b70c01] Updated README.md and manpage, some internal so...
 first.c 2017-11-16 Jan Max Meyer Jan Max Meyer [723404] Started porting UniCC away from LIST* to plist
 install-sh 2016-09-09 Jan Max Meyer Jan Max Meyer [f4b870] Updating autotools build toolchain.
 integrity.c 2017-12-01 Jan Max Meyer Jan Max Meyer [6aaa59] Switching parser->lalr_states from a LIST* to a...
 lalr.c 2017-12-06 Jan Max Meyer Jan Max Meyer [4ccd16] Rewriting item_create() and its calls.
 lex.c 2017-12-01 Jan Max Meyer Jan Max Meyer [6aaa59] Switching parser->lalr_states from a LIST* to a...
 list.c 2017-10-22 Jan Max Meyer Jan Max Meyer [b70c01] Updated README.md and manpage, some internal so...
 localenv.sh 2017-12-06 Jan Max Meyer Jan Max Meyer [164d4d] Either allow ":" for "->" in grammar definitions.
 main.c 2017-12-08 Jan Max Meyer Jan Max Meyer [f8d39b] Command-line parameter -l/--language
 mem.c 2017-12-08 Jan Max Meyer Jan Max Meyer [f8d39b] Command-line parameter -l/--language
 missing 2016-09-09 Jan Max Meyer Jan Max Meyer [f4b870] Updating autotools build toolchain.
 parse.c 2017-12-22 Jan Max Meyer Jan Max Meyer [96329e] Bugfix v1.3.1
 parse.h 2017-12-13 Jan Max Meyer Jan Max Meyer [fd7647] Improving the code generator and updating targets
 parse.min 2017-11-16 Jan Max Meyer Jan Max Meyer [723404] Started porting UniCC away from LIST* to plist
 parse.par 2017-12-07 Jan Max Meyer Jan Max Meyer [b47b4c] Abstract syntax tree support drafted for UniCC,...
 proto.h 2017-12-06 Jan Max Meyer Jan Max Meyer [4ccd16] Rewriting item_create() and its calls.
 rewrite.c 2017-12-01 Jan Max Meyer Jan Max Meyer [6aaa59] Switching parser->lalr_states from a LIST* to a...
 string.c 2017-10-22 Jan Max Meyer Jan Max Meyer [b70c01] Updated README.md and manpage, some internal so...
 unicc.1.man 2017-12-21 Jan Max Meyer Jan Max Meyer [96497f] Arrangements for a v1.3 release
 unicc.dtd 2017-08-28 Jan Max Meyer Jan Max Meyer [7e2168] Bumping copyright year and updated LICENSE file...
 unicc.h 2017-12-22 Jan Max Meyer Jan Max Meyer [96329e] Bugfix v1.3.1
 unicc.t2t 2017-12-21 Jan Max Meyer Jan Max Meyer [96497f] Arrangements for a v1.3 release
 utils.c 2017-10-22 Jan Max Meyer Jan Max Meyer [b70c01] Updated README.md and manpage, some internal so...
 virtual.c 2017-10-22 Jan Max Meyer Jan Max Meyer [b70c01] Updated README.md and manpage, some internal so...
 xml.c 2017-10-20 Jan Max Meyer Jan Max Meyer [49e4a5] Began some general refactoring of the source co...
 xml.h 2017-08-28 Jan Max Meyer Jan Max Meyer [7e2168] Bumping copyright year and updated LICENSE file...

Read Me

UniCC Build Status

UniCC is a target-language independent parser generator.

About

UniCC (UNIversal Compiler Compiler) is a LALR(1) parser generator. It compiles an augmented grammar definition into a program source code that parses that grammar. Parsing is the process of transferring input matching a particular grammar, like e.g. a source code written in a programming language, into a well-formed data structure. Because UniCC is intended to be target-language independent, it can be configured via template definition files to emit parsers in nearly any programming language.

UniCC supports parser code generation for the following programming languages so far:

  • C is fully supported (and reference implementation),
  • Python is well supported,
  • ECMAScript is prototyped in a stub, but will come soon.

More target languages can easily be added by creating specific target language templates.

Example

This is the full definition for a four-function arithmetic syntax including their integer calculation semantics (in C).

#!language      "C";    // <- target language!

#whitespaces    ' \t';
#lexeme         int;
#default action [* @@ = @1 *];

#left           '+' '-';
#left           '*' '/';

//Defining the grammar
calc$           : expr           [* printf( "= %d\n", @expr ) *]
                ;

expr            : expr '+' expr  [* @@ = @1 + @3 *]
                | expr '-' expr  [* @@ = @1 - @3 *]
                | expr '*' expr  [* @@ = @1 * @3 *]
                | expr '/' expr  [* @@ = @1 / @3 *]
                | '(' expr ')'   [* @@ = @2 *]
                | int
                ;

int             : '0-9'          [* @@ = @1 - '0' *]
                | int '0-9'      [* @@ = @int * 10 + @2 - '0' *]
                ;

To build and run this example, do

$ unicc expr.par
$ cc -o expr expr.c
$ ./expr -sl
3*10-(2*4)+1
= 23

More real-world examples for parsers implemented with UniCC can are xpl and rapidbatch, or can be found in the examples-folder.

Features

UniCC features the following features, tools and possibilities.

  • Powerful BNF-based grammar definition language
  • Full unicode support
  • Build-in lexical analyzer
  • Grammar prototyping features
  • Abstract Syntax Tree notations
  • Virtual productions
  • Anonymous nonterminals
  • Semantically determined symbols
  • Two parser construction modes allow the use of different algorithmic
    approaches relating the whitespace handling
  • Target-language independent parser development
  • Template-based program-module generator and XML-based parser description
    file generator
  • Platform-independent (console-based)
  • Standard LALR(1) conflict resolution
  • Supporting C and Python target languages so far

Documentation

The UniCC User's Manual is the official documentation of the UniCC Parser Generator. Download it for free here.

Installation

UniCC can be build and installed like any GNU-style program, with

./configure
make
make install

Previously, the Phorward Toolkit must be compiled and installed, because UniCC depends on it.

Contributions

Contributions, ideas, concepts and code is always welcome!
Please feel free to contact us if you have any questions.

Credits

UniCC is developed and maintained by Jan Max Meyer, Phorward Software Technologies.

Some other projects by the author are:

  • libphorward, a free toolkit for parser development, lexical analysis, regular expressions and more.
  • RapidBATCH, a scripting language.
  • pynetree, a light-weight parsing toolkit written in pure Python.
  • JS/CC, the JavaScript parser generator.

License

This software is an open source project released under the terms and conditions of the 3-clause BSD license. See the LICENSE file for more information.

Copyright (C) 2006-2017 by Phorward Software Technologies, Jan Max Meyer.

You may use, modify and distribute this software under the terms and conditions of the 3-clause BSD license. The full license terms can be obtained from the file LICENSE.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.