Explaining The Significance Of Activation Record English Language Essay

Published: Last Edited:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

The register stack top points to the end of the machine status field in the activation records It is based on the idea of a control stack. Storage is organized as stack, and activation records are pushed and popped as activations begin and end respectivelyStorage for the locals in each call of a procedure is contained in the activation record for that call. Thus locals are bounds to fresh storage in each activation, because a new activation record is pushed on to the stack when a call is made.The values of locals are deleted when the activation ends. ie., the values are lost because the storage for locals disappears when the activation record is popped.Activation tree,Calling Sequences:

A call sequence allocates an activation records and enters information into its fields. A return sequences and activation records differ, even for the same language.The code in the calling sequence is often divided between the calling procedure and the procedure it calls.There is no exact division of run time tasks between the caller and the callee..This position is known to the Caller, So it can be made responsible for setting up stack top before control flows to the called procedure.This code for the callee can access its temporaries and the local data using offsets from stack top.The call sequence is:Caller: Evaluates actual

Stores return address & old values of top-SPIncrements top-SP Callee: Saves register values & other status information. Initializes local data & begins execution.

The return sequence is Callee: Places return value next to callers Activation Record.

Restores top-SP & other registers. Branches to return address.

Caller: Copies returned value into its own Activation Record.

Limitations of Stack allocation:

a)Values of locals cannot be retained when activation ends.

b)A called activation cannot outlive the caller.

Information needed by a single execution of a procedure is managed using a contiguous block of storage called activation record.

An activation record is allocated when a procedure is entered, and it is de-allocated when that procedure exited.

Size of each field can be determined at compile time (Although actual location of the activation record is determined at run-time).

Except that if the procedure has a local variable and its size depends on a parameter, its size is determined at the run time.

Differentiate between syntax tree and dag.

ANS2:- Tree::DAG_Node is a class to build generic trees. This is opposed to some specialized trees, such as HTML::trees or XML::Trees. Strictly speaking, as the name suggests, DAG_Node is not a tree, but a node. However, since trees are recursive structures, each node contains a subtree. The DAG_Node class has all the methods to deal with individual nodes or with the whole tree. As my first programming book said, and the module author wants to stress, a program is made of algorithms plus data structures (N. Wirth, 1978). When these two elements are combined together in an object, the result is a powerful engine.

Coming back to our DAG_Node, it is a quite rich module, having a large collection of methods to manipulate both nodes and trees. There are no specialized methods related to the node data, such as the ones of HTML::Element. This lack of specialization doesn't prevent DAG_Node from being a powerful tool even without any addition.

Syntax Tree

Parse trees are in-memory representation of the program. Similarly, abstract syntax trees are in memory representation of the program, focusing on the program function rather than on the syntax. TinyPascal utilizes trees as an intermediate step between parsing and code generation. In this way, the parsing step is separated from the code generation step, which allows an easy modification of the one or the other. It is simple to add another code generation module independent of other parsing modules.

As a consequence of using the Spirit parser framework, the abstract syntax tree is generated during the parsing step. The Spirit provides a function that takes the grammar, checks the syntax and generates the abstract syntax tree. Upon successful parsing, abstract syntax tree is generated as an array of arrays, utilizing STL’s (Standard Template Library) vector data structure. However, the Spirit differentiates the parse tree and the abstract syntax tree generation. The Spirit documentation states that the underlying logic behind the parse tree and abstract syntax tree generation is similar. In addition, Spirit allows parts of the tree to be generated using the parse tree policy, while other parts can be generated using the abstract syntax tree policy. Such mix-and-match functionality of the Spirit framework allows the user to tailor the abstract syntax tree generation according to their needs.

It is important to stress the difference between the AST (abstract syntax tree) and the PT (parse tree) generation. According to the Spirit documentation, parse tree generation simply creates a node for each rule that is parsed. For each sub-rule, the parse tree algorithm simply creates a sub-node. The AST generation is somewhat different. If a node that is generated contains only a single sub-node, no new level is created. The rule to create the node is simply “overlooked” and the sub-node is generated to be the new node. In this way, if we have any number of rules that contains only a single sub-node, only two nodes are generated: the first and the last. However, such feature is not enough for AST generation. Following paragraph explains additional features necessary for successful AST generation.

What are dangling references?

ANS 3:-method of dangling reference detection and garbage collection of VHDL objects within a program includes the steps of providing an Access Value having an Object Reference pointing to an Allocated Object and having and an Access Count pointer pointing to an integer object named Access Count which models a shared access count for the access values. The method sets the Object Reference and the Access Count pointer to null when constructing a new access value and enables an assignment of a negative Access Count to the shared access count when de-allocating a pointer to the Allocated Object. The method also maintains an exact count of a number of pointers pointing to the Allocated Object.