Question
USING C++ UNIX ENVIRONMENT The process of converting an input file (stream of characters) into an understandable format is called syntax analysis. It is usually
USING C++ UNIX ENVIRONMENT
The process of converting an input file (stream of characters) into an understandable format is called syntax analysis. It is usually divided into two parts. The first, lexical analysis, tokenizes the input via a lexical scanner. The second, parsing, generates an abstract model of the tokens and then generates useful content from that model. You are to write a syntax analyzer using the flex tool for lexical analysis and the bison tool for parsing. The goal of the program is to parse an input file that contains postal addresses and then to output a representation of those addresses in XML. Usage: scanner < infilename (Lexical Scanning Only) parser < infilename (Lexical Scanning and Parsing) Your program may be called with one of two different names (use UNIX symbolic links to create these names).
If your program is called with the name scanner, then it should only provide lexical analysis of the infilename file. In this case, the output should be a list of tokens along with any meta-information about the tokens that may be needed. This should be sent to stdout. If your program is called with the name parser, then it should provide both lexical analysis and parsing of the infilename file. In this case, output will be sent to both stdout and stderr: stdout - should be a set of statements indicating whether the infilename file was successfully processed and should include information about bad addresses. stderr - should be an XML representation of the addresses read from the infilename file. If errors are encountered during the parsing of an address, you should output the best XML possible and ignore the bad information. In parse mode, all work should be performed by the parser. Your C program should only call yyparse() and provide feedback on its return value.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered 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