Giter Site home page Giter Site logo

accc's Introduction

Always Correct Correctness Compiler

Python implementation of a very basic langage compiler that never throw errors while compiling. (almost)
Its not a big and complex compiler, and its implementation is something like awful.
Some links are given below.

Errors

The only errors releved by the compiler is :

  • source code contains characters not present in provided alphabet;
  • provided vocabulary don't follow conventions of writing;

If these conditions are respected, whatever you give to the ACCC, it will always return something valid. (but it can be an empty code)

Bias

If compiled source code is too short, or made of lots of repeatitions, some bias can appear:

  • always same values in object code
  • lots of neutral values

The bigger is the vocabulary and bigger is the list of lexems,
the less bias will appear.

Interests

A compilable source code is a string of characters.
Valid characters are provided at Compiler instanciation.

For example, if you have the alphabet '01', any string exclusively composed of '0' and '1' is compilable and will produce something.

Any little modification of the string can lead to heavy or no modification of object code.
In fact, with ACCC you can generate mutation of a source code without problem of compilation error.

Write a code with lots of parameters is another way to do almost the same thing.

Object code

Currently, current object langage is very simple: you can compare things, and do things. That's all. No loops, variables, functions, objects,… Just conditions and actions.

This is an example of code, not totally illogic, created one time with a source code size of 60, the python specification and the alphabet '01':
(indentation can miss)

    if parameter1 == parameter2 and haveThat:
        do_that
        if have_that:
            say_this
            do_that
            if know_that and have_many_things:
                do_that
                say_this
            do_that
        if have_many_things:
            say_this

Please have a look to docstring of Compiler class for more details about that. (notabily used vocabulary)

I/O speaking

Inputs:

  • iterable of characters (doublons are unexpected) that compose the source code
  • vocabulary used for compiling

Outputs:

  • a python (or other, depending of your language specification) compilable code, according to vocabulary

Next improvements

In random-priority order:

  • allow lexems to have arguments;
  • allow configuration of output langage;
  • unit tests;
  • usage example (see tests repertory);
  • base tables on source code instead of only vocabulary;
  • upload on pypi and github (see links below);

Why don't you use…

Someone do the same thing ? Or better ?
Give me the link, i want to see that !

Why do that ?

  1. It's fun
  2. I need it for test something in another project (an Evolution simulation named EvolAcc ; no surprise)

Links

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.