Lab 1 Description

First, You'll need to install:

  1. The Visual Studio Code Code Runner
  2. The Microsoft C/C++ extension for VS Code C/C++ Extension

For the Simple Lexical Analyzer:

We first define our phrase at Phrase and then run Cpp File

For an example phrase like:
int a,b,c;
a=12-(c*b+2);

We'll get an output like below:

Simple_lexical_analyzer.png


For the Bonus Flex Analyzer:

We first install:

  1. Fast Lexical Analyser Generator from Flex

  2. MinGW which is a native Windows port of the GNU Compiler Collection (GCC) from MinGW

Then we navigate to Bonus Flex Analyzer folder our command prompt and enter:

  1. flex lexicalanalyzer.l

  2. gcc lex.yy.c

In the exe file that's generated, we enter our phrase and press enter

We'll get an output like below:
Bonus_flex_analyzer.png