Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program which contains a lexical analyzer for the VSL programming language describe in the document posted on Blackboard. The input to the program
Write a program which contains a lexical analyzer for the VSL programming language describe in the document posted on Blackboard. The input to the program is a VSL program. The output will be a sequence of (lexeme.token) pairs. You are to wire your lexical analyzer using lex or flex, or you can hand code the program with a 'reasonable" programming language (Java. C. Ada. or Python.) How you handle reserved words (like if. while, etc.) is up to you. You can preload the symbol table with them. OR you can have the lexical analyzer hand e them as a special case. For example if your program is: program var N as int; var squareroot as int; begin N: reading; SORT: = 0; % go until squareroot := squareroot N do squareroot + 1; end; squareroot := squareroot - 1;% subtract one squareroot is lessthanorequalto squareroot (N) write Int squareroot end your output would look look something like this; etc. Write a program which contains a lexical analyzer for the VSL programming language describe in the document posted on Blackboard. The input to the program is a VSL program. The output will be a sequence of (lexeme.token) pairs. You are to wire your lexical analyzer using lex or flex, or you can hand code the program with a 'reasonable" programming language (Java. C. Ada. or Python.) How you handle reserved words (like if. while, etc.) is up to you. You can preload the symbol table with them. OR you can have the lexical analyzer hand e them as a special case. For example if your program is: program var N as int; var squareroot as int; begin N: reading; SORT: = 0; % go until squareroot := squareroot N do squareroot + 1; end; squareroot := squareroot - 1;% subtract one squareroot is lessthanorequalto squareroot (N) write Int squareroot end your output would look look something like this; etc
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started