Production | Semantic Action |
S --> E | Print (E.val) |
E --> E1 + T | E.val = E1.val + T.val |
E --> T | E.val = T. val |
T --> T1 * F | T. val = T1.val * F. val |
T --> F | T. val = F. val |
F --> digit | F. val = digit.lexval |
Production | Semantic Action |
S --> T L | L.in = T.type |
T --> int | T.type = int |
T --> float | T.type = float |
T --> double | T.type = double |
L --> L1, id | L1.in = L.in Enter_type(id.entry, L.in) |
L --> id | Entry _type(id.entry, L.in) |
Operation | Functions |
insert | To insert a name into a table of symbols and return a pointer to its input.
|
lookup | To check for a name and return its input to the pointer
|
free | Removal of all entries and free symbol table storage.
|
allocate | To assign a new empty table of symbols. |
Static Memory Allocation | Dynamic Memory Allocation |
Before program execution, Static Memory Allocation is completed. | During program execution, Dynamic Memory Allocation is performed. |
It is less effective. | It is more powerful. |
At compile time, this memory is allocated to. | At runtime, this memory is assigned to. |
There is no memory re-usability of Static Memory Allocation. | There is memory re-usability in Dynamic Memory Allocation and memory can be freed when not needed. |
In the static allocation of memory, variables are permanently allocated. | Variables are allocated only if the program unit is involved in the dynamic memory allocation. |
Example : Generally, this static memory allocation is used for arrays. | Example : Generally, this dynamic memory allocation is used for the linked list. |