~yujiri/compiler

986cd919cec9e675439340e6eb1ec5ee49abe5bd — Evin Yulo 8 months ago 0691e6e
add files
3 files changed, 37 insertions(+), 0 deletions(-)

A file
A notes
A syntax
A file => file +5 -0
@@ 0,0 1,5 @@
fn main
	if a:
		if b:
			c
		d

A notes => notes +20 -0
@@ 0,0 1,20 @@
the syscall ID goes in rax
the first param goes in rdi
the second param goes in rsi
the third param goes in rdx

syscall 1 is write
syscall 60 is exit

https://cs.lmu.edu/~ray/notes/gasexamples/
https://www.intel.com/content/dam/develop/external/us/en/documents/introduction-to-x64-assembly-181178.pdf

https://wiki.cdot.senecacollege.ca/wiki/X86_64_Register_and_Instruction_Quick_Start

instructions (objdump -d):
	syscall = 0f 05
	mov = 48 c7
		the 3rd byte is the dest register
			c0 is rax
			c6 is rsi
			c7 is rdi

A syntax => syntax +12 -0
@@ 0,0 1,12 @@
fn main
	if b > 0
		x
	else
		x

	x = if b > 0: x else x

	if
	case1:
	case2: