程序代写代做代考 Project 2

Project 2
P3
The LAC language
It consists
A virtual machine, named VM, which will be an array of integers;
A table of symbols, named LAC, which will be an array of integers;
A data stack, named data_stack, which will be a stack LIFO of integers;
A return stack, named return_stack, which will be a stack LIFO of integers;
A stack of types, named type_stack, which will be a LIFO stack of integers;
All these objects will be managed by an execution program, called run which can operate in interpreted mode and compiled mode.

P4
The stack type was defined as follows:

So essentially two possibilities pop (which is depilating) and push (which stacks).

P5
The calculate function performs the lexical, syntactic and evaluation analysis of the expression, puts the resultant value 6 on the (data_stack) and on the stack of types (type_stack), the type corresponding to an integer.
The function . , unpacks the stack of data and the stack of types, and prints the result.

P6 arbres:树
P7
In the tree, we actually go:
Once on the leaves;
Twice on unary operators;
Three times on binary operators.
Depending on the reading time, the previous tree can be read:
1 Notation infixed
– (1-2) + (3-4) x (-5)
2 Prefix notation
+ – – 1 2 x – 3 4 -5 read as
(+ (- (- 1 2)) (x (- 3 4) -5))
3 Postfix notation

P9
To do this session
Program the calculate function;
Integrate it with the lexical analyzer of the previous week, to run the LAC command
We will therefore produce files calculate.h and calculate.c;
A main file capable of interpreting the command above.

/docProps/thumbnail.jpeg