Enki - Overview

(Back to Enki Main)

Overview

The concept behind Enki is to provide a means to create efficent parser frontends in D, by way of a more suitable grammar. As D is a very versatile and multi-purpose language, the task of composing a parser can become quite tedious and difficult to express for grammars of even modest complexity. Instead of having the developer tediously code a parser in D directly, Enki uses a more targeted grammar (EBNF) to express a parser's definition - and then writes the parser automatically. The result is a tool that acts like a form of source-code compression, allowing the developer to draft a parser with far fewer lines of code, yet with a much higher degree of clarity.

While EBNF is a wonderful grammar for expressing other grammars, it lacks the ability to do anything but verify that an input set matches a given definition; this is not a problem with Enki. Enki provides ways to annotate to ENBF so one can create a parse tree, trigger events and more as the result of any given grammar rule. This is where Enki gets its power and expressiveness from: it relies on the D language where it is strongest.

Enki also stays out of the way of the developer by not imposing on the developer in any way - it only generates frontend code. Enki doesn't provide any way to do arithmetic or any other operations within its own grammar, as doing so would be re-inventing D. Instead, its understood that the various annotations, and the developer-supplied D code that support them, will handle these kinds of details instead. The generated code is also very readable, which allows the developer to use Enki as a starting point rather than as a part of their development cycle, if they so choose.

As far as Enki's name-sake goes, it is taken directly from Snowcrash.  At about the time I was considering 
the idea of a parser generator, I was very taken with Stephenson's idea to tie technology, language and 
programming back to ancient Sumeria.  As Enki is portrayed in Snowcrash as a 'hacker god' that gave humanity 
language by way of a mother toungue of sorts, I figured that "Enki" would be an appropriate name for a tool 
that defines other languages in code. - Pragma 

See: http://en.wikipedia.org/wiki/Enki#Enki_in_popular_culture