Skip to content

『低レイヤを知りたい人のためのCコンパイラ作成入門』をM1 Mac上でRustで追ってみる

License

Notifications You must be signed in to change notification settings

pocket7878/compiler-book-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

compiler-book-rs

『低レイヤを知りたい人のためのCコンパイラ作成入門』 をM1 Mac上でRustで追ってみる

Sample

int a;
int *b;
int c[10][10];

int main()
{
	int d;
	a = 10;
	b = &d;
	*b = 10;
	int e[2][3];
	e[1][2] = 2;
	c[9][9] = 10;
	// Line comment
	/*
	 * Block comment
	 */
	/* Inline block comment */printf("hello, world\n");//Inline line comment
	return a + *b + c[9][9] + d + e[1][2];
}
$ cargo run -- sample.c > sample.s
$ cc -o sample sample.s
$ ./sample
hello, world
$ echo $?
42

About

『低レイヤを知りたい人のためのCコンパイラ作成入門』をM1 Mac上でRustで追ってみる

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published