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?
Parsing is not fundamentally different. You still have tokens, labels, syntax etc.
The key difference you may find is that most higher languages support deeply nested expressions which results in deeper syntax trees (think nested loops, anonymous functions etc.).
In assembly, code is generally structured more like a simple list of instructions, one level deep, with a fairly close correspondence to the underlying machine instructions. As a result, you may find it is possible to express the syntax "tree" as a single flattened list.