new head desc
This commit is contained in:
parent
95871ff6bf
commit
bf7061a7df
@ -1,10 +1,11 @@
|
||||
# RVBTCC
|
||||
|
||||
- 约 1900 行的轻量级自举编译器。
|
||||
- 编译器和自举编译器行为一致。
|
||||
不到 2000 行的轻量级自举编译器。
|
||||
|
||||
- 旨在展示如何迅速编写一个自举编译器。
|
||||
- 语法类似 C,输出 RISC-V 汇编。
|
||||
- 依赖几个 libc 函数用于输入输出。
|
||||
- 不使用动态内存分配,嵌入式友好。
|
||||
- 仅依赖几个 glibc 函数用于输入输出。
|
||||
- 仅作学习用途,请勿在生产环境中使用。
|
||||
|
||||
## 用法
|
||||
|
||||
|
15
boot.c
15
boot.c
@ -1,3 +1,14 @@
|
||||
/*
|
||||
* RVBTCC By Yaossg
|
||||
* A lightweight bootstrapping compiler in less than 2000 lines.
|
||||
*
|
||||
* It aims to demonstrate how to write a bootstrapping compiler in no time.
|
||||
* Syntax is similar to C, output is RISC-V assembly.
|
||||
* Only dependent on some glibc functions for I/O.
|
||||
* Purely for educational purposes. Do not use in production.
|
||||
*
|
||||
*/
|
||||
|
||||
// libc dependency
|
||||
|
||||
extern void* stdin;
|
||||
@ -1140,9 +1151,7 @@ int parse_function_call(int id) {
|
||||
|
||||
int parse_primary_expr() {
|
||||
next_token();
|
||||
if (token_type == TOKEN_EOF) {
|
||||
exit(1);
|
||||
} else if (token_type == TOKEN_NUMBER) {
|
||||
if (token_type == TOKEN_NUMBER) {
|
||||
return load_imm(token_data);
|
||||
} else if (token_type == TOKEN_ID) {
|
||||
next_token();
|
||||
|
Loading…
Reference in New Issue
Block a user