alexandru-dinu / igcc Goto Github PK
View Code? Open in Web Editor NEWInteractive GCC - C/C++ REPL.
Home Page: https://sourceforge.net/projects/igcc/
License: GNU General Public License v3.0
Interactive GCC - C/C++ REPL.
Home Page: https://sourceforge.net/projects/igcc/
License: GNU General Public License v3.0
One of the ways to cut down on the overhead of repeated compilation is to make a precompiled header. The current set up is basically ready: boilerplate.h
is always included, and with bits/stdc++.h
it's got almost the entire standard library.
In fact, bits/stdc++.h
states plainly at the top:
/** @file stdc++.h
* This is an implementation file for a precompiled header.
*/
That's how it's supposed to be used!
But how do we really do it?
gcc -x c++-header $header -o $pcheader
. This helps interaction with #10.-include
(or -include-pch
in clang) in the compiler invocation to get it to include. Doing it via command line lets us avoid writing to the igcc install directory, which can have permission issues. It does prevent users from opting out the boilerplate though.I would be interested to know how I can switch on pure C support. I managed to adjust the compiler settings in the config/config.yaml
and adjusted the "sourcecode" which was weirdly not in a .yaml
file under config but in libigcc/source_code.py
But after that there was weirdly zero output by the repl. I tried generic statements like 1+4
or foo()
and also printf(foo)
but none of theme produced any output. I guess this might be because I disabled the cryptic boilerplate.h
?
When I try to run anything (after writing .h), I get the following error:
<stdin>:1:10: fatal error: boilerplate.h: No such file or directory
compilation terminated.
This happened when I ran #include <iostream>
and printf( "h" );
.
Steps to reproduce:
.h
#include <iostream>
.e
printf( "any string" );
Right now, errors can be tolerated until the code compiles.
However, this is both ugly and inefficient (as gcc
is invoked after each line).
Proposal:
.{
, .}
- similar to ghci$ ./igcc -I libigcc
[1] .{
> int x = 0;
> for (int i = 1; i < 5; ++i) {
> x += i;
> }
> .}
[2] cout << x << endl;
10
[ 1] igcc> 1/0
Compile error - type .e to see it OR disregard if multi-line statement(s)
[ 2] igcc> .e
<stdin>: In function ‘int main()’:
<stdin>:6:6: warning: division by zero [-Wdiv-by-zero]
<stdin>:6:8: error: expected ‘;’ before ‘return’
<stdin>:6:6: warning: statement has no effect [-Wunused-value]
[ 2] igcc> int x = 1;
Compile error - type .e to see it OR disregard if multi-line statement(s)
[ 3] igcc> .e
<stdin>: In function ‘int main()’:
<stdin>:6:6: warning: division by zero [-Wdiv-by-zero]
<stdin>:6:8: error: expected ‘;’ before ‘int’
<stdin>:6:6: warning: statement has no effect [-Wunused-value]
Make explicit:
gcc
vs g++
More clear compared to os.path.join
.
Set up a simple workflow for running all tests under tests/
.
The original tests are a bit messy and disorganized.
We should switch to pytest and make it part of the CI GitHub workflow.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.