Giter Site home page Giter Site logo

compilerkit's Introduction

CompilerKit

CompilerKit will be a compiler construction library in C.

CompilerKit aims to streamline developing any software deriving tree structures from sequences, including compilers and interpreters.

What is the license?

LGPLv3.

Why does this library exist?

Existing compiler construction tools (especially parser generators) have problems. Scanners and parser generators:

  • Require learning a new syntax (e.g., lex, yacc, Bison)
  • Add complexity to the build process (e.g., lex, yacc, Bison)
  • Do not handle all possible context free grammars (e.g., lex, yacc)
  • Work with only one language (e.g., lex, yacc)
  • Produce blocking code (e.g., lex)
  • Produce non thread-safe code (e.g., lex)
  • Do not work well with Unicode or non-string sequences.

Where can I contribute to this?

Here:

https://github.com/lawrancej/CompilerKit

A parser combinator is a higher-order function that creates parsers from parsers.

Similar libraries:

Proposed example usage:

Nonterminal * value = nonterminal ("value");
Nonterminal * product = nonterminal ("product");
Nonterminal * sum = nonterminal ("sum");
Nonterminal * expr = nonterminal ("expr");
Parser * formula = derivative_parser (expr);

/*
 Define the grammar below:
 value -> [0-9]+ | (expr)
 product -> value ((*|/) value)*
 sum -> product ((+|-) product)*
 expr -> sum
 */
value->becomes (many1(digit()));
value->becomes (parens(expr));
product->becomes (value, many (or(symbol('*'),symbol('/')), value));
sum->becomes (product, many (or(symbol('+'), symbol('-')), product));
expr->becomes (sum);

/* Return whether the formula parser matched the expression "(1+2+3+4)/2". Should return true */
formula->match("(1+2+3+4)/2");

/* Free the parser. */
parser_free (formula);

How will this work?

This library will use GObject internally.

We will employ test-first pair programming in the development of CompilerKit. (By the way, if you have a better name for this, Iโ€™m all ears.)

Testing and documentation first ensures that we consider the usage of this library before we develop it. It also helps track development progress by test completion and coverage.

Pair programming ensures that we learn from each other.

The library will consist of the following components:

What is the regular expression engine?

The regular expression engine will be swappable:

  • NFA backend
  • DFA backend
  • Derivative backend
  • PCRE backend

What is the scanner component?

The scanner requires a regular expression engine to work.

What is the parser component?

The parser construction will be separate from the swappable parsing backends:

What are the language bindings?

Language bindings will make use of GObject introspection. This library will target support for:

  • C#
  • Python
  • C++
  • Java

What do I need to do?

  1. Install Software.
  2. Contribute.
  3. Solicit and share feedback.
  4. Go to 2.

What software do I need?

  • A compiler (Visual Studio, Xcode, GCC, MinGW, or Clang)
  • Version control (Git)
  • Build tool (CMake)
  • Testing tool (Clar)
  • Documentation tool (Doxygen)

What will I contribute?

Test cases, documentation, and code.

How do I solicit and share feedback?

Via github.

compilerkit's People

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.