Wednesday 23 February 2022

Installing and Running Lex or Flex Program in Ubuntu

FLEX (Fast Lexical Analyzer Generator)

This post will show you how to run Lex and Yacc programs easily on Ubuntu 12.04 18.04 and 21.04

Lex is a computer program that generates lexical analyzers and was written by Mike Lesk and Eric Schmidt. Lex reads an input stream specifying the lexical analyzer and outputs source code implementing the lex in the C programming language. l, or if the file is named -, lex reads the description from standard input (standard input). It produces a set of tables that, together with additional prototype code from /etc/yylex. c, constitute a lexical analyzer to scan those expressions.
 
I have assumed that you have a working Ubuntu 12.04 LTS version installed on your system and the computer is connected to the network i.e, internet.

Ubuntu does not come installed with a lex and yacc compiler to do so install it first by
1. Opening the terminal- Short cut Ctrl + Alt + T here T is Terminal
2. sudo apt-get install flex
3. enter your ubuntu password

After installation of flex is completed then

4. sudo apt-get install bison
5. Enter your password.

Successfully  Lex and Yacc have been installed on your system.

Running a Lex and Yacc program        
        
1. Write the lex program in a file and save it as file.l (where file is the name of the file).
2. Open the terminal and navigate to the directory where you have saved the file.l  (e.x cd Desktop)
3. Type  lex filename.l
4. Then type  cc lex.yy.c -lfl
5. Finally type  ./a.out
 
Your lex progam will be running now (comment should be correct).
or compiling lex and yacc together
 
1. write lex program in a file file.l and yacc in a file file.y
2. open the terminal and navigate to the directory where you have saved the files.
3. Type lex filename.l
4. Type yacc filename.y
5. Type cc lex.yy.c y.tab.h -lfl

6. Finally Type ./a.out

 
 
Simple Program
%%

"+" {printf("PLUS ");}
%%
int main(int argc, int argv)
{
yylex();
}

 
 
Step 1: Open Terminal Type cd Desktop
Start Program by typing gedit filename.l here it's gedit xyz.l
Write the program 
 
Step 2: For compiling use flex filename.l here l is lex code its is understood by the machine-->compiler
Here it's $flex xyz.l 
 
Step 3: After compiling  use this $cc lex.yy.c -lfl 
Here cc is C Compiler, lex.yy is The lex command stores the yylex function in a file named lex. yy. c. You can use the yylex function alone to recognize simple one-word input, or you can use it with other C language programs to perform more difficult input analysis functions.
  1. Use the lex program to change the specification file into a C language program. The resulting program is in the lex.yy.c file.
  2. Use the cc command with the -ll flag to compile and link the program with a library of lex subroutines. The resulting executable program is in the a.out file.
  3. lfl: First, FLEX reads a specification of a scanner either from an input file *.lex, or from standard input, and it generates as output a C source file lex.yy.c. Then, lex.yy.c is compiled and linked with the "-lfl" library to produce an executable a.out. Finally, a.out analyzes its input stream and transforms it into a sequence of tokens.
  4. Background Process:   
  1. After it is compiled through flex filename.l internally it generates a file called lex.yy.x the after we type $ cc lex.yy.c -lfl it generates a.out.

Thursday 14 October 2021

udemy.com - PHP Object Oriented Programming Login Sys

 udemy.com - PHP Object Oriented Programming Build a Login System (by BrutalStorm)

PHP is a server-side scripting language, mainly used for web development but also used as a general-purpose programming language. Object-Oriented Programming (PHP OOP), is a type of programming language principle added to php5, that helps in building complex, reusable web applications.

Click to Download

Node JS Training and Fundamentals Training

 Node JS Training and Fundamentals

Node.js is an open-source, cross-platform, back-end JavaScript runtime environment that runs on the V8 engine and executes JavaScript code outside a web browser.

Click to Download

Friday 18 June 2021

Running a Freelance Design Business

Tuts+ Premium - Running a Freelance Design Business How to Charge Premium Prices and Write Winning Proposals. When you're just starting out as a freelancer, it can be difficult to know how to set your prices
Click to Download

Monday 7 June 2021

PRESETATION BY: TEJAS KAVITAKE DANIEL AKU YIRANG. - ppt download

PRESETATION BY: TEJAS KAVITAKE DANIEL AKU YIRANG. - ppt download: i/p & o/p relation in color recipe prediction Target color 16 inputs Surface spectral reflectance White Black Green 1 Red 1 Green 2 Violet Red 2 Yellow 1 Yellow 2 Blue 10 outputs Color recipe prediction system

PRESETATION BY: TEJAS KAVITAKE DANIEL AKU YIRANG. - ppt download

PRESETATION BY: TEJAS KAVITAKE DANIEL AKU YIRANG. - ppt download: i/p & o/p relation in color recipe prediction Target color 16 inputs Surface spectral reflectance White Black Green 1 Red 1 Green 2 Violet Red 2 Yellow 1 Yellow 2 Blue 10 outputs Color recipe prediction system

Saturday 5 June 2021

SAP

SAP ERP is an enterprise resource planning software developed by the German company SAP SE. SAP ERP incorporates the key business functions of an organization. The latest version of SAP ERP was made available in 2006. SAP - ABAP4 in 24 days SAP BASIS_TABC1011 R3 Administration SAP MM-Functionality and Technical Configuration Complete E-Book [PowerBook] SAP 4.6 Basic Skills Self-Study The Ultimate SAP Training Course Click to Download

VMWare Certified Professional Series

CBT.Nuggets.VMware.Certified.Professional.on.vSphere.4-iNKiSO by CBT Nuggets Click to Download