- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 213 Articles for Computer Programming
1K+ Views
Regular expressions are an important notation for defining patterns. Each pattern connects a set of strings. Therefore regular expressions will give as names for sets of strings.It supports an appropriate and useful notation for describing tokens. Regular Expressions define the language accepted by finite Automata (Transition Diagram).Regular Expressions are defined over an alphabet $\sum$.If R is a Regular Expression, therefore L(R) represents language denoted by the regular expression.Language − It is a collection of strings over some fixed alphabet. The empty string can be indicated by ε.Example − If L (Language) = set of strings of 0’s & 1’s of ... Read More
9K+ Views
Lexical Analysis can be designed using Transition Diagrams.Finite Automata (Transition Diagram) − A Directed Graph or flowchart used to recognize token.The transition Diagram has two parts −States − It is represented by circles.Edges − States are connected by Edges Arrows.Example − Draw Transition Diagram for "if" keyword.To recognize Token ("if"), Lexical Analysis has to read also the next character after "f". Depending upon the next character, it will judge whether the "if" keyword or something else is.So, Blank space after "if" determines that "If" is a keyword."*" on Final State 3 means Retract, i.e., control will again come to previous ... Read More
36K+ Views
Lexical Analysis has to access secondary memory each time to identify tokens. It is time-consuming and costly. So, the input strings are stored into a buffer and then scanned by Lexical Analysis.Lexical Analysis scans input string from left to right one character at a time to identify tokens. It uses two pointers to scan tokens −Begin Pointer (bptr) − It points to the beginning of the string to be read.Look Ahead Pointer (lptr) − It moves ahead to search for the end of the token.Example − For statement int a, b;Both pointers start at the beginning of the string, which ... Read More
1K+ Views
Lexical Analysis is the first step of the compiler which reads the source code one character at a time and transforms it into an array of tokens.Token − The token is a meaningful collection of characters in a program. These tokens can be keywords including do, if, while etc. and identifiers including x, num, count, etc. and operator symbols including >, >=, +, etc., and punctuation symbols including parenthesis or commas. The output of the lexical analyzer phase passes to the next phase called syntax analyzer or parser.Example − A statement a = b + 5 will have the tokens.Role ... Read More
7K+ Views
A compiler is a computer program that converts source code written in a computer language (the source language) into another computer language (the target language, providing having a binary form referred to as object code). The best reason for inadequate to convert source code is to create an executable code.The compiler is generally used for programs that translate source code from a high-level programming language to a lower-level language (e.g., assembly language or machine code). A program that translates from a low-level language to a higher level one is a decompiler.A program that translates between high-level languages is generally known ... Read More
8K+ Views
It is an approach for making a self-compiling compiler that is a compiler written in the source programming language that it determine to compile. A bootstrap compiler can compile the compiler and thus you can use this compiled compiler to compile everything else and the future versions of itself.Uses of BootstrappingThere are various uses of bootstrapping which are as follows −It can allow new programming languages and compilers to be developed starting from actual ones.It allows new features to be combined with a programming language and its compiler.It also allows new optimizations to be added to compilers.It allows languages and ... Read More
2K+ Views
Macro-ProcessorsMany assembly languages support a “macro” facility whereby a macro statement will translate into a sequence of assembly language statements and possibly other macro statements before being translated into a machine program. Therefore, a macro facility is a text replacement capability.It can illustrate the utility of macros, consider a situation in which a machine does not have a single machine or assembly language statement that adds the contents of one memory address to another as hypothetical assembly instruction ADD X, Y. Instead, suppose the machine has an instruction LOAD, which moves a datum from memory to a register, an instruction ... Read More
4K+ Views
Detection and reporting of errors in the source program is the main function of the compiler. An error can occur at any phase of compilation. A good compiler must determine the line number of the program exactly, where the errors have occurred. Various errors that can occur at a different level of compilation are as follows −The first of these are lexical (scanner) errors − Some of the most common types here consist of illegal or unrecognized characters, mainly, caused by typing errors. A common way for this to happen is for the programmer to type a character that is ... Read More
3K+ Views
Imperative LanguagesImperative languages are those which facilitate the computation by mean of state changes. By a state, it means the condition of a computer’s random access memory (RAM) or storage. It is helpful to think of computer memory as a sequence of snapshots, each one capturing the values in all memory cells at a particular time. Each snapshot records a state.When a program is entered, associated data exists in a certain condition, say an unsorted list off-line. It is the programmer’s job to specify a sequence of changes to the store that will produce the desired final state, perhaps a ... Read More
8K+ Views
Procedural LanguagesProcedural languages are command-driven or statement-oriented languages. A program includes a sequence of statements, and the implementation of each statement generates the interpreter to modify the value of one or more areas in its memory that enters a new state.The format of procedural languages arestatement1;statement2;C, Pascal, FORTRAN, and equivalent languages are procedural languages. Each statement in the language communicates the computer to do something. A program in a procedural language is a list of instructions. For very small programs, no other arranging principle is required. Such language includes a sequence of procedures that execute when called. Each procedure includes ... Read More