Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
The logical / semantic specification for the gybe project.
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.



(Excerpted from part I of the Gybe Language Specification.)

The Gybe language, written by Benjamin Samuel, is intended to act as an
interoperable logical definition of relational database schemata.

The language has its origins in A, a language Chris Date designed as the
underpinnings of his language Tutorial D. He observed that most operators could
be implemented as macros from A so I spent a day actually trying to do this in
Scheme. I discovered that although the specifications he gave almost allowed
this, there were certain problems that prevented a straightforward and useful
implementation.  I believe I have resolved those issues and have isolated the
minimum set of operators to allow a complete implementation of the relational
algebra. All other operators are implemented through macro replacement and user
defined functionality can be implemented by adding special lookup tables. I
doubt an entire implementation will be constructed with macro replacement, but
by limiting the scope of what operations can do we grant far more freedom to an
optimizer that works by rewriting expressions.

Being constructed from a minimal set of primitive operators lends itself to the
language being interoperable and standard. Users working in different
applications can construct an entirely different syntax that is tailored to
their particular needs, and because Gybe limits its own types strictly to
relation types, users are not restricted to one implementation of any data

Gybe further enables interoperability by fulling separating the logical meaning
of data from its physical representation. None of Gybe's primitive operators
allow direct manipulation of scalars because such manipulation is achieved
through lookup tables. 

One unique feature of Gybe is that finite relational values can be expressed in
a "sum of products" form that is roughly analogous to the sum of products form
in electrical engineering. Smaller relational values can be folded directly
into an expression and relational values can have unresolved symbols embedded
in them. Rather than an optimizer that merely tries to reorder joins, a Gybe
optimizer can attempt to rewrite any part of the expression.

Furthermore, most relational languages have theoretical trouble with negating a
relation because set theory has no notion of a "negated set." Gybe has an
alternate logical form that correctly handles a negated relation and allows
double-negation to correctly return the original value.


These files are a set of LaTeX documents, a build script, and a test
implementation in Haskell. The license for these files is in the file
LICENSE, which also includes information for downloading them from the
source and contacting the author.


A US Letter and A4 formatted PDF is available from:

If you'd like to build these documents, you'll need:

 * The 2009 version of TeX Live.
 * The MnSymbol package.
 * lhs2TeX
 * perl5 
 * python2.6 
 * waf is included

To build everything:

./waf configure
./waf build

The targets are put into a separate build directory.

Useful build targets:

[[[ Alas, haven't figured out how to make these work under waf. :-( ]]]

If you'd like to compile the haskell files, you'll need:

 * ghc
 * cabal

(Should upload the libraries to hackage.)
Something went wrong with that request. Please try again.