Found 213 Articles for Computer Programming

What is Heap Allocation?

Ginni
Updated on 08-Nov-2021 11:02:15

11K+ Views

Heap allocation is the most flexible allocation scheme. Allocation and deallocation of memory can be done at any time and any place depending upon the user's requirement. Heap allocation is used to allocate memory to the variables dynamically and when the variables are no more used then claim it back.Heap management is specialized in data structure theory. There is generally some time and space overhead associated with heap manager. For efficiency reasons, it may be useful to handle small activation records of a particular size as a special case, as follows −For each size of interest, keep the linked list ... Read More

What is Stack Allocation?

Ginni
Updated on 08-Nov-2021 10:59:34

14K+ Views

The stack allocation is a runtime storage management technique. The activation records are pushed and popped as activations begin and end respectively.Storage for the locals in each call of the procedure is contained in the activation record for that call. Thus, locals are bound to fresh storage in each activation, because a new activation record is pushed onto the stack when the call is made.It can be determined the size of the variables at a run time & hence local variables can have different storage locations & different values during various activations. Suppose that the registered top marks the top ... Read More

What is Static Allocation?

Ginni
Updated on 08-Nov-2021 10:58:18

5K+ Views

It is the simplest allocation scheme in which allocation of data objects is done at compile time because the size of every data item can be determined by the compiler. The main function of static allocation is to bind data items to a particular memory location. The static memory allocation procedure consists of determining the size of the instruction and data space.Recursive Subprogram and Arrays of adjustable length are not permitted in a language. In static allocation, the compiler can decide the amount of storage needed by each data object. Thus, it becomes easy for a compiler to find the ... Read More

Describe the issues in a programming language design that affects storage management?

Ginni
Updated on 08-Nov-2021 10:56:30

448 Views

There are various issues in programming language design that affect the utilization of storage by a running program. There are several elements to which storage must be allocated to execute the object program. Storage space is majorly required for object programs and user-defined data structures, variables, and constants. There is also a need for storage space for procedure linkage information, temporaries required for expression evaluation, and parameter passing.There are the different ways in which various programming languages arrange space for object program are −Static storage allocation− It is the simplest allocation scheme in which allocation of data objects is done ... Read More

What is factors which affect the implementation of programming language?

Ginni
Updated on 08-Nov-2021 10:52:55

361 Views

Some factors affect the implementation of programming languages which are as follows −Scope − The scope of a declaration is that portion of a program where that declaration is applied. The implementation mechanism may be different for different languages. Scope rules for each language determine how to go from the declaration of the name. The usage of a name in a procedure is local if it is within the scope of a declaration within that procedure otherwise the usage is non-local. According to the scope of variables in a particular language, storage management is implemented.Lifetime of variable− The lifetime of ... Read More

What is role of Run-time Storage Management in compiler design?

Ginni
Updated on 08-Nov-2021 10:50:13

2K+ Views

The compiler demands a block of memory for the operating system. The compiler utilizes this block of memory executing the compiled program. This block of memory is called storage management. One of the important tasks that a compiler must perform is to allocate the resources of the target machine to represent the data objects that are being manipulated by the source program.A compiler must decide the runtime representation of the data objects in the source program. In the source program, runtime representations of the data objects, such as integers and real variables, usually take the form of equivalent data objects ... Read More

What is two array representations in the symbol table?

Ginni
Updated on 08-Nov-2021 10:49:46

310 Views

Symbol Table is a data structure that supports an effective and efficient way of storing information about various names appearing in the source program. These names are used in the source code to identify the different program elements, like a variable, constants, procedures, and the labels of statements.The symbol table is searched each time a name is encountered in the source text. When a new name or new data about an existing name is found, the content of the symbol table modifies.Therefore, the symbol table must have an efficient mechanism for accessing the data held in the table also for ... Read More

Constructing LALR (1) Parsing table for a given grammar.Problem− Construct LALR (1) Parsing table for the grammar.S → A a|b A c|dc|bdaA → dParse input string "bdc" using LALR Parsing Table.

Ginni
Updated on 08-Nov-2021 10:46:40

6K+ Views

SolutionThe first number the production as below −Step1− Construct Augmented Grammar(0) S′ → S(1) S → A a(2) S → b A c(3) S → d c(4) S → b d a(5) A → dStep2− Find Closure & goto. Find the canonical set of LR (1) items for the Grammar.In the states, I0 to I10, no states have a similar first element or core. So, we cannot merge the states. Some states will be taken for building the LALR parsing table.LALR Parsing TableParsing of String "bdc"StackInput StringAction$ 0bdc $Shift 3$ 0 b 3dc $Shift 7$ 0 b 3 d 7c ... Read More

Verifying whether the string id * id + id is accepted by a given grammar using SLR parsingConsider the SLR parsing table for the GrammarE → E + TE → TT → T ∗ FT → FF → (E)F → idCheck whether the string id * id + id is accepted or not by using the SLR parsing table constructed in the example.

Ginni
Updated on 08-Nov-2021 10:36:36

2K+ Views

SolutionInitially, LR Parser in state 0.Put $ at the end of the string, i.e., id * id + id $.StackInput StringReason0id ∗ id + idAction [0, id] = s5 ∴ Shift id and state 50 id 5∗ id + id $Action [5, ∗] = r6. ∴ Reduce by F → id. goto(0, F) = 30 F 3∗ id + id $Action [3, ∗] = r4, Reduce by T → F goto(0, T) = 20 T 2∗ id + id $Action [2, ∗] = s7, shift ∗, 70T2*7id + id $Action [7, id] = s5, shift id, 50T2*7 id 5+id $Action ... Read More

What is the difference between DFA and NFA in compiler design?

Ginni
Updated on 08-Nov-2021 10:23:06

2K+ Views

Deterministic Finite Automata (DFA)Deterministic means that on each input there is one and only one state to which the automata can have the transition from its current state. In deterministic finite automata, the head can move only in one direction to scan the input tape symbols. But in the case of two-way, finite automata on scanning an input symbol the head of the tape may move in right or left from its current position.There are two ways to represent Deterministic finite Automata −Transition DiagramIt is a directed graph or flow chart having states and edges. A strong path through a ... Read More

Advertisements