Incremental development of Project 3 1. Create package that holds the lex function which was main routine in Project 2. - In parser, call lex and check that output is good. Hint: /dev/tty is the name of the terminal 2. Create object for list of lexemes. - Update lex to place lexemes in that container. - Test; make sure lexemes are placed properly and accessible as expected. 3. Create symbol table and update lex to record declarations (in dec part) - Test; make sure symbol table looks right Print of symbol table should contain symbols and line numbers 4. Update lex to look them up (in program body) - Identifier declared twice in dec section - Identifier already declared in body section when reference is made. Test 5. Write parser - Start with basic program and skeleton set of rules Note: Lexemes are stored for use during parsing. The symbol table is created and accessed during scanning. Minimum test program: program abc dec x:int begin Read(x) end. Productions involved: ============================================ Exceptions - System exceptions can be caught... when follow with action - Users may declare their own exceptions - Use raise to fire them - when still catches them ============================================= Stack Example - StackData is the abstract base class - DataPtr is used to facilitate polymorphism Use of 'null record' abstracts an object that will be made concrete in a subclass. Stack example creates a linked list stack where each node has two pointers. - a link - a pointer to the data, which in this case is handled polymorphically * Data could be integer or string Note: Adjust on the stack is a copy of the entire linked list Freeing node is done by declaring a function as a new Ada.Unchecked_Deallocation( , )