This folder contains a series of examples and explanations illustrating how to write extensions in ableC. Within each folder here is a README.md file explaining what is going on, a simple example extension, some extended C programs, and a Makefile to compile them. It is expected that the user understands some concepts of programming languages, such as parsing and attribute grammars, and has a basic knowlage of the Silver language. A more detailed starting guide to Silver and a refrence manual may be found on the MELT website.
To build the examples, it is expected that you have installed Silver and Silver-ableC, and clone this repository in the same directory as ableC. For more information see https://github.com/melt-umn/silver-ableC/blob/develop/GETTING_STARTED.md
This tutorial is composed of 3 sections. It is expected that you complete the first section in order before the second two, but the second and third sections do not depend on each other.
- Getting started: Writting a very simple 'Hello world' example extension
- Error checking: An introduction to the type system of ableC, and implementing error checking for a new binary operator that computes an average
- Declarations: A look at how declarations and type expressions work in C, writing a new struct declaration syntax for tuples
- Embedded domain spesific languages: A look at how expressions work in C, writing a simple embedded DSL, prefix arithmetic expressions
TODO: Add a section discussing concrete syntax in more detail (which nonterminals to extend, what lexer classes to use, tricks for resolving lexer conflicts, etc.)
- Construction helpers: Using the parsing and substitution mechanisms in ableC, implement an exponent operator
- Lifting: Define a new expression to declare a global int constant
- Operator overloading: Define a new 'interval' type with overloads for host operators
- Extensible env: Define a new environment namespace containing integer constants
- Type qualifiers: Define a new 'tainted' type qualifier that raises compile-time errors to prevent string format vulnerabilities from being exploited.
- (Coming soon!) Modular determinism: Apply the modular determinism analysis to the previously-defined tuple extension
- (Coming soon!) Modular well-definedness: Apply the modular well-definedness analysis to the previously-defined postfix arithmetic extension
- (Coming soon!) Organizing extensions: A look at the skeleton extension, and how to set up an extension for distribution
- (Coming soon!) Utility extensions: A look at several generally-useful extensions, including string, vector, templating, and closure.