Question

In: Computer Science

The application of lexical analysis techniques in text editor You should cover: 1) What is the...


The application of lexical analysis techniques in text editor

You should cover:
1) What is the problem?
2) What is the compiler construction techniques used to solve the problem
3) How to solve the problem using the compiling techniques.

Solutions

Expert Solution

Ans:

1)

What is the Lexical Analysis?

Lexical Analysis is the notably initial phase in the compiler conception. A Lexer uses the transformed source code which is formulated in the structure of sentences. In other words, it assists you to switch a series of letters into a series of tokens. The lexical analyzer separates this syntax into a sequence of tokens. It eliminates additional space or comments recorded in the source code.

Applications that implement lexical analysis are termed as lexical analyzers or lexers. A lexer holds a tokenizer or scanner. If the lexical analyzer recognizes that the token is wrong, it produces an error. It holds character streams from the source code, analyses for proper tokens, and transfer the data to the syntax analyzer when it requires.

Lexical Problems:

A character series that is not likely to scan into any actual token is a lexical error. Significant points concerning the lexical error:

  • Lexical errors are not quite simple, however, it should do controlled by a scanner
  • Misspelling of identifiers, operators, keyword are recognized as lexical errors
  • Usually, a lexical error is produced by the presence of any unauthorized character, essentially at the origin of a token.

Error Recovery in Lexical Analyzer

Here, are several traditional error improvement techniques:

  • Removes one number from the unused input
  • In the crash mode, the serial characters are continuously neglected until we arrive a well-formed token
  • By including the absent character into the unused input
  • Return a character with a different character
  • Transfer two successive characters

2)

compiler construction techniques used to solve the problem

The compiler editor can use amazing functional gadgets that help in performing different phases of a compiler. These techniques help in the production of a whole compiler or its components. Some usually used compiler construction techniques involve:

  • Parser Generator –
    It provides syntax analyzers (parsers) from the input that is based on a grammatical representation of HL language or on a context-free grammar. It is beneficial as the syntax analysis phase is extremely complicated and uses more guidebooks and compilation time.
    Example: PIC etc.
  • Scanner Generator –
    It creates lexical analyzers from the input that contains regular expression information based on tokens of a language. It creates a finite automaton to acknowledge the RE.
    Example: Lex.
  • Syntax directed translation engines –
    It produces standard code with three address form from the input that consists of a parse tree. These engines have routines to cross the parse tree and then give the intermediate code. In this, each node of the parse tree is affiliated with one or more translations.
  • Automatic code generators –
    It makes the machine language for a target machine. Each performance of the intermediate language is changed using a set of commands and then is used as an input by the code generator. A template matching process is used. An intermediate language statement is displaced by its comparable machine language using templates.
  • Data-flow investigation engines –
    It is practiced in code optimization. Data flow analysis is a fundamental frame of the code optimization that collects the data, that is the values that flow from one section of code to different.
  • Compiler construction toolkits –
    It gives an integrated set of methods that aids in creating compiler parts or in the development of different phases of a compiler.

3)

How to solve the problem using the compiling techniques-

  • Assists to recognize token into the symbol table
  • Eliminates white spaces and comments from the source code
  • Correlates error messages with the source code
  • Encourages you to increases the macros if it is located in the source code
  • Scan input characters from the source code

Benefits of Lexical analysis-

  • The lexical analyzer process is used by programs like compilers which can manage the parsed data from a developer's code to generate a compiled binary executable code
  • It is managed by web browsers to format and present a web page with the guidance of parsed data from JavsScript, HTML, CSS
  • An isolated lexical analyzer assists you to create a functional and probably more effective processor for the task

please do not forget to give a thumbs up!!

Have a nice day.


Related Solutions

The application of lexical analysis techniques in information retrieval system You should cover: 1) What is...
The application of lexical analysis techniques in information retrieval system You should cover: 1) What is the problem? 2) What is the compiler construction techniques used to solve the problem 3) How to solve the problem using the compiling techniques.
The application of lexical analysis techniques in spam email detection You should cover: 1) What is...
The application of lexical analysis techniques in spam email detection You should cover: 1) What is the problem? 2) What is the compiler construction techniques used to solve the problem 3) How to solve the problem using the compiling techniques.
The application of syntax analysis techniques in query processing system such as SQL You should cover:...
The application of syntax analysis techniques in query processing system such as SQL You should cover: 1) What is the problem? 2) What is the compiler construction techniques used to solve the problem 3) How to solve the problem using the compiling techniques.
Word Frequencies (Concordance)    1. Use a text editor to create a text file (ex: myPaper.txt)...
Word Frequencies (Concordance)    1. Use a text editor to create a text file (ex: myPaper.txt) It should contain at least 2 paragraphs with around 200 or more words. 2. Write a Python program (HW19.py) that asks the user to provide the name of the text file. Be SURE to check that it exists! Do NOT hard-code the name of the file! Use the entry provided by the user! read from the text file NOTE: (write your program so that...
Python: Word Frequencies (Concordance) 1. Use a text editor to create a text file (ex: myPaper.txt)...
Python: Word Frequencies (Concordance) 1. Use a text editor to create a text file (ex: myPaper.txt) It should contain at least 2 paragraphs with around 200 or more words. 2. Write a Python program (HW19.py) that asks the user to provide the name of the text file. Be SURE to check that it exists! Do NOT hard-code the name of the file! Use the entry provided by the user! read from the text file NOTE: (write your program so that...
For the text editor application of your choice, give examples of how its features help in creating quality web content
  For the text editor application of your choice, give examples of how its features help in creating quality web content a) State which editor you are using Describe a CSS-related feature of this editor and explain how the feature helps in web development Upload a screenshot that illustrates the feature you have chosen b) State which editor you are using. Describe a JavaScript-related feature of this editor and explain how the feature helps in web development Upload a screenshot...
The vi text editor can be a bit challenging to use at first, but once you...
The vi text editor can be a bit challenging to use at first, but once you have familiarized yourself with how it works you will find it an efficient way to create and edit text files in Linux, and UNIX as well. The key thing to remember is that vi has two operational modes: insert mode and command mode. In insert mode, everything you type is entered into your file. You can use the backspace, delete and the arrow keys....
A text editor window should pop up with the following source code (except with your actual name):
  A text editor window should pop up with the following source code (except with your actual name): csci1011.lab8;/**** @author Your Name*/public class Account {} Implement the Account class. Add a public enum called ACCOUNT_TYPE with two values CHECKING, SAVING Add the following private instance variables to the Account class: An instance variable called aType of type Enum ACCOUNT_TYPE. An instance variable called accountOwner of type String. An instance variable called interestRate of type double. An instance variable called balance...
Identify techniques for forecasting financial statements as discussed in the text, and explain when they should...
Identify techniques for forecasting financial statements as discussed in the text, and explain when they should be used.
What are the techniques used for business process analysis? Conduct a SWOT analysis of these techniques?...
What are the techniques used for business process analysis? Conduct a SWOT analysis of these techniques? Which techniques is appropriate for your organisation and why? with reference
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT