Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

C/C++ to Common Lisp Compilation

Name: Anonymous 2013-06-02 12:31

How does one implement protected memory model and POSIX on top of SBCL? Through array of 32bit numbers? CFFI could be used, but compilation to CFFI leads of segfaults, exploits and breaks ability to easily access data of running C/C++ program.

I still want to compile C/C++ code for SED and GREP into Lisp.

Name: Anonymous 2013-06-02 13:43

>>1
you are going to have trouble if there's pointer  arithmetic.

Name: Anonymous 2013-06-02 13:49

>>2
pointers are just integers

Name: Anonymous 2013-06-02 15:47

>>3
YAINT RED DA STANDARD, HAVE U YA FUCKIN STACK BOI?

Name: Anonymous 2013-06-02 19:29

>>3
warning: making pointer from integer

Name: Anonymous 2013-11-18 18:12

%░████▀▀▒▒▒▒▒░░░░▄▄▄▄▒▒▒▀▀███████░░
%░░██▒▒▄▄▒░░░░▒▒▀▒▒▒▒▒▒▒▒▒▒▒▒▀▀██▌░
%░░█▌▄▀▀▒▒▒▒▒▒▒▒▒▄▄▄▄▄▒▒▒▒▒▒▒▌▐▒█▐░
%░░▀▌▒▒▒▄▄▄▒▒▒▒▒▀▄▄█▀▒▒░▒▒▒▒▒▐▒▐▒█░
%░░░▐▒▄▀██▄▀▒▒▒▒▒▒▒░░░░▒▒▒▒▒▒▒▌▌▒█░
%░░░▐▒▒▒▒▒▒▐▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▌▄▀█░
%░░░▐▒▒▒▒▒▒▌▒▒▒▒▀▄░░░▒▒▒▒▒▒▒▒▒▌▐██░
%░░░░▌▒▒▒▒▐▒▒▒▒▄▄▀░░░░▒▒▒▒▒▒▒▒▒▌▒█░
%░░░░▐▒▒▒▒▒▀▀▒▀▒▄▄▄▄░▒▒▒▒▒▒▒▒▒░███░
%░░░░░▌▒▒▒▄█▀▀▀▀▀▀▀▀█▒▒▒▒▒▒▒▒░▀▐██░
%░░░░░▐▒▒▒█▒▀████▀▀▒▐▌▒▒▒▒▒░▄▒▒▐░░░
%░░░░░░▐▒▒▀▒▒▒▒▒▒▒▒▒▒▐▒▒▒▒▄▒▒▒▄▐░░░
%░░░░░░▀▌▒▐▌▐▌▀▌▀▌▀▌▀▌▐▀▀▌▒▐▐▌▌▌▌░░
%░░░░░░░█▒▐▒▐▌▒▌▄▌▐▌▄▒▐▌▄▌▒█▌█▒▒▐░░
%░░░░░░░▐▌▌▒▐▌▒▌▒▒▐▌▒▄▐▌▀▄▒▒▒▒▒▒▒▀▄
%░░░░░░░░▀▒▐▀▀▒▀▒▒▀▀▀▀▒▀▒▀▀▒▒▒▒▒▒▒
%YOU'LL COWARDS DON'T EVEN SMOKE CRACK
%POST lN 3 THREADS OR YOU'LL COWARD

Name: Cudder !MhMRSATORI!fR8duoqGZdD/iE5 2013-11-19 9:08

Trying to translate a lower level language to higher level language is called decompilation, and it won't work 100% because the lower level language is far more expressive, there are things that you just can't do in the higher level one.

That said, it's still possible in many cases to do it. Arbitrary pointer arithmetic is out but if you can associate each pointer with what it points to (and how large that object is) then you can reverse that into array indices. Undefined behaviour like moving a pointer off either end of an object so it points nowhere defined is of course not decompilable.

Also, you'll end up with C-style Lisp, which may not be exactly what you had in mind...

"It's harder to climb than fall."

Don't change these.
Name: Email:
Entire Thread Thread List