Module: Antelope::Ace

Defined in:
lib/antelope/ace.rb,
lib/antelope/ace/errors.rb,
lib/antelope/ace/scanner.rb,
lib/antelope/ace/compiler.rb,
lib/antelope/ace/scanner/first.rb,
lib/antelope/ace/scanner/third.rb,
lib/antelope/ace/scanner/second.rb,
lib/antelope/ace/scanner/argument.rb

Overview

Defines the Ace file. The Ace file format works similarly to bison's y file format. The Ace file is seperated into three parts:

 <first>
 %%
 <second>
 %%
 <third>

All parts may be empty; thus, the minimal file that Ace will accept would be

%%
%%

The first part consists of directives and blocks; directives look something like '%' <directive>[ <argument>]*\n, with <directive> being any alphanumerical character, including underscores and dashes, and <argument> being any word character or a quote-delimited string. Blocks consist of '%{" <content> "\n" "\s"* "%}', with <content> being any characters. The content is copied directly into the body of the output.

The second part consists of rules. Rules look something like this:

<nonterminal>: (<nonterminal> | <terminal>)* ['{" <content> "}"] ["|" (<nonterminal> | <terminal>)* ["{" <content> "}']]* [;]

Where <nonterminal> is any lowercase alphabetical cahracter, <terminal> is any uppercase alphabetical character, and <content> is code to be used in the output file upon matching the specific rule.

The third part consists of a body, which is copied directly into the output.

Defined Under Namespace

Classes: Compiler, Error, InvalidStateError, NoDirectiveError, Scanner, SyntaxError