同步操作将从 Gitee 极速下载/MazuCC 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
MazuCC is a minimalist C compiler with x86_64 code generation. It is intended to support partial C99 language features while keeping the code as small and simple as possible.
Run make to build:
$ make
MazuCC comes with unit tests. To run the tests, give "check" as an argument:
$ make check
MazuCC is known to work on both GNU/Linux and macOS.
Use MazuCC to compile C source:
$ ./mzcc < sample/nqueen.c
You will get the generated x86_64 assembly in AT&T syntax. The output can be assembled and linked into a valid executable:
$ ./mzcc < sample/nqueen.c > sample/nqueen.s
$ gcc -no-pie -o sample/nqueen sample/nqueen.s
If MazuCC is compiled and executed on macOS, the above argument -no-pie
should be eliminated.
Reference output of MazuCC-compiled sample/nqueen
:
Q . . . . . . .
. . . . Q . . .
. . . . . . . Q
. . . . . Q . .
. . Q . . . . .
. . . . . . Q .
. Q . . . . . .
. . . Q . . . .
Alternatively, you can dump internal abstract syntax tree:
echo 'struct {int x; char y; struct { int t; } z; } a;' | ./mzcc --dump-ast
The expected output in S-expression form:
(decl (struct (int)
(char)
((struct (int)))) a)
MazuCC is heavily inspired by 8cc.
MazuCC is freely redistributable under the BSD 2 clause license. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。