GitXplorerGitXplorer
K

Cpp--

public
21 stars
0 forks
1 issues

Commits

List of commits on branch master.
Unverified
45577488fadada160f78c8ea7a71fcc5b0abac8b

std::terminate() output is different on Mac

KKevOrr committed 4 years ago
Unverified
d8ca18f379f5d2a50e74d69a619bbba003d61231

Add tests/exception

KKevOrr committed 4 years ago
Unverified
57a29db016f1d2e754e529e2685b83ab155b69f5

Add tests/library

KKevOrr committed 4 years ago
Unverified
8625b98bb5b37f0f4246294ad3bd23191458bd67

tests/including: rename a.?pp to lib.?pp

KKevOrr committed 4 years ago
Unverified
334b25f061f3495c8ae2a2beb7efb1d645b1d2a2

Revert "tests/including: make parameter const"

KKevOrr committed 4 years ago
Unverified
0224a3a8fa97b8cfcb00ee2b17ffb30d58d14c54

tests/including: make parameter const

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