Skip to the content.

Emerge

What

Emerge is a command-line tool for automatically generating lexers and parsers in Go from an EBNF description of any arbitrary grammar (language).

Since Emerge is agnostic about a given input grammar (language), building other's modules of the compiler's front-end (semantic analyzer, intermediate code generator, and machine-independent code optimizer) are beyond the scope of this project.

For building the back-end for a compiler's front-end you can tap into out-of-the-shell projects such as LLVM.

Why

Currently, Go does not provide a first-class support for building compilers written completely in Go. When it comes to lexical analysis, you can either use the built-in text/scanner package for simple use-cases or build the scanner by hand for more sophisticated use-cases. For the syntactic analysis part, you can use goyacc for auto-generating a parser from a Yacc file. Since, goyacc is just a port of yacc For Go, it does not play very well with the language. In particular,

How

Emerge is a response to all these challenges by reimplementing the underlying concepts and algorithms, that are well-established for a long time in the field of compiler design, in Go with having the requirements and best practices of today's world in mind.

Similar Projects

Here is a summary of some of the other similar projects.

Table of Contents

References