GitXplorerGitXplorer
K

Cpp--

public
21 stars
0 forks
1 issues

Commits

List of commits on branch master.
Verified
568903aff4846b0a9c953c75e64383b55bc27859

Update README.md

KKevOrr committed 3 years ago
Verified
fd5cdf0312b80cb50d4fbd5df2121b3fcf4b14fd

Update README.md

KKevOrr committed 4 years ago
Unverified
ee7f606a717c686a89687c4d6599913faddb7d03

Add translation of C++ standards to C ones

KKevOrr committed 4 years ago
Unverified
4a44d92e8be98c522bd8d6848f595e4516648b52

Fixed several problems with compiler argument parsing

KKevOrr committed 4 years ago
Unverified
88c5a745530e32f6209a9fac0f2cc4b4e0acadb8

Add compiler and move __main__.py to cli.py

KKevOrr committed 4 years ago
Unverified
dbbaf4c94568ec7af225f5e120b902ea8d4e02c5

Improve formatting of inline assembly

KKevOrr committed 4 years ago

README

The README file for this repository.

Tests

C++--

C++ to C transpiler

Example

main.cpp:

#include <iostream>
int main() {
    std::cout << "Hello, world!" << std::endl;
}
$ poetry build
$ pip install dist/cppmm-0.1.0-py3-none-any.whl
$ c++-- main.cpp -o main.c
$ gcc main.c -o main -lstdc++
$ ./main
Hello, World!

Proof of correctness

Let

  • CPP ::= all valid C++ programs
  • C ::= all valid C programs
  • (p1 : CPP) ≅ (p2 : C) ::= p1 and p2 are semantically equivalent
  • [[p : CPP]] : C ::= the interpretation of p under C++--

Then

Judgement Evidence
1 C++-- can't possibly work (i.e. ∀ (p : CPP), p ≇ [[p]]) Assumption
2 p1 ≇ [[p1]] → (p1 ≅ [[p1]] → ∀ (p : CPP), p ≅ [[p]]) by Principal of Explosion
3 p1 ≇ [[p1]] by (1) and ∀-elim
4 p1 ≅ [[p1]] → ∀ (p : CPP), p ≅ [[p]] by (2), (3), Modus Ponens
5 (∃ (p1 : CPP), p1 ≅ [[p1]]) → ∀ (p : CPP), p ≅ [[p]] by (4) and ∃-elim
6 (∃ (p : CPP), p ≅ [[p]]) → ∀ (p : CPP), p ≅ [[p]] by (5) and ɑ-equiv
7 C++-- works for hello_world.cpp above (i.e. ∃ (p : CPP), p ≅ [[p]]) Inspection
8 ∀ (p : CPP), p ≅ [[p]] by (6), (7), Modus Ponens