Final Flashcards
Where is the first parameter on the stack held?
[EBP+8]
Where is the return @ held on the stack
[Ebp+4]
Where is saved ebp on the stack?
[ebp]
Where is the 1st local variable on the stack?
[ebp-4]
What needs to surround each sub program in a function?
Push ebp
Mov ebp,esp
…..
Pop ebp
Rey
Local variables on the stack are stored…
In order
Parameters in stack are stored in…
Reverse order
Pushing an element is…
Decrease ESP by 4
Popping an element is…
Increase by 4
When translating from C to Nasm, if there is a local variable, in addition to the code surrounding the sub program you must…
Sub esp (the amount of local variables)
….
Add ESP, (the amount of local variables)
Return @ main, saved ebp appears only after….
The parameters on the stack
After each function on the stack, the stack pushes…
Return @ main,
Saved ebp
The big picture of running code
(High level code) Compiler > (assembly code) assembler > (machine code) linker > machine code exec) loader > the program runs!
What does the compiler do?
Takes in source code and scans and parses the code to them generate machine code
The scanner identifies correct words using:
Regular expressions
The parser identifies correct sentences by using
Context-free grammar
Elipson?
Empty pattern
a?
One occurrence of a
Ab?
Strings with pattern a followed.by pattern b
A|b
Strings with pattern a or pattern b
A*?
Zero or more occurrences of a
A+?
One or more occurrences of pattern a
A? ?
(A| elipson)
What does NFA stand for?
Non deterministic finite automata
This is different than a deterministic finite automata because you can use elipson to better organize the flow graph so that less edges are needed