Skip to content

yui0/catc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

catc

This is a simple tiny C Compiler using Lex & Yacc.

Usage

$ dnf install byacc flex
$ make
$ ./catc -S ./test/hello.c
	.section	.rodata
.LC0:
	.string	"Hello! tiny c world!!\n"
	.text
	.align	4
	.global	main
	.type	main,@function
main:
	pushl	%ebp
	movl	%esp,%ebp
	subl	$24,%esp
	movl	%ebx,-4(%ebp)
	lea	.LC0,%eax
	pushl	%eax
	call	printf
	movl	$0,%eax
	jmp	.L1
.L1:	movl	-4(%ebp),%ebx
	leave
	ret
$ ./catc -S ./test/hello.c > ./test/hello.asm
$ as ./test/hello.asm -o ./test/hello.o
$ gcc ./test/hello.o -o ./test/hello
$ ./test/hello
Hello! tiny c world!!
$ ./catc ./test/test01.c
$ ./test/test01
Hello world.
100+23=123

Refrence

About

a simple tiny C Compiler using Lex & Yacc

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published