Bootstrapping a compiler: why?

前端 未结 11 1450
花落未央
花落未央 2020-12-01 02:55

I understand how a language can bootstrap itself, but I haven\'t been able to find much reference on why you should consider bootstrapping.

The int

11条回答
  •  伪装坚强ぢ
    2020-12-01 03:18

    There are a couple of reasons you might want to do it (in theory):

    1. Your compiler generates more optimized code than other compilers on the bootstrap platform.
    2. Your compiler generates more correct code than the other compilers on the bootstrap platform.
    3. You're an egotistical jerk who is convinced that one of the above is true even though it's not.
    4. There isn't a compiler available on your platform (this was GCC's original logic, because many platforms didn't have a C compiler back in the day).
    5. You want to prove that your compiler can handle it (this is, after all, actually a pretty good test of a compiler).

提交回复
热议问题