strelec / IPRM-2014

Mathematics with functional programming 2014/15
MIT License
2 stars 0 forks source link

Unified source code storage system

Tabs vs spaces

When you have had your last argument: tabs vs spaces? If you hadn't, we envy you. The fact is - there are many coding standards and pretty much every developer prefers its own. The companies or large teams of developers usually agree on the common list of rules to follow. Needless to say, this way of doing things turns out not to be as effective as it seems. It leads to unnecessary git commits because you have to make corrections after "that guy" -- and after a year of two, the source code is a mess anyway.

How to solve this problem? Much has been written on this subject to date. There exist code reformatters, usually part of expensive IDEs, making you unable to integrate them into your workflow.

This project allows the source code to always be stored in some predefined and/or compact meta format, which can be enforced via a git hook. However, when a programmer opens that file, it is pretty-printed according to his specification. The same, just inverted, process occurs when one saves / commits the file; the written source code is parsed back to that meta format.

This project is based on InvertibleSyntax, described in a paper by Tillmann Rendel and Klaus Ostermann published in 2010.

Batteries included

JSON

As a proof of concept, the JSON parser and pretty printer is included.

We wanted to have the abstract syntax as accurate and usable as possible. Therefore:

The invertible parser library enables us to parse escape sequences to unicode codepoints and pretty print them back.

C

This project already includes the rules for the C programming language.

Coding standard of the project (as ironic as it might sound):