From 43408ef4df909452c7a10992daff911bab97040d Mon Sep 17 00:00:00 2001 From: Leo Tenenbaum Date: Thu, 2 Jan 2020 18:35:17 -0500 Subject: fixed goto problem when compiling as c++ --- README.html | 35 ++----------------- README.md | 29 ++-------------- binfile.c | 51 +++++++++++++++++---------- docs.sh | 3 +- eval.c | 1 - parse.c | 112 +++++++++++++++++++++++++++++++----------------------------- test.toc | 2 +- toc.c | 1 - types.c | 27 +++++++++------ types.h | 7 ++++ 10 files changed, 121 insertions(+), 147 deletions(-) diff --git a/README.html b/README.html index 2f08d15..b64d533 100644 --- a/README.html +++ b/README.html @@ -30,16 +30,15 @@ it is nearly as fast in theory.

To compile the compiler on a Unix-y system, just run ./build.sh release. You can supply a compiler by running CC=tcc ./build.sh release, or build it in debug mode without the release.

-

On other systems, you can just compile main.c with a C compiler. toc uses several C99 and a couple of C11 features, so it might not work on all compilers. But it does compile on quite a few, including clang, gcc, and tcc. It can also be compiled as if it were C++, but it does break the standard in a few places*. So, MSVC can also compile it. The outputted code should be C99-compliant.

+

On other systems, you can just compile main.c with a C compiler. toc uses several C99 and a couple of C11 features, so it might not work on all compilers. But it does compile on quite a few, including clang, gcc, and tcc. It can also be compiled as if it were C++, so, MSVC and g++ can also compile it (it does rely on implicit casting of void * though). The outputted code should be C99-compliant.

Why it compiles to C

-

toc compiles to C for three reasons:

+

toc compiles to C. Here are some reasons why:

@@ -69,8 +68,6 @@ it is nearly as fast in theory.

-

The last three of those could all be removed fairly easily (assuming the system actually has 8-, 16-, 32-, and 64-bit signed and unsigned types).

-

And here are all of its C11 features: