Stage 1 of the
Flair compiler project
OUT: Friday, August 31
DUE: Friday, September 14
STATUS CHECK DUE: Friday, September 7
This stage consists of one component of your Flair compiler and three auxiliary programs.
Write a scanner for Flair.A scanner is a function or object that takes as input a string or sequence of characters and produces as output a sequence of Flair tokens.
Write a program that uses your scanner to produce a listing of all the tokens in a valid Flair program.Display one token per line. For tokens with semantic content, such as an identifier or a number, display the content, too. For test program print-one.flr, it might generate something like this:
keyword program identifier main leftparen (or "punct leftparen") rightparen (or "punct rightparen") semicolon keyword begin keyword return integer 1 keyword end period (or "punct period")
Write at least one meaningful legal program in Flair.Your test program should be at least at the level of an early CS1 program. If you are stumped for where, try one of these ideas.
Create an executable or a Unix command-line script named flairs that takes the name of a Flair program as an argument and runs your token-listing program on it.For example:
> flairs programs/print-one.flr keyword program identifier main leftparen ...This will be the first in a series of tools that makes up the command-line suite of your Flair compiler.
Submit only one copy of each assignment per team, both electronically and on paper. The team captain or a designated team member can be responsible for the submission.