You are on page 1of 13

PROJECT

PRESENTATION
COMPILER CONSTRUCTION

GROUP MEMBERS:
MUHAMMAD TALHA (CSC-17S-115)
ASHIR ALI (CSC-17S-060)
AUSAF IAQUAT (CSC-17S-093)
ANNAS SHAHID (CSC-17S-068)
PROJECT:

”CONVERSION OF
DIGITS INTO
WORDS”
INTRODUCTION:

This project is to make a simple compiler


using “c” language which basically
tokenize the string provided by the user
and then Translate/Compile the input into
string .

The compiler is a system program used to


translate source code into machine codes.
The compiler is called language translator
WHAT IS LEXICAL ANALYZER?

Lexical Analysis is the first phase of compiler also known as scanner. It converts the input
program into a sequence of Tokens.
 

1) Keywords:
Examples- check the input(keywords or numbers)

2) Identifier:
Examples- numbers & digit, the maximum limit of digit is
four.

3) Check the digit limit:


If the digit limit is four or less than four then it will compile.
4) compiation:
Give the output in the words
WHAT IS SYNTAX ANALYZER?

Syntax Analysis or Parsing is


the second phase, i.e. after
lexical analysis. It checks the
syntactical structure of the given
input, i.e. whether the given
input is in the correct syntax (of
the language in which the input
has been written) or not.
LANGUAGE:
for making this Compiler we use JavaScript
language to code the program.

KEY FEATURES OF PROGRAM:


 Takes input from user. (Ask user to enter the
string).
 The lexical scan the string.
 Then the string pass to syntax analyzer, where
it checks the syntax of string and Translate it.
PARSER:
 Visually, the parsing is a process which turns the array:

  javascript
   const tokens = ["sub", "2", "sum", "1", "3", "4"];

  to the following tree:

  ```
    sub
    / \
   2  sum
      /|\
     1 3 4
   ```
PARSER:
  This translated to plain English, means:
 
 num can be any sequence of the number
s between 0 and 9.

   op can be any of `sum`, `sub`, `div`, `
mul`.

 expr can be either a number (i.e. `num`)
 or an operation followed by one or mor
e `expr`s.
OUTPUT
 
PASSWORD
PROGRAM OUTPUT
ENTER THE NUMBER IN
DIGITS:
OUTPUT IN WORDS:
THANK YOU
!

You might also like