From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Given Subject: Re: SDCC porting feasibility study, part 1: the assembler Date: Mon, 27 Feb 2012 18:52:02 +0000 Message-ID: <4F4BD0D2.7030005@cowlark.com> References: <20120227100515.GE27951@vega.lgb.hu> <4F4BA549.10506@jodybruchon.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigF1047615AE9C1C36E5EA8BCE" Return-path: In-Reply-To: Sender: linux-8086-owner@vger.kernel.org List-ID: To: "ELKS (linux-8086)" This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigF1047615AE9C1C36E5EA8BCE Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Brad Normand wrote: [...] > What scares me there is writing a whole toolchain isn't trivial. In > college, I took a class where we wrote the most basic of basic > compilers in java (using a nice grammar parsing library), reading in a > simplified ALGOL and targeting mips and doing no optimization or real > register allocation at all. I've been doing stuff with compilers for years (ask me about my C to Perl compiler!), and this is so true. C compilation is painful. Doing C compilation *well* is a life's work. You *seriously* don't want to write one from scratch. If you want to do an 8086 C compiler, I'd strongly recommend looking at LLVM --- it's apparently got a really nice backend model, although the documentation isn't brilliant. Better still, it may be possible to start with the excellent 386 backend and cut it down, which should be a much easier job than building one from scratch. Other compiler backends I know about: - gcc: unspeakable. - Sparse: the engine behind the Linux kernel linter, which I used for the above C to scripting engine compiler. It's not really intended as a code generator but actually does a reasonable job. - vbcc: I did a Z-machine backend for this; it's got a very nice architecture, and is simple to work with and produces reasonable code, but has a painful source-available-but-not-open-source license. - the ACK: has the advantage of being a complete turnkey toolchain and compiler, including assembler, linker, librarian, libc, etc, *and* it already supports the 8086, but doesn't produce great code and is tough to work on. - tcc: very very very fast. Produces very very very crap code. It started life as an IOCCC entry, and boy does it show. Then there's TenDRA, which I've never had anything to do with but which seems to have vanished. And there are C and C++ parsing libraries like Elkhound which I've tried to look at but have been unable to get started with. --=20 =E2=94=8C=E2=94=80=E2=94=80=E2=94=80 =EF=BD=84=EF=BD=87=EF=BC=A0=EF=BD=83= =EF=BD=8F=EF=BD=97=EF=BD=8C=EF=BD=81=EF=BD=92=EF=BD=8B=EF=BC=8E=EF=BD=83=EF= =BD=8F=EF=BD=8D =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80 http://www.= cowlark.com =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80 =E2=94=82 "I have always wished for my computer to be as easy to use as m= y =E2=94=82 telephone; my wish has come true because I can no longer figure= out =E2=94=82 how to use my telephone." --- Bjarne Stroustrup --------------enigF1047615AE9C1C36E5EA8BCE Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk9L0NYACgkQf9E0noFvlzjm1ACfc3AyoBJ9gRzup64aUy6+ycfS /m8An3Fj6Tf0Oc70xTFf/zh4d2k+c5jQ =azYG -----END PGP SIGNATURE----- --------------enigF1047615AE9C1C36E5EA8BCE--