I wrote a very short program that parses a "program" using python and converts it to assembler, allowing 开发者_如何转开发me to compile my little proramming language to an executable.
You can read my blog for more information here http://spiceycurry.blogspot.com/2010/05/simple-compilable-programming-language.html
my question is... Where can I find more kernel commands so that I can further expand on my script in the above blog?
I'd rather recomment using LLVM:
- It allows you not to bother with low-level details like register allocations (you provide only SSA form)
- It does optimizations for you. It can be faster then the hand-written and well-optimized compiler as the LLVM pipeline in GHC is showing (at the beginning - before much optimalization it had equal or better performance than mature native code generator).
- It is cross-platform - you don't tight yourself to for example x86
I'n not quite sure what you mean by 'kernel' commands. If you mean opcodes:
- There are Intel manuals
- There is Wikipedia page containing all of the documented memnonics (however not the opcodes and not always description)
- There is NASM manual
However the ARM or PowerPC have totally different opcodes.
If you mean the operating systen syscalls (system calls) then:
- You can just use C library. It is in every operating system and is cross platform.
- You can use directly syscalls. However they are harder to use, may be slower (libc may use additional buffering) and are not cross platform (Linux syscalls on x86 - may be not up-to-date).
精彩评论