CS 441G-001Professor Craig C. DouglasTuesday-Thursday 12:30-1:45 RMB 323
http://www.mgnet.org/~douglas/Classes/cs441g-f05 Please fill out the Survey if you have not done so already.
|
Language DescriptionIntroductionThe F05 language will be similar to standard algorithmic languages, but will not follow any one in particular. You will not have an extensive library for input, output, system calls, or memory allocation. The lexigraphical structure of the language is defined as follows:
Tokens do not cross new lines. If lex cannot produce a string or number, you do not either. An error message is appropriate if you truncate something, however. An underflow (a floating point number that rounds off to 0 instead of whatever it really is in infinite precision arithmetic), however, is not an error, and should be treated as 0. Defining It by ExampleThe easiest way to see what the language really is, is to study one or more examples. Below is an example ... (still under construction) Comments aside, find the bugs and report them to me.
Notes:
Class ExamplesThe class (will) put together a number of simple 5-10 line examples:
The Symbol TableThe symbol table will be a pain in the neck all semester. Just when you think that you have it just right, you will have an inspiration and need a modification or addition. So be really flexible and defensive in designing your symbol table. Start by entering data such as an identifier name, constant value, the scope, and the memory location (if appropriate). Keep all attributes of a name in a separate record. Also, think of a fast way to access the symbol table. My favorite is a combination of hashing the symbols and then using a linked list to get to the right symbol table entry. Your lexer can help. For many tokens, there is the token value (e.g., ICONSTANT) and a token subvalue (e.g., the binary value of the string in yytext) that can be stored in the global variable yylval. You should take advantage of this as often as possible in the early stages of compiling. Finally, our language allows for variable to be redefined inside of blocks. Watch out for the nested loop variables and other equally unsavory variables. Your symbol table must resolve entries correctly so that the right instance of a variable is always used in the right place. The Translation OutputNah... you do not really want me to put the information here yet. It can wait until October. However, you will produce a file that will be included by a C program that I will provide you. |
|
Cheers, Last modified: |