News for hackers. Stuff that matters.
Re:An Incremental Approach to Compiler Construction by rarestblog on Sunday June 06, 2010 @10:39AM (#1408523)
I'm assuming most compilers don't ship nasm/masm/whatever with them. How do compilers do actual "assembly to executable" step?
Re:An Incremental Approach to Compiler Construction by kmavm on Sunday June 06, 2010 @10:56AM (#1408550)
Historically, C compilers really did run an assembler in a separate process and communicate with it via pipes or files. gcc still ships with gas. gas is more oriented to the needs of a compiler than to human writers of assembly code.

Some compilers emit machine code from their own low-level intermediate representation, though. The trade-offs are similar to any other build/buy technical decision: full-custom gives you more control, while forcing you to reinvent the wheel.

Re:An Incremental Approach to Compiler Construction by wingo on Sunday June 06, 2010 @11:11AM (#1408567)
One can assemble directly in your language of choice. See http://code.weinholt.se/industria/ for a particularly terse example: 1300 lines for an x86 assembler.

Link to source: http://bazaar.launchpad.net/~weinholt/scheme-libraries/indus...