In school we learned about the ARC assembly language. It was used in the book "Principles of Computer Architecture" by Miles Murdocca to teach Computer Architecture. An ARC Programm looks like this:
!
! A simple ARC program to add two numbers
!
.begin
.org 2048
main: ld [x], %r1 ! load x into %r1
ld [y], %r2 ! load y into %r2
addcc %r1, %r2, %r3 ! %r3 <- %r1 + %r2
st %r3, [z] ! store %r3 into z
halt ! halt simulator
jmpl %r15+4, %r0 ! standard return
x: 15
y: 9
z: 0
.end
I want to hand write a parser for the language but struggle to apply my basic knowledge about parsers to an assembly language. For example I can't wrap my hand around the abstract syntax tree of an assembly program.
Can someone point out the differences in parsing high-level languages and an assembly language or assembly code?