>Do any one know of a C compiler that can out output snippets of >machine code, for a wide range of CPU:s ? I'm primarily thinking of >x86, x64, ARM, ARM-thumb.
As much as the suckless community doesn't like it for it's big size and a lot unnecessary crap, GCC might be a good example for this. Taking a look into GCC backends might not be a bad idea, but due to the size and bloatedness of GCC, you are looking towards quite a long read. regards, magnusi 2016-07-23 5:17 GMT+02:00 Daniel V <daniel.vikspo...@gmail.com>: > Ok! > > The latest compiler written in C, and outputs byte code that can run in the > VM. > > Before I let it out there, I have a few things I would like to fix > first, like output of x86 binaries. And I like to split the project to > several projects, so the language, the compiler, and the VM has > separate names, so it's easier to document and talk about. > > Do any one know of a C compiler that can out output snippets of > machine code, for a wide range of CPU:s ? I'm primarily thinking of > x86, x64, ARM, ARM-thumb. > > The thing that is stopping me to make machine code output, is that I > have been to lazy to make the effort, to write a ELF head generator > for the binaries. > > The language is a system language. And It's made to make kernel calls > directly. > > And it compiles fast. It takes somewhere between 10 to 30 instructions > to compile each token, plus the time to read in the text and tokenize > it. > > The syntax is inspired by C, but it's much clearer what type of > machine code it will generate. > > The benefit is probably that is It's super small codebase (in about > 300-500 lines of code for a basic compiler functionality), no extra > library dependencies, easy to understand, easy to extend and compiles > super fast, and easy to combine with whatever you want. It was > originally made as a generic language to change the compiler fast, to > match different instruction set, that you want to use. So it was made > to be a language, that could be changed on the fly when you make new > instructions to a VM or a Soft Core for an FPGA. > > So it's made to save time in development, and give a higher > understanding on what exactly is done. Giving more brain power left, > to solve actual problems. > > SCC looks interesting thou. > > // Daniel V. > > > > 2016-07-23 1:15 GMT+02:00, Quentin Carbonneaux <quen...@c9x.me>: >> On Fri, Jul 22, 2016 at 10:37:54PM +0200, Daniel V wrote: >>> It's not C. It's a new language. The benefit is that you can get a >>> basic understanding of what the compiler does fast. It's next to >>> impossible to hide how it compiles and what type of code it generates. >>> So it could be used for security reasons, with less need for security >>> auditing. >> >> So, a better compiler. As I said, hold on, we're working on it and >> made good progress already. SCC's code is really nice and readable. >> Another good thing about SCC is that the source is public. >> >>> And it generates fast code without optimizing. And it compiles >>> extremely fast. And you can easily change it to fit an other >>> instruction set, CPU or VM. >> >> How fast? Do you have benchmarks of any kind? Also, if you want to >> sell a language to suckless, you better make sure that you can call >> Xlib, and also a good bit of POSIX, is that the case? >> >>> And the language syntax is readable. It's not a esoteric language. >> >> Not esoteric, as in, like C? >> >> Also, why haven't we seen any code yet? Are you trolling the list? >> >> -- >> Quentin >> >> >