Reorganize compiler directory

This commit is contained in:
Max Brunsfeld 2014-01-11 15:14:17 -08:00
parent 023a0c4f70
commit 92cec5758f
51 changed files with 630 additions and 624 deletions

View file

@ -2,7 +2,7 @@
#include "item.h"
#include "../../fixtures/grammars/arithmetic.h"
using namespace tree_sitter::lr;
using namespace tree_sitter::build_tables;
START_TEST

View file

@ -1,8 +1,7 @@
#include "spec_helper.h"
#include <functional>
#include "table_builder.h"
#include "build_tables/perform.h"
using namespace tree_sitter::lr;
using namespace tree_sitter::rules;
typedef unordered_set<ParseAction> parse_actions;
@ -36,7 +35,7 @@ describe("building parse and lex tables", []() {
{ "right-paren", str(")") }
});
pair<ParseTable, LexTable> tables = build_tables(grammar, lex_grammar);
pair<ParseTable, LexTable> tables = build_tables::perform(grammar, lex_grammar);
ParseTable table = tables.first;
LexTable lex_table = tables.second;

View file

@ -1,5 +1,7 @@
#include "spec_helper.h"
#include "transitions.h"
#include "rule_transitions.h"
using build_tables::rule_transitions;
START_TEST
@ -12,7 +14,7 @@ describe("rule transitions", []() {
it("handles symbols", [&]() {
AssertThat(
lr::transitions(symbol1),
rule_transitions(symbol1),
Equals(transition_map<rules::Rule, rules::Rule>({
{ symbol1, rules::blank() }
})));
@ -20,7 +22,7 @@ describe("rule transitions", []() {
it("handles characters", [&]() {
AssertThat(
lr::transitions(char1),
rule_transitions(char1),
Equals(transition_map<rules::Rule, rules::Rule>({
{ char1, rules::blank() }
})));
@ -29,7 +31,7 @@ describe("rule transitions", []() {
it("handles character classes", [&]() {
auto rule = rules::character(CharClassDigit);
AssertThat(
lr::transitions(rule),
rule_transitions(rule),
Equals(transition_map<rules::Rule, rules::Rule>({
{ rule, rules::blank() }
})));
@ -37,7 +39,7 @@ describe("rule transitions", []() {
it("handles choices", [&]() {
AssertThat(
lr::transitions(rules::choice({ symbol1, symbol2 })),
rule_transitions(rules::choice({ symbol1, symbol2 })),
Equals(transition_map<rules::Rule, rules::Rule>({
{ symbol1, rules::blank() },
{ symbol2, rules::blank() }
@ -46,7 +48,7 @@ describe("rule transitions", []() {
it("handles sequences", [&]() {
AssertThat(
lr::transitions(rules::seq({ symbol1, symbol2 })),
rule_transitions(rules::seq({ symbol1, symbol2 })),
Equals(transition_map<rules::Rule, rules::Rule>({
{ symbol1, symbol2 }
})));
@ -54,7 +56,7 @@ describe("rule transitions", []() {
it("handles_long_sequences", [&]() {
AssertThat(
lr::transitions(rules::seq({
rule_transitions(rules::seq({
symbol1,
symbol2,
symbol3,
@ -67,7 +69,7 @@ describe("rule transitions", []() {
it("handles choices with common starting symbols", [&]() {
AssertThat(
lr::transitions(
rule_transitions(
rules::choice({
rules::seq({ symbol1, symbol2 }),
rules::seq({ symbol1, symbol3 }) })),
@ -78,7 +80,7 @@ describe("rule transitions", []() {
it("handles strings", [&]() {
AssertThat(
lr::transitions(rules::str("bad")),
rule_transitions(rules::str("bad")),
Equals(transition_map<rules::Rule, rules::Rule>({
{ rules::character('b'), rules::seq({ rules::character('a'), rules::character('d') })
}
@ -87,7 +89,7 @@ describe("rule transitions", []() {
it("handles patterns", [&]() {
AssertThat(
lr::transitions(rules::pattern("a|b")),
rule_transitions(rules::pattern("a|b")),
Equals(transition_map<rules::Rule, rules::Rule>({
{ rules::character('a'), rules::blank() },
{ rules::character('b'), rules::blank() }
@ -97,7 +99,7 @@ describe("rule transitions", []() {
it("handles repeats", [&]() {
rules::rule_ptr repeat = rules::repeat(rules::str("ab"));
AssertThat(
lr::transitions(repeat),
rule_transitions(repeat),
Equals(transition_map<rules::Rule, rules::Rule>({
{
rules::character('a'),
@ -112,7 +114,7 @@ describe("rule transitions", []() {
repeat = rules::repeat(rules::str("a"));
AssertThat(
lr::transitions(repeat),
rule_transitions(repeat),
Equals(transition_map<rules::Rule, rules::Rule>({
{
rules::character('a'),

View file

@ -0,0 +1,17 @@
#include "spec_helper.h"
#include "compile.h"
#include "../fixtures/grammars/arithmetic.h"
#include <fstream>
START_TEST
describe("code generation", []() {
string test_parser_dir = src_dir() + "/spec/fixtures/parsers";
it("works for the arithmetic grammar", [&]() {
Grammar grammar = test_grammars::arithmetic();
ofstream(test_parser_dir + "/arithmetic.c") << compile(grammar);
});
});
END_TEST

View file

@ -1,26 +0,0 @@
#include "spec_helper.h"
#include "table_builder.h"
#include "parse_table.h"
#include "prepare_grammar.h"
#include "c_code.h"
#include "../fixtures/grammars/arithmetic.h"
#include <fstream>
START_TEST
describe("code generation", []() {
string test_parser_dir = src_dir() + "/spec/fixtures/parsers";
it("works for the arithmetic grammar", [&]() {
Grammar grammar = test_grammars::arithmetic();
auto grammars = prepare_grammar(grammar);
auto tables = lr::build_tables(grammars.first, grammars.second);
auto rule_names = grammars.first.rule_names();
auto token_names = grammars.second.rule_names();
rule_names.insert(rule_names.end(), token_names.begin(), token_names.end());
auto code = code_gen::c_code(rule_names, tables.first, tables.second);
ofstream(test_parser_dir + "/arithmetic.c") << code;
});
});
END_TEST

View file

@ -1,13 +1,14 @@
#include "spec_helper.h"
#include "prepare_grammar.h"
#include "prepare_grammar/perform.h"
START_TEST
using namespace tree_sitter::rules;
using tree_sitter::prepare_grammar::perform;
describe("preparing a grammar", []() {
it("extracts character-based subtrees into a separate grammar", [&]() {
pair<Grammar, Grammar> result = prepare_grammar(Grammar({
pair<Grammar, Grammar> result = perform(Grammar({
{ "rule1", seq({
character('a'),
character('b'),
@ -36,7 +37,7 @@ describe("preparing a grammar", []() {
});
it("turns entire rules into tokens when they contain no symbols", [&]() {
auto result = prepare_grammar(Grammar({
auto result = perform(Grammar({
{ "rule1", sym("rule2") },
{ "rule2", seq({
character('a'),

View file

@ -1,6 +1,5 @@
#include "spec_helper.h"
#include "rules.h"
#include "transition_map.h"
using namespace tree_sitter::rules;

View file

@ -1,5 +1,5 @@
#include "spec_helper.h"
#include "transitions.h"
#include "rule_transitions.h"
START_TEST

View file

@ -1,6 +1,6 @@
#include "item.h"
#include "grammar.h"
#include "transitions.h"
#include "rule_transitions.h"
using std::string;
using std::vector;
@ -9,7 +9,7 @@ using std::make_shared;
using std::ostream;
namespace tree_sitter {
namespace lr {
namespace build_tables {
Item::Item(const string &rule_name, const rules::rule_ptr rule, int consumed_sym_count) :
rule_name(rule_name),
rule(rule),
@ -24,7 +24,7 @@ namespace tree_sitter {
}
transition_map<rules::Rule, Item> Item::transitions() const {
return lr::transitions(rule).map<Item>([&](rules::rule_ptr to_rule) -> item_ptr {
return rule_transitions(rule).map<Item>([&](rules::rule_ptr to_rule) -> item_ptr {
int next_sym_count = (consumed_sym_count == -1) ? -1 : (consumed_sym_count + 1);
return make_shared<Item>(rule_name, to_rule, next_sym_count);
});
@ -32,7 +32,7 @@ namespace tree_sitter {
vector<rules::Symbol> Item::next_symbols() const {
vector<rules::Symbol> result;
for (auto pair : lr::transitions(rule)) {
for (auto pair : rule_transitions(rule)) {
auto sym = dynamic_pointer_cast<const rules::Symbol>(pair.first);
if (sym) result.push_back(*sym);
}

View file

@ -9,7 +9,7 @@
namespace tree_sitter {
class Grammar;
namespace lr {
namespace build_tables {
class Item;
typedef std::shared_ptr<const Item> item_ptr;
@ -37,8 +37,8 @@ namespace tree_sitter {
namespace std {
template<>
struct hash<tree_sitter::lr::Item> {
size_t operator()(const tree_sitter::lr::Item &item) {
struct hash<tree_sitter::build_tables::Item> {
size_t operator()(const tree_sitter::build_tables::Item &item) {
return
hash<std::string>()(item.rule_name) ^
hash<tree_sitter::rules::Rule>()(*item.rule) ^

View file

@ -9,11 +9,11 @@ using std::string;
using std::make_shared;
namespace tree_sitter {
namespace lr {
namespace build_tables {
ItemSet::ItemSet(const vector<Item> &items) : contents(items) {}
ItemSet::ItemSet(const initializer_list<Item> &items) : contents(items) {}
static bool vector_contains(vector<Item> items, lr::Item item) {
static bool vector_contains(vector<Item> items, build_tables::Item item) {
return (std::find(items.begin(), items.end(), item) != items.end());
}
@ -66,7 +66,7 @@ namespace tree_sitter {
return result;
}
bool ItemSet::operator==(const tree_sitter::lr::ItemSet &other) const {
bool ItemSet::operator==(const tree_sitter::build_tables::ItemSet &other) const {
return contents == other.contents;
}

View file

@ -6,7 +6,7 @@
#include <set>
namespace tree_sitter {
namespace lr {
namespace build_tables {
class ItemSet;
typedef std::shared_ptr<const ItemSet> item_set_ptr;
@ -37,11 +37,11 @@ namespace tree_sitter {
namespace std {
template<>
struct hash<const tree_sitter::lr::ItemSet> {
size_t operator()(const tree_sitter::lr::ItemSet &item_set) const {
struct hash<const tree_sitter::build_tables::ItemSet> {
size_t operator()(const tree_sitter::build_tables::ItemSet &item_set) const {
size_t result = hash<size_t>()(item_set.size());
for (auto item : item_set)
result ^= hash<tree_sitter::lr::Item>()(item);
result ^= hash<tree_sitter::build_tables::Item>()(item);
return result;
}
};

View file

@ -1,5 +1,5 @@
#include "table_builder.h"
#include "item_set.h"
#include "./perform.h"
#include "./item_set.h"
#include "rules.h"
#include "grammar.h"
@ -7,7 +7,7 @@ using std::pair;
using std::vector;
namespace tree_sitter {
namespace lr {
namespace build_tables {
static int NOT_FOUND = -1;
class TableBuilder {
@ -113,7 +113,7 @@ namespace tree_sitter {
}
};
pair<ParseTable, LexTable> build_tables(const Grammar &grammar, const Grammar &lex_grammar) {
pair<ParseTable, LexTable> perform(const Grammar &grammar, const Grammar &lex_grammar) {
return TableBuilder(grammar, lex_grammar).build();
}
}

View file

@ -7,8 +7,8 @@
namespace tree_sitter {
class Grammar;
namespace lr {
std::pair<ParseTable, LexTable> build_tables(const Grammar &grammar, const Grammar &lex_grammar);
namespace build_tables {
std::pair<ParseTable, LexTable> perform(const Grammar &grammar, const Grammar &lex_grammar);
}
}

View file

@ -1,10 +1,10 @@
#include "transitions.h"
#include "rule_transitions.h"
#include "rules.h"
using namespace tree_sitter::rules;
namespace tree_sitter {
namespace lr {
namespace build_tables {
class TransitionsVisitor : public rules::Visitor {
public:
transition_map<Rule, Rule> value;
@ -22,14 +22,14 @@ namespace tree_sitter {
}
void visit(const Choice *rule) {
value = transitions(rule->left);
value.merge(transitions(rule->right), [&](rule_ptr left, rule_ptr right) -> rule_ptr {
value = rule_transitions(rule->left);
value.merge(rule_transitions(rule->right), [&](rule_ptr left, rule_ptr right) -> rule_ptr {
return choice({ left, right });
});
}
void visit(const Seq *rule) {
value = transitions(rule->left).map<Rule>([&](const rule_ptr left_rule) -> rule_ptr {
value = rule_transitions(rule->left).map<Rule>([&](const rule_ptr left_rule) -> rule_ptr {
if (typeid(*left_rule) == typeid(Blank))
return rule->right;
else
@ -38,7 +38,7 @@ namespace tree_sitter {
}
void visit(const Repeat *rule) {
value = transitions(rule->content).map<Rule>([&](const rule_ptr &value) -> rule_ptr {
value = rule_transitions(rule->content).map<Rule>([&](const rule_ptr &value) -> rule_ptr {
return seq({ value, choice({ rule->copy(), blank() }) });
});
}
@ -47,15 +47,15 @@ namespace tree_sitter {
rule_ptr result = character(rule->value[0]);
for (int i = 1; i < rule->value.length(); i++)
result = seq({ result, character(rule->value[i]) });
value = transitions(result);
value = rule_transitions(result);
}
void visit(const Pattern *rule) {
value = transitions(rule->to_rule_tree());
value = rule_transitions(rule->to_rule_tree());
}
};
transition_map<Rule, Rule> transitions(const rule_ptr &rule) {
transition_map<Rule, Rule> rule_transitions(const rule_ptr &rule) {
TransitionsVisitor visitor;
rule->accept(visitor);
return visitor.value;

View file

@ -5,8 +5,8 @@
#include "transition_map.h"
namespace tree_sitter {
namespace lr {
transition_map<rules::Rule, rules::Rule> transitions(const rules::rule_ptr &rule);
namespace build_tables {
transition_map<rules::Rule, rules::Rule> rule_transitions(const rules::rule_ptr &rule);
}
}

17
src/compiler/compile.cpp Normal file
View file

@ -0,0 +1,17 @@
#include "compile.h"
#include "grammar.h"
#include "prepare_grammar/perform.h"
#include "build_tables/perform.h"
#include "generate_code/c_code.h"
namespace tree_sitter {
std::string compile(const Grammar &grammar) {
auto grammars = prepare_grammar::perform(grammar);
auto tables = build_tables::perform(grammars.first, grammars.second);
auto rule_names = grammars.first.rule_names();
auto token_names = grammars.second.rule_names();
rule_names.insert(rule_names.end(), token_names.begin(), token_names.end());
return generate_code::c_code(rule_names, tables.first, tables.second);
}
}

12
src/compiler/compile.h Normal file
View file

@ -0,0 +1,12 @@
#ifndef __tree_sitter__compile__
#define __tree_sitter__compile__
#include <string>
namespace tree_sitter {
class Grammar;
std::string compile(const Grammar &grammar);
}
#endif

View file

@ -8,10 +8,9 @@ using std::to_string;
using std::unordered_map;
using std::unordered_set;
using std::vector;
using namespace tree_sitter::lr;
namespace tree_sitter {
namespace code_gen {
namespace generate_code {
static void str_replace(string &input, const string &search, const string &replace) {
size_t pos = 0;
while (1) {

View file

@ -6,8 +6,8 @@
#include "lex_table.h"
namespace tree_sitter {
namespace code_gen {
std::string c_code(std::vector<std::string> rule_names, const lr::ParseTable &parse_table, const lr::LexTable &lex_table);
namespace generate_code {
std::string c_code(std::vector<std::string> rule_names, const ParseTable &parse_table, const LexTable &lex_table);
}
}

View file

@ -1,78 +0,0 @@
#include "extract_tokens.h"
#include "search_for_symbols.h"
#include <unordered_map>
using std::pair;
using std::string;
using std::to_string;
using std::unordered_map;
namespace tree_sitter {
class TokenExtractor : rules::Visitor {
public:
rules::rule_ptr value;
size_t anonymous_token_count = 0;
unordered_map<string, const rules::rule_ptr> tokens;
rules::rule_ptr initial_apply(string name, const rules::rule_ptr rule) {
auto result = apply(rule);
auto symbol = std::dynamic_pointer_cast<const rules::Symbol>(result);
if (symbol && *symbol != *rule) {
tokens.insert({ name, tokens[symbol->name] });
tokens.erase(symbol->name);
anonymous_token_count--;
return rules::rule_ptr();
} else {
return result;
}
}
rules::rule_ptr apply(const rules::rule_ptr rule) {
if (search_for_symbols(rule)) {
rule->accept(*this);
return value;
} else {
string token_name = add_token(rule);
return rules::sym(token_name);
}
}
string add_token(const rules::rule_ptr &rule) {
for (auto pair : tokens)
if (*pair.second == *rule)
return pair.first;
string name = to_string(++anonymous_token_count);
tokens.insert({ name, rule });
return name;
}
void default_visit(const rules::Rule *rule) {
value = rule->copy();
}
void visit(const rules::Choice *choice) {
value = rules::choice({ apply(choice->left), apply(choice->right) });
}
void visit(const rules::Seq *seq) {
value = rules::seq({ apply(seq->left), apply(seq->right) });
}
};
pair<Grammar, Grammar> extract_tokens(const Grammar &input_grammar) {
TokenExtractor extractor;
unordered_map<string, const rules::rule_ptr> rules;
for (auto pair : input_grammar.rules) {
string name = pair.first;
auto new_rule = extractor.initial_apply(name, pair.second);
if (new_rule.get())
rules.insert({ name, new_rule });
}
return {
Grammar(input_grammar.start_rule_name, rules),
Grammar("", extractor.tokens)
};
}
}

View file

@ -1,10 +0,0 @@
#include "prepare_grammar.h"
#include "extract_tokens.h"
using std::pair;
namespace tree_sitter {
pair<Grammar, Grammar> prepare_grammar(const Grammar &input_grammar) {
return extract_tokens(input_grammar);
}
}

View file

@ -1,33 +0,0 @@
#include "search_for_symbols.h"
namespace tree_sitter {
class SymbolSearcher : rules::Visitor {
public:
bool value;
bool apply(const rules::rule_ptr rule) {
rule->accept(*this);
return value;
}
void default_visit(const rules::Rule *rule) {
value = false;
}
void visit(const rules::Symbol *symbol) {
value = true;
}
void visit(const rules::Choice *choice) {
value = apply(choice->left) || apply(choice->right);
}
void visit(const rules::Seq *seq) {
value = apply(seq->left) || apply(seq->right);
}
};
bool search_for_symbols(const rules::rule_ptr &rule) {
return SymbolSearcher().apply(rule);
}
}

View file

@ -0,0 +1,67 @@
#include "lex_table.h"
using std::string;
using std::to_string;
using std::unordered_map;
using std::unordered_set;
using std::vector;
namespace tree_sitter {
// Action
LexAction::LexAction(LexActionType type, size_t state_index, std::string symbol_name) :
type(type),
state_index(state_index),
symbol_name(symbol_name) {}
LexAction LexAction::Error() {
return LexAction(LexActionTypeError, -1, "");
}
LexAction LexAction::Advance(size_t state_index) {
return LexAction(LexActionTypeAdvance, state_index, "");
}
LexAction LexAction::Accept(std::string symbol_name) {
return LexAction(LexActionTypeAccept, -1, symbol_name);
}
bool LexAction::operator==(const LexAction &other) const {
return
(type == other.type) &&
(state_index == other.state_index) &&
(symbol_name == other.symbol_name);
}
std::ostream& operator<<(std::ostream &stream, const LexAction &action) {
switch (action.type) {
case LexActionTypeError:
return stream << string("#<error>");
case LexActionTypeAccept:
return stream << string("#<accept ") + action.symbol_name + ">";
case LexActionTypeAdvance:
return stream << string("#<advance ") + to_string(action.state_index) + ">";
}
}
// State
unordered_set<CharMatch> LexState::expected_inputs() const {
unordered_set<CharMatch> result;
for (auto pair : actions)
result.insert(pair.first);
return result;
}
// Table
size_t LexTable::add_state() {
states.push_back(LexState());
return states.size() - 1;
}
void LexTable::add_action(size_t state_index, CharMatch match, LexAction action) {
states[state_index].actions[match].insert(action);
}
void LexTable::add_default_action(size_t state_index, LexAction action) {
states[state_index].default_actions.insert(action);
}
}

65
src/compiler/lex_table.h Normal file
View file

@ -0,0 +1,65 @@
#ifndef __TreeSitter__lex_table__
#define __TreeSitter__lex_table__
#include <unordered_map>
#include <vector>
#include <string>
#include <unordered_set>
#include "char_match.h"
namespace tree_sitter {
typedef enum {
LexActionTypeAccept,
LexActionTypeError,
LexActionTypeAdvance
} LexActionType;
class LexAction {
LexAction(LexActionType type, size_t state_index, std::string symbol_name);
public:
static LexAction Accept(std::string symbol_name);
static LexAction Error();
static LexAction Advance(size_t state_index);
bool operator==(const LexAction &action) const;
LexActionType type;
std::string symbol_name;
size_t state_index;
};
std::ostream& operator<<(std::ostream &stream, const LexAction &item);
}
namespace std {
template<>
struct hash<tree_sitter::LexAction> {
size_t operator()(const tree_sitter::LexAction &action) const {
return (
hash<int>()(action.type) ^
hash<string>()(action.symbol_name) ^
hash<size_t>()(action.state_index));
}
};
}
namespace tree_sitter {
class LexState {
public:
std::unordered_map<CharMatch, std::unordered_set<LexAction>> actions;
std::unordered_set<LexAction> default_actions;
std::unordered_set<CharMatch> expected_inputs() const;
};
class LexTable {
public:
size_t add_state();
void add_action(size_t state_index, CharMatch match, LexAction action);
void add_default_action(size_t state_index, LexAction action);
static const std::string START;
static const std::string END_OF_INPUT;
std::vector<LexState> states;
};
}
#endif

View file

@ -1,70 +0,0 @@
#include "lex_table.h"
using std::string;
using std::to_string;
using std::unordered_map;
using std::unordered_set;
using std::vector;
namespace tree_sitter {
namespace lr {
// Action
LexAction::LexAction(LexActionType type, size_t state_index, std::string symbol_name) :
type(type),
state_index(state_index),
symbol_name(symbol_name) {}
LexAction LexAction::Error() {
return LexAction(LexActionTypeError, -1, "");
}
LexAction LexAction::Advance(size_t state_index) {
return LexAction(LexActionTypeAdvance, state_index, "");
}
LexAction LexAction::Accept(std::string symbol_name) {
return LexAction(LexActionTypeAccept, -1, symbol_name);
}
bool LexAction::operator==(const LexAction &other) const {
return
(type == other.type) &&
(state_index == other.state_index) &&
(symbol_name == other.symbol_name);
}
std::ostream& operator<<(std::ostream &stream, const LexAction &action) {
switch (action.type) {
case LexActionTypeError:
return stream << string("#<error>");
case LexActionTypeAccept:
return stream << string("#<accept ") + action.symbol_name + ">";
case LexActionTypeAdvance:
return stream << string("#<advance ") + to_string(action.state_index) + ">";
}
}
// State
unordered_set<CharMatch> LexState::expected_inputs() const {
unordered_set<CharMatch> result;
for (auto pair : actions)
result.insert(pair.first);
return result;
}
// Table
size_t LexTable::add_state() {
states.push_back(LexState());
return states.size() - 1;
}
void LexTable::add_action(size_t state_index, CharMatch match, LexAction action) {
states[state_index].actions[match].insert(action);
}
void LexTable::add_default_action(size_t state_index, LexAction action) {
states[state_index].default_actions.insert(action);
}
}
}

View file

@ -1,69 +0,0 @@
#ifndef __TreeSitter__lex_table__
#define __TreeSitter__lex_table__
#include <unordered_map>
#include <vector>
#include <string>
#include <unordered_set>
#include "char_match.h"
namespace tree_sitter {
namespace lr {
typedef enum {
LexActionTypeAccept,
LexActionTypeError,
LexActionTypeAdvance
} LexActionType;
class LexAction {
LexAction(LexActionType type, size_t state_index, std::string symbol_name);
public:
static LexAction Accept(std::string symbol_name);
static LexAction Error();
static LexAction Advance(size_t state_index);
bool operator==(const LexAction &action) const;
LexActionType type;
std::string symbol_name;
size_t state_index;
};
}
}
namespace std {
template<>
struct hash<tree_sitter::lr::LexAction> {
size_t operator()(const tree_sitter::lr::LexAction &action) const {
return (
hash<int>()(action.type) ^
hash<string>()(action.symbol_name) ^
hash<size_t>()(action.state_index));
}
};
}
namespace tree_sitter {
namespace lr {
std::ostream& operator<<(std::ostream &stream, const LexAction &item);
class LexState {
public:
std::unordered_map<CharMatch, std::unordered_set<LexAction>> actions;
std::unordered_set<LexAction> default_actions;
std::unordered_set<CharMatch> expected_inputs() const;
};
class LexTable {
public:
size_t add_state();
void add_action(size_t state_index, CharMatch match, LexAction action);
void add_default_action(size_t state_index, LexAction action);
static const std::string START;
static const std::string END_OF_INPUT;
std::vector<LexState> states;
};
}
}
#endif

View file

@ -1,80 +0,0 @@
#include "parse_table.h"
using std::string;
using std::ostream;
using std::to_string;
using std::unordered_set;
namespace tree_sitter {
namespace lr {
// Action
ParseAction::ParseAction(ParseActionType type, size_t state_index, string symbol_name, size_t child_symbol_count) :
type(type),
state_index(state_index),
symbol_name(symbol_name),
child_symbol_count(child_symbol_count) {};
ParseAction ParseAction::Error() {
return ParseAction(ParseActionTypeError, -1, "", -1);
}
ParseAction ParseAction::Accept() {
return ParseAction(ParseActionTypeAccept, -1, "", -1);
}
ParseAction ParseAction::Shift(size_t state_index) {
return ParseAction(ParseActionTypeShift, state_index, "", -1);
}
ParseAction ParseAction::Reduce(std::string symbol_name, size_t child_symbol_count) {
return ParseAction(ParseActionTypeReduce, -1, symbol_name, child_symbol_count);
}
bool ParseAction::operator==(const ParseAction &other) const {
bool types_eq = type == other.type;
bool state_indices_eq = state_index == other.state_index;
bool child_symbol_counts_eq = child_symbol_count == other.child_symbol_count;
return types_eq && state_indices_eq && child_symbol_counts_eq;
}
ostream& operator<<(ostream &stream, const ParseAction &action) {
switch (action.type) {
case ParseActionTypeError:
return stream << string("#<error>");
case ParseActionTypeAccept:
return stream << string("#<accept>");
case ParseActionTypeShift:
return stream << (string("#<shift ") + to_string(action.state_index) + ">");
case ParseActionTypeReduce:
return stream << (string("#<reduce ") + action.symbol_name + ">");
}
}
// State
ParseState::ParseState() : lex_state_index(-1) {}
unordered_set<string> ParseState::expected_inputs() const {
unordered_set<string> result;
for (auto pair : actions)
result.insert(pair.first);
return result;
}
// Table
size_t ParseTable::add_state() {
states.push_back(ParseState());
return states.size() - 1;
}
void ParseTable::add_action(size_t state_index, string sym_name, ParseAction action) {
states[state_index].actions[sym_name].insert(action);
}
void ParseTable::add_default_action(size_t state_index, ParseAction action) {
states[state_index].default_actions.insert(action);
}
const string ParseTable::START = "__START__";
const string ParseTable::END_OF_INPUT = "__END__";
}
}

View file

@ -1,74 +0,0 @@
#ifndef __TreeSitter__parse_table__
#define __TreeSitter__parse_table__
#include <unordered_map>
#include <vector>
#include <unordered_set>
#include "rule.h"
namespace tree_sitter {
namespace lr {
typedef enum {
ParseActionTypeAccept,
ParseActionTypeError,
ParseActionTypeShift,
ParseActionTypeReduce,
} ParseActionType;
class ParseAction {
ParseAction(ParseActionType type, size_t state_index, std::string symbol_name, size_t child_symbol_count);
public:
static ParseAction Accept();
static ParseAction Error();
static ParseAction Shift(size_t state_index);
static ParseAction Reduce(std::string symbol_name, size_t child_symbol_count);
bool operator==(const ParseAction &action) const;
ParseActionType type;
size_t child_symbol_count;
std::string symbol_name;
size_t state_index;
};
}
}
namespace std {
template<>
struct hash<tree_sitter::lr::ParseAction> {
size_t operator()(const tree_sitter::lr::ParseAction &action) const {
return (
hash<int>()(action.type) ^
hash<string>()(action.symbol_name) ^
hash<size_t>()(action.state_index) ^
hash<size_t>()(action.child_symbol_count));
}
};
}
namespace tree_sitter {
namespace lr {
std::ostream& operator<<(std::ostream &stream, const ParseAction &item);
class ParseState {
public:
ParseState();
std::unordered_map<std::string, std::unordered_set<ParseAction>> actions;
std::unordered_set<ParseAction> default_actions;
std::unordered_set<std::string> expected_inputs() const;
size_t lex_state_index;
};
class ParseTable {
public:
size_t add_state();
void add_action(size_t state_index, std::string symbol_name, ParseAction action);
void add_default_action(size_t state_index, ParseAction action);
static const std::string START;
static const std::string END_OF_INPUT;
std::vector<ParseState> states;
};
}
}
#endif

View file

@ -0,0 +1,78 @@
#include "parse_table.h"
using std::string;
using std::ostream;
using std::to_string;
using std::unordered_set;
namespace tree_sitter {
// Action
ParseAction::ParseAction(ParseActionType type, size_t state_index, string symbol_name, size_t child_symbol_count) :
type(type),
state_index(state_index),
symbol_name(symbol_name),
child_symbol_count(child_symbol_count) {};
ParseAction ParseAction::Error() {
return ParseAction(ParseActionTypeError, -1, "", -1);
}
ParseAction ParseAction::Accept() {
return ParseAction(ParseActionTypeAccept, -1, "", -1);
}
ParseAction ParseAction::Shift(size_t state_index) {
return ParseAction(ParseActionTypeShift, state_index, "", -1);
}
ParseAction ParseAction::Reduce(std::string symbol_name, size_t child_symbol_count) {
return ParseAction(ParseActionTypeReduce, -1, symbol_name, child_symbol_count);
}
bool ParseAction::operator==(const ParseAction &other) const {
bool types_eq = type == other.type;
bool state_indices_eq = state_index == other.state_index;
bool child_symbol_counts_eq = child_symbol_count == other.child_symbol_count;
return types_eq && state_indices_eq && child_symbol_counts_eq;
}
ostream& operator<<(ostream &stream, const ParseAction &action) {
switch (action.type) {
case ParseActionTypeError:
return stream << string("#<error>");
case ParseActionTypeAccept:
return stream << string("#<accept>");
case ParseActionTypeShift:
return stream << (string("#<shift ") + to_string(action.state_index) + ">");
case ParseActionTypeReduce:
return stream << (string("#<reduce ") + action.symbol_name + ">");
}
}
// State
ParseState::ParseState() : lex_state_index(-1) {}
unordered_set<string> ParseState::expected_inputs() const {
unordered_set<string> result;
for (auto pair : actions)
result.insert(pair.first);
return result;
}
// Table
size_t ParseTable::add_state() {
states.push_back(ParseState());
return states.size() - 1;
}
void ParseTable::add_action(size_t state_index, string sym_name, ParseAction action) {
states[state_index].actions[sym_name].insert(action);
}
void ParseTable::add_default_action(size_t state_index, ParseAction action) {
states[state_index].default_actions.insert(action);
}
const string ParseTable::START = "__START__";
const string ParseTable::END_OF_INPUT = "__END__";
}

View file

@ -0,0 +1,70 @@
#ifndef __TreeSitter__parse_table__
#define __TreeSitter__parse_table__
#include <unordered_map>
#include <vector>
#include <unordered_set>
#include "rule.h"
namespace tree_sitter {
typedef enum {
ParseActionTypeAccept,
ParseActionTypeError,
ParseActionTypeShift,
ParseActionTypeReduce,
} ParseActionType;
class ParseAction {
ParseAction(ParseActionType type, size_t state_index, std::string symbol_name, size_t child_symbol_count);
public:
static ParseAction Accept();
static ParseAction Error();
static ParseAction Shift(size_t state_index);
static ParseAction Reduce(std::string symbol_name, size_t child_symbol_count);
bool operator==(const ParseAction &action) const;
ParseActionType type;
size_t child_symbol_count;
std::string symbol_name;
size_t state_index;
};
std::ostream& operator<<(std::ostream &stream, const ParseAction &item);
}
namespace std {
template<>
struct hash<tree_sitter::ParseAction> {
size_t operator()(const tree_sitter::ParseAction &action) const {
return (
hash<int>()(action.type) ^
hash<string>()(action.symbol_name) ^
hash<size_t>()(action.state_index) ^
hash<size_t>()(action.child_symbol_count));
}
};
}
namespace tree_sitter {
class ParseState {
public:
ParseState();
std::unordered_map<std::string, std::unordered_set<ParseAction>> actions;
std::unordered_set<ParseAction> default_actions;
std::unordered_set<std::string> expected_inputs() const;
size_t lex_state_index;
};
class ParseTable {
public:
size_t add_state();
void add_action(size_t state_index, std::string symbol_name, ParseAction action);
void add_default_action(size_t state_index, ParseAction action);
static const std::string START;
static const std::string END_OF_INPUT;
std::vector<ParseState> states;
};
}
#endif

View file

@ -0,0 +1,80 @@
#include "extract_tokens.h"
#include "search_for_symbols.h"
#include <unordered_map>
using std::pair;
using std::string;
using std::to_string;
using std::unordered_map;
namespace tree_sitter {
namespace prepare_grammar {
class TokenExtractor : rules::Visitor {
public:
rules::rule_ptr value;
size_t anonymous_token_count = 0;
unordered_map<string, const rules::rule_ptr> tokens;
rules::rule_ptr initial_apply(string name, const rules::rule_ptr rule) {
auto result = apply(rule);
auto symbol = std::dynamic_pointer_cast<const rules::Symbol>(result);
if (symbol && *symbol != *rule) {
tokens.insert({ name, tokens[symbol->name] });
tokens.erase(symbol->name);
anonymous_token_count--;
return rules::rule_ptr();
} else {
return result;
}
}
rules::rule_ptr apply(const rules::rule_ptr rule) {
if (search_for_symbols(rule)) {
rule->accept(*this);
return value;
} else {
string token_name = add_token(rule);
return rules::sym(token_name);
}
}
string add_token(const rules::rule_ptr &rule) {
for (auto pair : tokens)
if (*pair.second == *rule)
return pair.first;
string name = to_string(++anonymous_token_count);
tokens.insert({ name, rule });
return name;
}
void default_visit(const rules::Rule *rule) {
value = rule->copy();
}
void visit(const rules::Choice *choice) {
value = rules::choice({ apply(choice->left), apply(choice->right) });
}
void visit(const rules::Seq *seq) {
value = rules::seq({ apply(seq->left), apply(seq->right) });
}
};
pair<Grammar, Grammar> extract_tokens(const Grammar &input_grammar) {
TokenExtractor extractor;
unordered_map<string, const rules::rule_ptr> rules;
for (auto pair : input_grammar.rules) {
string name = pair.first;
auto new_rule = extractor.initial_apply(name, pair.second);
if (new_rule.get())
rules.insert({ name, new_rule });
}
return {
Grammar(input_grammar.start_rule_name, rules),
Grammar("", extractor.tokens)
};
}
}
}

View file

@ -4,7 +4,9 @@
#include "grammar.h"
namespace tree_sitter {
std::pair<Grammar, Grammar> extract_tokens(const Grammar &);
namespace prepare_grammar {
std::pair<Grammar, Grammar> extract_tokens(const Grammar &);
}
}
#endif

View file

@ -0,0 +1,12 @@
#include "./perform.h"
#include "extract_tokens.h"
using std::pair;
namespace tree_sitter {
namespace prepare_grammar {
pair<Grammar, Grammar> perform(const Grammar &input_grammar) {
return prepare_grammar::extract_tokens(input_grammar);
}
}
}

View file

@ -4,7 +4,9 @@
#include "grammar.h"
namespace tree_sitter {
std::pair<Grammar, Grammar> prepare_grammar(const Grammar &);
namespace prepare_grammar {
std::pair<Grammar, Grammar> perform(const Grammar &);
}
}
#endif

View file

@ -0,0 +1,35 @@
#include "search_for_symbols.h"
namespace tree_sitter {
namespace prepare_grammar {
class SymbolSearcher : rules::Visitor {
public:
bool value;
bool apply(const rules::rule_ptr rule) {
rule->accept(*this);
return value;
}
void default_visit(const rules::Rule *rule) {
value = false;
}
void visit(const rules::Symbol *symbol) {
value = true;
}
void visit(const rules::Choice *choice) {
value = apply(choice->left) || apply(choice->right);
}
void visit(const rules::Seq *seq) {
value = apply(seq->left) || apply(seq->right);
}
};
bool search_for_symbols(const rules::rule_ptr &rule) {
return SymbolSearcher().apply(rule);
}
}
}

View file

@ -4,7 +4,9 @@
#include "rules.h"
namespace tree_sitter {
bool search_for_symbols(const rules::rule_ptr &);
namespace prepare_grammar {
bool search_for_symbols(const rules::rule_ptr &);
}
}
#endif

View file

@ -1,5 +1,4 @@
#include "rules.h"
#include "transition_map.h"
namespace tree_sitter {
namespace rules {

View file

@ -1,5 +1,4 @@
#include "rules.h"
#include "transition_map.h"
using std::string;
using std::hash;

View file

@ -1,5 +1,4 @@
#include "rules.h"
#include "transition_map.h"
using std::string;

View file

@ -1,5 +1,4 @@
#include "rules.h"
#include "transition_map.h"
using std::string;
using std::hash;

View file

@ -1,5 +1,4 @@
#include "rules.h"
#include "transition_map.h"
using std::string;

View file

@ -1,5 +1,4 @@
#include "rules.h"
#include "transition_map.h"
using std::string;

View file

@ -1,5 +1,4 @@
#include "rules.h"
#include "transition_map.h"
using std::string;
using std::hash;

View file

@ -1,5 +1,4 @@
#include "rules.h"
#include "transition_map.h"
using std::string;
using std::hash;

View file

@ -13,55 +13,56 @@
12130611182C3A1100FCF928 /* blank.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1213060F182C3A1100FCF928 /* blank.cpp */; };
12130614182C3A1700FCF928 /* seq.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12130612182C3A1700FCF928 /* seq.cpp */; };
12130617182C3D2900FCF928 /* string.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12130615182C3D2900FCF928 /* string.cpp */; };
1213061B182C84DF00FCF928 /* item.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12130619182C84DF00FCF928 /* item.cpp */; };
12130622182C85D300FCF928 /* item_set.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12130620182C85D300FCF928 /* item_set.cpp */; };
1214930E181E200B008E9BDA /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 121492E9181E200B008E9BDA /* main.cpp */; };
1225CC6418765693000D4723 /* prepare_grammar_spec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1225CC6318765693000D4723 /* prepare_grammar_spec.cpp */; };
1225CC6718765737000D4723 /* prepare_grammar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1225CC6518765737000D4723 /* prepare_grammar.cpp */; };
1225CC6A187661C7000D4723 /* extract_tokens.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1225CC68187661C7000D4723 /* extract_tokens.cpp */; };
1225CC6D18766969000D4723 /* search_for_symbols.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1225CC6B18766969000D4723 /* search_for_symbols.cpp */; };
1251209B1830145300C9B56A /* rule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1251209A1830145300C9B56A /* rule.cpp */; };
125120A018307DEC00C9B56A /* parse_table.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1251209E18307DEC00C9B56A /* parse_table.cpp */; };
125120A4183083BD00C9B56A /* arithmetic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 125120A3183083BD00C9B56A /* arithmetic.cpp */; };
129D242C183EB1EB00FE9F71 /* table_builder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 129D242A183EB1EB00FE9F71 /* table_builder.cpp */; };
12D136A4183678A2005F3369 /* repeat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12D136A2183678A2005F3369 /* repeat.cpp */; };
12ED72A7186FC8220089229B /* transitions_spec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12ED72A6186FC8220089229B /* transitions_spec.cpp */; };
12EDCF8A187B498C005A7A07 /* tree_spec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12EDCF89187B498C005A7A07 /* tree_spec.cpp */; };
12EDCF8D187C6282005A7A07 /* document.c in Sources */ = {isa = PBXBuildFile; fileRef = 12EDCF8C187C6282005A7A07 /* document.c */; };
12EDCF981881FCD5005A7A07 /* extract_tokens.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12EDCF8F1881FCCA005A7A07 /* extract_tokens.cpp */; };
12EDCF991881FCD9005A7A07 /* perform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12EDCF911881FCCA005A7A07 /* perform.cpp */; };
12EDCF9A1881FCD9005A7A07 /* search_for_symbols.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12EDCF931881FCCA005A7A07 /* search_for_symbols.cpp */; };
12EDCF9F18820116005A7A07 /* parse_table.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12EDCF9D18820116005A7A07 /* parse_table.cpp */; };
12EDCFA818820137005A7A07 /* item_set.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12EDCFA018820137005A7A07 /* item_set.cpp */; };
12EDCFA918820137005A7A07 /* item.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12EDCFA218820137005A7A07 /* item.cpp */; };
12EDCFAA18820137005A7A07 /* perform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12EDCFA418820137005A7A07 /* perform.cpp */; };
12EDCFAB18820137005A7A07 /* rule_transitions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12EDCFA618820137005A7A07 /* rule_transitions.cpp */; };
12EDCFAF18820387005A7A07 /* parse_table.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12EDCF9D18820116005A7A07 /* parse_table.cpp */; };
12EDCFB018820392005A7A07 /* item.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12EDCFA218820137005A7A07 /* item.cpp */; };
12EDCFB118820395005A7A07 /* item_set.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12EDCFA018820137005A7A07 /* item_set.cpp */; };
12EDCFB21882039A005A7A07 /* perform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12EDCFA418820137005A7A07 /* perform.cpp */; };
12EDCFB31882039A005A7A07 /* rule_transitions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12EDCFA618820137005A7A07 /* rule_transitions.cpp */; };
12EDCFB418820519005A7A07 /* compile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12EDCFAC18820181005A7A07 /* compile.cpp */; };
12EDCFBB188205BF005A7A07 /* item_spec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12EDCFB5188205BA005A7A07 /* item_spec.cpp */; };
12EDCFBC188205BF005A7A07 /* rule_transitions_spec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12EDCFB6188205BA005A7A07 /* rule_transitions_spec.cpp */; };
12EDCFBD188205BF005A7A07 /* perform_spec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12EDCFB7188205BA005A7A07 /* perform_spec.cpp */; };
12F9A64E182DD5FD00FAF50C /* spec_helper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12F9A64C182DD5FD00FAF50C /* spec_helper.cpp */; };
12F9A651182DD6BC00FAF50C /* grammar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12F9A64F182DD6BC00FAF50C /* grammar.cpp */; };
12FD4061185E68470041A84E /* c_code.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12FD405F185E68470041A84E /* c_code.cpp */; };
12FD4064185E75290041A84E /* generate_parsers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12FD4063185E75290041A84E /* generate_parsers.cpp */; };
12FD4064185E75290041A84E /* compile_fixtures.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12FD4063185E75290041A84E /* compile_fixtures.cpp */; };
12FD40B3185EEB5E0041A84E /* seq.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12130612182C3A1700FCF928 /* seq.cpp */; };
12FD40B4185EEB5E0041A84E /* table_builder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 129D242A183EB1EB00FE9F71 /* table_builder.cpp */; };
12FD40B6185EEB5E0041A84E /* arithmetic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 125120A3183083BD00C9B56A /* arithmetic.cpp */; };
12FD40B8185EEB5E0041A84E /* item.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12130619182C84DF00FCF928 /* item.cpp */; };
12FD40B9185EEB5E0041A84E /* string.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12130615182C3D2900FCF928 /* string.cpp */; };
12FD40BB185EEB5E0041A84E /* blank.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1213060F182C3A1100FCF928 /* blank.cpp */; };
12FD40BD185EEB5E0041A84E /* choice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1213060C182C398300FCF928 /* choice.cpp */; };
12FD40BF185EEB5E0041A84E /* c_code.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12FD405F185E68470041A84E /* c_code.cpp */; };
12FD40C0185EEB5E0041A84E /* parse_table.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1251209E18307DEC00C9B56A /* parse_table.cpp */; };
12FD40C2185EEB5E0041A84E /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 121492E9181E200B008E9BDA /* main.cpp */; };
12FD40C3185EEB5E0041A84E /* grammar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12F9A64F182DD6BC00FAF50C /* grammar.cpp */; };
12FD40C6185EEB5E0041A84E /* repeat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12D136A2183678A2005F3369 /* repeat.cpp */; };
12FD40C7185EEB5E0041A84E /* item_set.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12130620182C85D300FCF928 /* item_set.cpp */; };
12FD40C8185EEB5E0041A84E /* character.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12130603182C348F00FCF928 /* character.cpp */; };
12FD40C9185EEB5E0041A84E /* symbol.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12130609182C389100FCF928 /* symbol.cpp */; };
12FD40CA185EEB5E0041A84E /* rule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1251209A1830145300C9B56A /* rule.cpp */; };
12FD40CB185EEB5E0041A84E /* pattern.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27A340F3EEB184C040521323 /* pattern.cpp */; };
12FD40D2185EEB970041A84E /* arithmetic.c in Sources */ = {isa = PBXBuildFile; fileRef = 12FD4065185E7C2F0041A84E /* arithmetic.c */; };
12FD40D6185FEEDB0041A84E /* table_builder_spec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12512092182F307C00C9B56A /* table_builder_spec.cpp */; };
12FD40D7185FEEDB0041A84E /* item_spec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12D1369C18328C5A005F3369 /* item_spec.cpp */; };
12FD40D8185FEEDF0041A84E /* rules_spec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 121492EA181E200B008E9BDA /* rules_spec.cpp */; };
12FD40D9185FEEDF0041A84E /* pattern_spec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12D136A0183570F5005F3369 /* pattern_spec.cpp */; };
12FD40DB185FEF0D0041A84E /* arithmetic_spec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12FD40DA185FEF0D0041A84E /* arithmetic_spec.cpp */; };
12FD40DD185FF12C0041A84E /* parser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12FD40DC185FF12C0041A84E /* parser.cpp */; };
12FD40DF1860064C0041A84E /* tree.c in Sources */ = {isa = PBXBuildFile; fileRef = 12FD40DE1860064C0041A84E /* tree.c */; };
12FD40E2186245FE0041A84E /* transitions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12FD40E0186245FE0041A84E /* transitions.cpp */; };
12FD40E718639B910041A84E /* visitor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12FD40E618639B910041A84E /* visitor.cpp */; };
12FD40E918641FB70041A84E /* rules.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12FD40E818641FB70041A84E /* rules.cpp */; };
12FD40EE186641430041A84E /* rules.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12FD40E818641FB70041A84E /* rules.cpp */; };
12FD40EF186641510041A84E /* transitions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12FD40E0186245FE0041A84E /* transitions.cpp */; };
12FD40F01866415D0041A84E /* visitor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12FD40E618639B910041A84E /* visitor.cpp */; };
12FD40F3186641C00041A84E /* char_match.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12FD40F1186641C00041A84E /* char_match.cpp */; };
12FD40F4186641C00041A84E /* char_match.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12FD40F1186641C00041A84E /* char_match.cpp */; };
@ -105,63 +106,65 @@
12130613182C3A1700FCF928 /* seq.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = seq.h; sourceTree = "<group>"; };
12130615182C3D2900FCF928 /* string.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = string.cpp; sourceTree = "<group>"; };
12130616182C3D2900FCF928 /* string.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = string.h; sourceTree = "<group>"; };
12130619182C84DF00FCF928 /* item.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = item.cpp; sourceTree = "<group>"; };
1213061A182C84DF00FCF928 /* item.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = item.h; sourceTree = "<group>"; };
12130620182C85D300FCF928 /* item_set.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = item_set.cpp; sourceTree = "<group>"; };
12130621182C85D300FCF928 /* item_set.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = item_set.h; sourceTree = "<group>"; };
121492E9181E200B008E9BDA /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = main.cpp; path = spec/main.cpp; sourceTree = SOURCE_ROOT; };
121492EA181E200B008E9BDA /* rules_spec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = rules_spec.cpp; path = spec/compiler/rules/rules_spec.cpp; sourceTree = SOURCE_ROOT; };
121D8B3018795CC0003CF44B /* parser.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = parser.h; sourceTree = "<group>"; };
1225CC6318765693000D4723 /* prepare_grammar_spec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = prepare_grammar_spec.cpp; sourceTree = "<group>"; };
1225CC6518765737000D4723 /* prepare_grammar.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = prepare_grammar.cpp; sourceTree = "<group>"; };
1225CC6618765737000D4723 /* prepare_grammar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = prepare_grammar.h; sourceTree = "<group>"; };
1225CC68187661C7000D4723 /* extract_tokens.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = extract_tokens.cpp; sourceTree = "<group>"; };
1225CC69187661C7000D4723 /* extract_tokens.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = extract_tokens.h; sourceTree = "<group>"; };
1225CC6B18766969000D4723 /* search_for_symbols.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = search_for_symbols.cpp; sourceTree = "<group>"; };
1225CC6C18766969000D4723 /* search_for_symbols.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = search_for_symbols.h; sourceTree = "<group>"; };
12512092182F307C00C9B56A /* table_builder_spec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = table_builder_spec.cpp; path = spec/compiler/lr/table_builder_spec.cpp; sourceTree = SOURCE_ROOT; };
1225CC6318765693000D4723 /* prepare_grammar_spec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = prepare_grammar_spec.cpp; path = compiler/prepare_grammar_spec.cpp; sourceTree = "<group>"; };
1251209A1830145300C9B56A /* rule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = rule.cpp; sourceTree = "<group>"; };
1251209E18307DEC00C9B56A /* parse_table.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = parse_table.cpp; sourceTree = "<group>"; };
1251209F18307DEC00C9B56A /* parse_table.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = parse_table.h; sourceTree = "<group>"; };
125120A218307FFD00C9B56A /* arithmetic.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = arithmetic.h; path = spec/fixtures/grammars/arithmetic.h; sourceTree = SOURCE_ROOT; };
125120A3183083BD00C9B56A /* arithmetic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = arithmetic.cpp; path = spec/fixtures/grammars/arithmetic.cpp; sourceTree = SOURCE_ROOT; };
129D242A183EB1EB00FE9F71 /* table_builder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = table_builder.cpp; sourceTree = "<group>"; };
129D242B183EB1EB00FE9F71 /* table_builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = table_builder.h; sourceTree = "<group>"; };
12C344421822F27700B07BE3 /* transition_map.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = transition_map.h; sourceTree = "<group>"; };
12D1369C18328C5A005F3369 /* item_spec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = item_spec.cpp; path = spec/compiler/lr/item_spec.cpp; sourceTree = SOURCE_ROOT; };
12C344421822F27700B07BE3 /* transition_map.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = transition_map.h; path = ../build_tables/transition_map.h; sourceTree = "<group>"; };
12D1369E18342088005F3369 /* todo.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = todo.md; sourceTree = "<group>"; };
12D136A0183570F5005F3369 /* pattern_spec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = pattern_spec.cpp; path = spec/compiler/rules/pattern_spec.cpp; sourceTree = SOURCE_ROOT; };
12D136A2183678A2005F3369 /* repeat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = repeat.cpp; sourceTree = "<group>"; };
12D136A3183678A2005F3369 /* repeat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = repeat.h; sourceTree = "<group>"; };
12E71794181D02A80051A649 /* compiler_specs */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = compiler_specs; sourceTree = BUILT_PRODUCTS_DIR; };
12E71852181D081C0051A649 /* rules.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = rules.h; path = src/compiler/rules/rules.h; sourceTree = SOURCE_ROOT; };
12ED72A6186FC8220089229B /* transitions_spec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = transitions_spec.cpp; path = spec/compiler/lr/transitions_spec.cpp; sourceTree = SOURCE_ROOT; };
12EDCF89187B498C005A7A07 /* tree_spec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tree_spec.cpp; sourceTree = "<group>"; };
12EDCF8B187C6251005A7A07 /* document.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = document.h; sourceTree = "<group>"; };
12EDCF8C187C6282005A7A07 /* document.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = document.c; sourceTree = "<group>"; };
12EDCF8E187DB33E005A7A07 /* parse_config.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = parse_config.h; sourceTree = "<group>"; };
12EDCF8F1881FCCA005A7A07 /* extract_tokens.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = extract_tokens.cpp; path = src/compiler/prepare_grammar/extract_tokens.cpp; sourceTree = SOURCE_ROOT; };
12EDCF901881FCCA005A7A07 /* extract_tokens.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = extract_tokens.h; path = src/compiler/prepare_grammar/extract_tokens.h; sourceTree = SOURCE_ROOT; };
12EDCF911881FCCA005A7A07 /* perform.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = perform.cpp; path = src/compiler/prepare_grammar/perform.cpp; sourceTree = SOURCE_ROOT; };
12EDCF921881FCCA005A7A07 /* perform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = perform.h; path = src/compiler/prepare_grammar/perform.h; sourceTree = SOURCE_ROOT; };
12EDCF931881FCCA005A7A07 /* search_for_symbols.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = search_for_symbols.cpp; path = src/compiler/prepare_grammar/search_for_symbols.cpp; sourceTree = SOURCE_ROOT; };
12EDCF941881FCCA005A7A07 /* search_for_symbols.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = search_for_symbols.h; path = src/compiler/prepare_grammar/search_for_symbols.h; sourceTree = SOURCE_ROOT; };
12EDCF9C18820116005A7A07 /* lex_table.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lex_table.h; sourceTree = "<group>"; };
12EDCF9D18820116005A7A07 /* parse_table.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = parse_table.cpp; sourceTree = "<group>"; };
12EDCF9E18820116005A7A07 /* parse_table.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = parse_table.h; sourceTree = "<group>"; };
12EDCFA018820137005A7A07 /* item_set.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = item_set.cpp; path = src/compiler/build_tables/item_set.cpp; sourceTree = SOURCE_ROOT; };
12EDCFA118820137005A7A07 /* item_set.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = item_set.h; path = src/compiler/build_tables/item_set.h; sourceTree = SOURCE_ROOT; };
12EDCFA218820137005A7A07 /* item.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = item.cpp; path = src/compiler/build_tables/item.cpp; sourceTree = SOURCE_ROOT; };
12EDCFA318820137005A7A07 /* item.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = item.h; path = src/compiler/build_tables/item.h; sourceTree = SOURCE_ROOT; };
12EDCFA418820137005A7A07 /* perform.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = perform.cpp; path = src/compiler/build_tables/perform.cpp; sourceTree = SOURCE_ROOT; };
12EDCFA518820137005A7A07 /* perform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = perform.h; path = src/compiler/build_tables/perform.h; sourceTree = SOURCE_ROOT; };
12EDCFA618820137005A7A07 /* rule_transitions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = rule_transitions.cpp; path = src/compiler/build_tables/rule_transitions.cpp; sourceTree = SOURCE_ROOT; };
12EDCFA718820137005A7A07 /* rule_transitions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = rule_transitions.h; path = src/compiler/build_tables/rule_transitions.h; sourceTree = SOURCE_ROOT; };
12EDCFAC18820181005A7A07 /* compile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = compile.cpp; sourceTree = "<group>"; };
12EDCFAD18820181005A7A07 /* compile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = compile.h; sourceTree = "<group>"; };
12EDCFB5188205BA005A7A07 /* item_spec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = item_spec.cpp; sourceTree = "<group>"; };
12EDCFB6188205BA005A7A07 /* rule_transitions_spec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = rule_transitions_spec.cpp; sourceTree = "<group>"; };
12EDCFB7188205BA005A7A07 /* perform_spec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = perform_spec.cpp; sourceTree = "<group>"; };
12F9A64C182DD5FD00FAF50C /* spec_helper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = spec_helper.cpp; path = spec/compiler/spec_helper.cpp; sourceTree = SOURCE_ROOT; };
12F9A64D182DD5FD00FAF50C /* spec_helper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = spec_helper.h; path = spec/compiler/spec_helper.h; sourceTree = SOURCE_ROOT; };
12F9A64F182DD6BC00FAF50C /* grammar.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = grammar.cpp; path = src/compiler/grammar/grammar.cpp; sourceTree = SOURCE_ROOT; };
12F9A650182DD6BC00FAF50C /* grammar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = grammar.h; path = src/compiler/grammar/grammar.h; sourceTree = SOURCE_ROOT; };
12FD405F185E68470041A84E /* c_code.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = c_code.cpp; path = src/compiler/code_gen/c_code.cpp; sourceTree = SOURCE_ROOT; };
12FD4060185E68470041A84E /* c_code.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = c_code.h; path = src/compiler/code_gen/c_code.h; sourceTree = SOURCE_ROOT; };
12FD4063185E75290041A84E /* generate_parsers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = generate_parsers.cpp; path = spec/compiler/generate_parsers.cpp; sourceTree = SOURCE_ROOT; };
12F9A64F182DD6BC00FAF50C /* grammar.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = grammar.cpp; path = src/compiler/grammar.cpp; sourceTree = SOURCE_ROOT; };
12F9A650182DD6BC00FAF50C /* grammar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = grammar.h; path = src/compiler/grammar.h; sourceTree = SOURCE_ROOT; };
12FD405F185E68470041A84E /* c_code.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = c_code.cpp; path = src/compiler/generate_code/c_code.cpp; sourceTree = SOURCE_ROOT; };
12FD4060185E68470041A84E /* c_code.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = c_code.h; path = src/compiler/generate_code/c_code.h; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
12FD4063185E75290041A84E /* compile_fixtures.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = compile_fixtures.cpp; path = spec/compiler/compile_fixtures.cpp; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
12FD4065185E7C2F0041A84E /* arithmetic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = arithmetic.c; path = spec/fixtures/parsers/arithmetic.c; sourceTree = SOURCE_ROOT; };
12FD40D1185EEB5E0041A84E /* runtime_specs */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = runtime_specs; sourceTree = BUILT_PRODUCTS_DIR; };
12FD40D4185FED9A0041A84E /* tree.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = tree.h; sourceTree = "<group>"; };
12FD40DA185FEF0D0041A84E /* arithmetic_spec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = arithmetic_spec.cpp; sourceTree = "<group>"; };
12FD40DC185FF12C0041A84E /* parser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = parser.cpp; sourceTree = "<group>"; };
12FD40DE1860064C0041A84E /* tree.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tree.c; sourceTree = "<group>"; };
12FD40E0186245FE0041A84E /* transitions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = transitions.cpp; sourceTree = "<group>"; };
12FD40E1186245FE0041A84E /* transitions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = transitions.h; sourceTree = "<group>"; };
12FD40E41862B3530041A84E /* visitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = visitor.h; sourceTree = "<group>"; };
12FD40E618639B910041A84E /* visitor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = visitor.cpp; sourceTree = "<group>"; };
12FD40E818641FB70041A84E /* rules.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = rules.cpp; sourceTree = "<group>"; };
12FD40F1186641C00041A84E /* char_match.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = char_match.cpp; sourceTree = "<group>"; };
12FD40F2186641C00041A84E /* char_match.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = char_match.h; sourceTree = "<group>"; };
12FD40F5186A16020041A84E /* lex_table.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lex_table.cpp; sourceTree = "<group>"; };
12FD40F6186A16020041A84E /* lex_table.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lex_table.h; sourceTree = "<group>"; };
27A340F3EEB184C040521323 /* pattern.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = pattern.cpp; sourceTree = "<group>"; };
27A3438C4FA59A3882E8493B /* pattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pattern.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
@ -213,43 +216,32 @@
path = rules;
sourceTree = "<group>";
};
12130618182C84B700FCF928 /* lr */ = {
12130618182C84B700FCF928 /* build_tables */ = {
isa = PBXGroup;
children = (
12FD40E0186245FE0041A84E /* transitions.cpp */,
12FD40E1186245FE0041A84E /* transitions.h */,
12130619182C84DF00FCF928 /* item.cpp */,
1213061A182C84DF00FCF928 /* item.h */,
12130620182C85D300FCF928 /* item_set.cpp */,
12130621182C85D300FCF928 /* item_set.h */,
12FD40F5186A16020041A84E /* lex_table.cpp */,
12FD40F6186A16020041A84E /* lex_table.h */,
1251209E18307DEC00C9B56A /* parse_table.cpp */,
1251209F18307DEC00C9B56A /* parse_table.h */,
129D242A183EB1EB00FE9F71 /* table_builder.cpp */,
129D242B183EB1EB00FE9F71 /* table_builder.h */,
12C344421822F27700B07BE3 /* transition_map.h */,
12EDCFA018820137005A7A07 /* item_set.cpp */,
12EDCFA118820137005A7A07 /* item_set.h */,
12EDCFA218820137005A7A07 /* item.cpp */,
12EDCFA318820137005A7A07 /* item.h */,
12EDCFA418820137005A7A07 /* perform.cpp */,
12EDCFA518820137005A7A07 /* perform.h */,
12EDCFA618820137005A7A07 /* rule_transitions.cpp */,
12EDCFA718820137005A7A07 /* rule_transitions.h */,
);
name = build_tables;
path = lr;
sourceTree = "<group>";
};
1213061C182C854F00FCF928 /* lr */ = {
1213061C182C854F00FCF928 /* build_tables */ = {
isa = PBXGroup;
children = (
12ED72A6186FC8220089229B /* transitions_spec.cpp */,
12512092182F307C00C9B56A /* table_builder_spec.cpp */,
12D1369C18328C5A005F3369 /* item_spec.cpp */,
12EDCFB5188205BA005A7A07 /* item_spec.cpp */,
12EDCFB6188205BA005A7A07 /* rule_transitions_spec.cpp */,
12EDCFB7188205BA005A7A07 /* perform_spec.cpp */,
);
name = lr;
path = spec/lr;
sourceTree = "<group>";
};
1225CC6218765664000D4723 /* grammar */ = {
isa = PBXGroup;
children = (
1225CC6318765693000D4723 /* prepare_grammar_spec.cpp */,
);
name = grammar;
path = compiler/grammar;
name = build_tables;
path = compiler/build_tables;
sourceTree = "<group>";
};
125120A118307FCA00C9B56A /* grammars */ = {
@ -311,18 +303,17 @@
path = spec;
sourceTree = "<group>";
};
12ED72A5186FC6D90089229B /* grammar */ = {
12ED72A5186FC6D90089229B /* prepare_grammar */ = {
isa = PBXGroup;
children = (
1225CC68187661C7000D4723 /* extract_tokens.cpp */,
1225CC69187661C7000D4723 /* extract_tokens.h */,
12F9A64F182DD6BC00FAF50C /* grammar.cpp */,
12F9A650182DD6BC00FAF50C /* grammar.h */,
1225CC6518765737000D4723 /* prepare_grammar.cpp */,
1225CC6618765737000D4723 /* prepare_grammar.h */,
1225CC6B18766969000D4723 /* search_for_symbols.cpp */,
1225CC6C18766969000D4723 /* search_for_symbols.h */,
12EDCF8F1881FCCA005A7A07 /* extract_tokens.cpp */,
12EDCF901881FCCA005A7A07 /* extract_tokens.h */,
12EDCF911881FCCA005A7A07 /* perform.cpp */,
12EDCF921881FCCA005A7A07 /* perform.h */,
12EDCF931881FCCA005A7A07 /* search_for_symbols.cpp */,
12EDCF941881FCCA005A7A07 /* search_for_symbols.h */,
);
name = prepare_grammar;
path = grammar;
sourceTree = "<group>";
};
@ -334,23 +325,32 @@
path = parsers;
sourceTree = "<group>";
};
12FD4067185E8AF40041A84E /* code_gen */ = {
12FD4067185E8AF40041A84E /* generate_code */ = {
isa = PBXGroup;
children = (
12FD405F185E68470041A84E /* c_code.cpp */,
12FD4060185E68470041A84E /* c_code.h */,
);
path = code_gen;
path = generate_code;
sourceTree = "<group>";
};
12FD40AC185EE4C00041A84E /* compiler */ = {
isa = PBXGroup;
children = (
12ED72A5186FC6D90089229B /* grammar */,
12FD4067185E8AF40041A84E /* code_gen */,
12130618182C84B700FCF928 /* lr */,
12130618182C84B700FCF928 /* build_tables */,
12FD40F1186641C00041A84E /* char_match.cpp */,
12FD40F2186641C00041A84E /* char_match.h */,
12EDCFAC18820181005A7A07 /* compile.cpp */,
12EDCFAD18820181005A7A07 /* compile.h */,
12FD4067185E8AF40041A84E /* generate_code */,
12F9A64F182DD6BC00FAF50C /* grammar.cpp */,
12F9A650182DD6BC00FAF50C /* grammar.h */,
12FD40F5186A16020041A84E /* lex_table.cpp */,
12EDCF9C18820116005A7A07 /* lex_table.h */,
12EDCF9D18820116005A7A07 /* parse_table.cpp */,
12EDCF9E18820116005A7A07 /* parse_table.h */,
12ED72A5186FC6D90089229B /* prepare_grammar */,
12130602182C344400FCF928 /* rules */,
12FD40F9186F4EBE0041A84E /* util */,
);
path = compiler;
sourceTree = "<group>";
@ -368,9 +368,9 @@
12FD40AE185EE6610041A84E /* compiler */ = {
isa = PBXGroup;
children = (
1225CC6218765664000D4723 /* grammar */,
12FD4063185E75290041A84E /* generate_parsers.cpp */,
1213061C182C854F00FCF928 /* lr */,
1225CC6318765693000D4723 /* prepare_grammar_spec.cpp */,
12FD4063185E75290041A84E /* compile_fixtures.cpp */,
1213061C182C854F00FCF928 /* build_tables */,
12D1369F18357066005F3369 /* rules */,
12F9A64C182DD5FD00FAF50C /* spec_helper.cpp */,
12F9A64D182DD5FD00FAF50C /* spec_helper.h */,
@ -407,16 +407,6 @@
path = include;
sourceTree = "<group>";
};
12FD40F9186F4EBE0041A84E /* util */ = {
isa = PBXGroup;
children = (
12C344421822F27700B07BE3 /* transition_map.h */,
12FD40F1186641C00041A84E /* char_match.cpp */,
12FD40F2186641C00041A84E /* char_match.h */,
);
path = util;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@ -485,37 +475,38 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
12FD40D7185FEEDB0041A84E /* item_spec.cpp in Sources */,
12130614182C3A1700FCF928 /* seq.cpp in Sources */,
1225CC6A187661C7000D4723 /* extract_tokens.cpp in Sources */,
129D242C183EB1EB00FE9F71 /* table_builder.cpp in Sources */,
125120A4183083BD00C9B56A /* arithmetic.cpp in Sources */,
1213061B182C84DF00FCF928 /* item.cpp in Sources */,
12EDCFB31882039A005A7A07 /* rule_transitions.cpp in Sources */,
12FD40D9185FEEDF0041A84E /* pattern_spec.cpp in Sources */,
12130617182C3D2900FCF928 /* string.cpp in Sources */,
12FD40E2186245FE0041A84E /* transitions.cpp in Sources */,
12EDCFBD188205BF005A7A07 /* perform_spec.cpp in Sources */,
12130611182C3A1100FCF928 /* blank.cpp in Sources */,
1213060E182C398300FCF928 /* choice.cpp in Sources */,
12F9A64E182DD5FD00FAF50C /* spec_helper.cpp in Sources */,
12EDCFB018820392005A7A07 /* item.cpp in Sources */,
12FD40F7186A16020041A84E /* lex_table.cpp in Sources */,
12FD40E918641FB70041A84E /* rules.cpp in Sources */,
12EDCF981881FCD5005A7A07 /* extract_tokens.cpp in Sources */,
12FD4061185E68470041A84E /* c_code.cpp in Sources */,
12FD40D8185FEEDF0041A84E /* rules_spec.cpp in Sources */,
125120A018307DEC00C9B56A /* parse_table.cpp in Sources */,
12FD4064185E75290041A84E /* generate_parsers.cpp in Sources */,
12FD4064185E75290041A84E /* compile_fixtures.cpp in Sources */,
12EDCFAF18820387005A7A07 /* parse_table.cpp in Sources */,
1214930E181E200B008E9BDA /* main.cpp in Sources */,
12F9A651182DD6BC00FAF50C /* grammar.cpp in Sources */,
12FD40D6185FEEDB0041A84E /* table_builder_spec.cpp in Sources */,
12D136A4183678A2005F3369 /* repeat.cpp in Sources */,
1225CC6418765693000D4723 /* prepare_grammar_spec.cpp in Sources */,
12EDCF9A1881FCD9005A7A07 /* search_for_symbols.cpp in Sources */,
12FD40F3186641C00041A84E /* char_match.cpp in Sources */,
12EDCFB21882039A005A7A07 /* perform.cpp in Sources */,
12EDCFBB188205BF005A7A07 /* item_spec.cpp in Sources */,
12FD40E718639B910041A84E /* visitor.cpp in Sources */,
1225CC6718765737000D4723 /* prepare_grammar.cpp in Sources */,
1225CC6D18766969000D4723 /* search_for_symbols.cpp in Sources */,
12ED72A7186FC8220089229B /* transitions_spec.cpp in Sources */,
12130622182C85D300FCF928 /* item_set.cpp in Sources */,
12EDCF991881FCD9005A7A07 /* perform.cpp in Sources */,
12EDCFBC188205BF005A7A07 /* rule_transitions_spec.cpp in Sources */,
12130605182C348F00FCF928 /* character.cpp in Sources */,
12EDCFB418820519005A7A07 /* compile.cpp in Sources */,
1213060B182C389100FCF928 /* symbol.cpp in Sources */,
12EDCFB118820395005A7A07 /* item_set.cpp in Sources */,
1251209B1830145300C9B56A /* rule.cpp in Sources */,
27A343CA69E17E0F9EBEDF1C /* pattern.cpp in Sources */,
);
@ -526,14 +517,12 @@
buildActionMask = 2147483647;
files = (
12FD40B3185EEB5E0041A84E /* seq.cpp in Sources */,
12FD40B4185EEB5E0041A84E /* table_builder.cpp in Sources */,
12FD40B6185EEB5E0041A84E /* arithmetic.cpp in Sources */,
12FD40DD185FF12C0041A84E /* parser.cpp in Sources */,
12FD40B8185EEB5E0041A84E /* item.cpp in Sources */,
12EDCF8A187B498C005A7A07 /* tree_spec.cpp in Sources */,
12EDCFA918820137005A7A07 /* item.cpp in Sources */,
12EDCF8D187C6282005A7A07 /* document.c in Sources */,
12FD40B9185EEB5E0041A84E /* string.cpp in Sources */,
12FD40EF186641510041A84E /* transitions.cpp in Sources */,
12FD40BB185EEB5E0041A84E /* blank.cpp in Sources */,
12FD40F4186641C00041A84E /* char_match.cpp in Sources */,
12FD40BD185EEB5E0041A84E /* choice.cpp in Sources */,
@ -541,17 +530,19 @@
12FD40BF185EEB5E0041A84E /* c_code.cpp in Sources */,
12FD40F8186A16030041A84E /* lex_table.cpp in Sources */,
12FD40D2185EEB970041A84E /* arithmetic.c in Sources */,
12EDCFA818820137005A7A07 /* item_set.cpp in Sources */,
12FD40DB185FEF0D0041A84E /* arithmetic_spec.cpp in Sources */,
12FD40C0185EEB5E0041A84E /* parse_table.cpp in Sources */,
12FD40F01866415D0041A84E /* visitor.cpp in Sources */,
12EDCF9F18820116005A7A07 /* parse_table.cpp in Sources */,
12FD40C2185EEB5E0041A84E /* main.cpp in Sources */,
12FD40C3185EEB5E0041A84E /* grammar.cpp in Sources */,
12FD40C6185EEB5E0041A84E /* repeat.cpp in Sources */,
12FD40C7185EEB5E0041A84E /* item_set.cpp in Sources */,
12FD40C8185EEB5E0041A84E /* character.cpp in Sources */,
12EDCFAB18820137005A7A07 /* rule_transitions.cpp in Sources */,
12FD40C9185EEB5E0041A84E /* symbol.cpp in Sources */,
12FD40CA185EEB5E0041A84E /* rule.cpp in Sources */,
12FD40EE186641430041A84E /* rules.cpp in Sources */,
12EDCFAA18820137005A7A07 /* perform.cpp in Sources */,
12FD40CB185EEB5E0041A84E /* pattern.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -568,6 +559,8 @@
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
spec/externals/igloo,
src/externals/boost,
src/compiler,
src/runtime,
);
STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = dynamic;
USER_HEADER_SEARCH_PATHS = "src/externals/boost spec/externals/igloo";
@ -583,6 +576,8 @@
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
spec/externals/igloo,
src/externals/boost,
src/compiler,
src/runtime,
);
STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = dynamic;
USER_HEADER_SEARCH_PATHS = "src/externals/boost spec/externals/igloo";