matslina / awib Goto Github PK
View Code? Open in Web Editor NEWa brainfuck compiler written in brainfuck
License: GNU General Public License v3.0
a brainfuck compiler written in brainfuck
License: GNU General Public License v3.0
See also https://wiki.gentoo.org/wiki/Modern_C_porting.
In Clang/LLVM 16 the following errors are enabled by default:
-Werror=implicit-function-declaration
-Werror=implicit-int
-Werror=int-conversion
-Werror=incompatible-function-pointer-types
Building awib with CLANG 16 and presumably GCC 14 leads to the following errors.
cp awib.b awib_make_binary.c
gcc -std=c99 awib_make_binary.c -o awib_make_binary.bin -O2
awib_make_binary.c:522:1: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
_K_,_KK,__K,____,__[4>>002<<020]; _(__){__K=____?__K:__;____=__;while(
^
int
awib_make_binary.c:522:5: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
_K_,_KK,__K,____,__[4>>002<<020]; _(__){__K=____?__K:__;____=__;while(
^
int
awib_make_binary.c:522:9: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
_K_,_KK,__K,____,__[4>>002<<020]; _(__){__K=____?__K:__;____=__;while(
^
int
awib_make_binary.c:522:13: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
_K_,_KK,__K,____,__[4>>002<<020]; _(__){__K=____?__K:__;____=__;while(
^
int
awib_make_binary.c:522:18: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
_K_,_KK,__K,____,__[4>>002<<020]; _(__){__K=____?__K:__;____=__;while(
^
int
awib_make_binary.c:522:37: error: parameter '__' was not declared, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
_K_,_KK,__K,____,__[4>>002<<020]; _(__){__K=____?__K:__;____=__;while(
^
awib_make_binary.c:522:35: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
_K_,_KK,__K,____,__[4>>002<<020]; _(__){__K=____?__K:__;____=__;while(
^
int
awib_make_binary.c:522:35: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
awib_make_binary.c:524:30: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
+K]&1):__*__;_KK+=__;_(__);}}___(){while(K[++_KK]){ _K_('v'^']',__[
^
int
awib_make_binary.c:525:13: warning: | has lower precedence than ==; == will be evaluated first [-Wparentheses]
,]++)_K_(055|___==___,__[,]--)_K_('K'^'u',,++)_K_('w'^'K',--,)_K_('_'^
^~~~~~~~~
awib_make_binary.c:521:32: note: expanded from macro '_K_'
#define _K_(___,_K,__)(K[_KK]^(___))?_K_^_K_:_K _K_ __;
^~~
awib_make_binary.c:525:13: note: place parentheses around the '==' expression to silence this warning
,]++)_K_(055|___==___,__[,]--)_K_('K'^'u',,++)_K_('w'^'K',--,)_K_('_'^
^~~~~~~~~
awib_make_binary.c:521:32: note: expanded from macro '_K_'
#define _K_(___,_K,__)(K[_KK]^(___))?_K_^_K_:_K _K_ __;
^~~
awib_make_binary.c:525:13: note: place parentheses around the | expression to evaluate it first
,]++)_K_(055|___==___,__[,]--)_K_('K'^'u',,++)_K_('w'^'K',--,)_K_('_'^
~~~^~~~
awib_make_binary.c:521:32: note: expanded from macro '_K_'
#define _K_(___,_K,__)(K[_KK]^(___))?_K_^_K_:_K _K_ __;
^~~
awib_make_binary.c:527:40: error: call to undeclared function 'putchar'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
[K]&1)):_(0))K[_KK]-46?_(__[_K_]&1>>1):putchar(__[_K_]);if(_KK[K]^(1<<
^
awib_make_binary.c:528:26: error: call to undeclared function 'getchar'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
1^'.'))_(0);else{__[_K_]=getchar();}}}main(){--_KK;___();}
^
awib_make_binary.c:528:39: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
1^'.'))_(0);else{__[_K_]=getchar();}}}main(){--_KK;___();}
^
int
2 warnings and 11 errors generated.
make: *** [Makefile:7: binary] Error 1
This BF generates
+[>]<- [<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>-]
The below C code, notice the negative array index is accessed despite the fact that the second loop isn't run. The program mandelbrot.b has this sort of construct.
However, this doesn't actually segfault for me, but the @lang_go variant does throw the error both for my tiny example above and mandelbrot.b.
#include <stdio.h>
char buf[0xffff];
int
main()
{
char *p = buf;
int c;
*p += 1;
while (*p) {
p += 1;
}
p -= 1;
*p -= 1;
*(p - 16) += *p * 1;
*p = 0;
return 0;
}
Because of the lack of a return() statement in the main() function, awib_make_binary.bin returns with 141, which makes GNU make exit because of failure. Adding "return(0);" to the main() function in the C part of awib.b fixes that, but this thing is so messy that I have no idea where to even start fixing it.
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.