-
Notifications
You must be signed in to change notification settings - Fork 5
/
README
106 lines (56 loc) · 2.85 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*---------------------------------------------------.
| This is the develop branch |
`----------------------------------------------------*
see also https://github.com/huangguiyang/9cc/tree/master for stable codebase.
9cc - a standard C compiler
The compiler is designed to be able to compile itself, so it is written in C. And it is intended to support all C99 language features while keeping the code as simple and small as possible.
Source Roadmap:
---------------
burg The bottom-up tree rewriting generator.
doc Documentation.
include Header files provided by this compiler.
libcpp C Preprocessor.
libutils Common utilities.
HOWTO build:
------------
Make sure you have any Linux distribution installed.
To build the compiler, run command:
make
To build the bootstrap compiler, run command:
make bootstrap
To install the compiler, run command:
make install
Then you can read the man page using command:
man 9cc
To uninstall, run command:
make uninstall
Troubleshooting:
----------------
If your Linux distribution's crt objects (crt1.o, crti.o, crtn.o) are located in '/usr/lib64/' (like Fedora), edit the Makefile and add CFLAGS -DCONFIG_LIB64. The default locatation is '/usr/lib/x86-64-linux-gnu/'. (like Ubuntu)
See 9cc.c for more details.
Caveats:
--------
1. Adding test cases.
License:
--------
9cc - a standard C compiler
Copyright (c) 2015 Guiyang Huang
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Reference:
----------
1. C Standard Draft:
C99: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf
C11: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf
2. "C: A Reference Manual": http://careferencemanual.com
3. X86-64 ABI:
v0.90 (Dec 2, 2003): http://people.freebsd.org/~obrien/amd64-elf-abi.pdf
v0.99.6 (Oct 7, 2013): http://www.x86-64.org/documentation/abi.pdf
4. DWARF Standard: http://dwarfstd.org/
5. "Compilers: Principles, Techniques, and Tools": http://dragonbook.stanford.edu/
6. "Intel 64 and IA-32 Architecture Software Developer Manuals":
http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html
7. Using as: https://sourceware.org/binutils/docs/as/
8. GCC: https://github.com/gcc-mirror/gcc
9. lcc: https://github.com/drh/lcc