COMPSCI 164 Study Guide - Midterm Guide: Video Projector, Regular Expression, Recursive Descent Parser

57 views4 pages
8 Jan 2019
School
Professor

Document Summary

There are 7 questions in the exam on 4 pages. You have 50 minutes to complete this test. The exam is closed book but you may refer to your one page (2-sides) handwritten 8. 5 by 11 inch paper. Please write your answers in the space provided. You may use the backs of the exam pags for scratch space. Final state? yes: [20 points] here is a table describing an automaton with 2 states. Complete writing a recursive descent parsing program parse that returns yes, given a lisp list that constitutes a sentence in l(g2). We give you two useful parts already. (defun parse (tokens)(s)(if (empty tokens) yes )) (defun eat(h) (cond((equal h (car tokens))(pop tokens)) (t (error stuck at ~s tokens)))) ;; sample test: (parse (a a b): [10 points] what is the result of running your tiger lexical analysis program fsl on a file containing this material: if then loop else23 >>>= 45.