How do C self-hosts itself? -
anyone knows complete chain of operations .c
source code executable .exe
?
i've downloaded source of gcc,and found c-parser.y
written in c:
extdef: fndef | datadef | asm_keyword '(' expr ')' ';' { strip_nops ($3); if ((tree_code ($3) == addr_expr && tree_code (tree_operand ($3, 0)) == string_cst) || tree_code ($3) == string_cst) assemble_asm ($3); else error ("argument of `asm' not constant string"); } | extension extdef { pedantic = $<itype>1; } ;
so knows complete story of c's self-hosting?
update
i know how compilers scripts written,most of them depends on c compilers.
so i'm asking how c compiler works.
gcc has multi-stage process, starts working c compiler (which might or might not version of gcc).
- use other c compiler create first version of gcc - gnu c compiler.
- this gives working copy of new version of gcc (assuming old compiler serviceable).
- it not, however, identical compiler (the new version of) gcc produce, except implausible accident.
- use first version of gcc create second version of gcc.
- the second version of gcc (obviously) code gcc generate. benchmark version.
- however, has not yet been shown stable.
- use second version of gcc create third version of gcc.
- the second version of gcc should produce same output third version of gcc.
- ensure second , third versions of gcc same.
- on platforms, object files contain compilation times; clearly, compilation time has discount differences in compilation time.
- assuming second , third versions 'the same', know gcc can produce own source code.
- it safe use new version of gcc build various runtime libraries, , other compilers in family.
- build other parts of gnu compiler collection new c compiler.
- most people not restrict gnu compiler collection c compiler.
- typically, produce c++ , java (and objective c) compilers too.
- and need standard c++ library support too.
- usually, c compiler uses c library provide platform.
Comments
Post a Comment