First, You'll need to install:
- The Visual Studio Code Code Runner
- 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:
For the Bonus Flex Analyzer:
We first install:
-
Fast Lexical Analyser Generator from Flex
-
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:
-
flex lexicalanalyzer.l
-
gcc lex.yy.c
In the exe file that's generated, we enter our phrase and press enter