Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Consider a natural language called Nihonglish with the vocabulary of English but a different grammar. - The grammar of Nihonglish does not have have prepositions
Consider a natural language called Nihonglish with the vocabulary of English but a different grammar. - The grammar of Nihonglish does not have have prepositions or prepositional phrases. Instead, it has postpositions and postpositional phrases. - The topic of the sentence (often times the subject), has its own post-position: "as for" - the verb comes at the end. The English sentence: I am going home. is rendered in Nihonglish as: I as for home to going. And the question Are you going to the store? is rendered in Nihonglish as: You as for store to going? or more succinctly: Store to going? Our subset of Nihonglish has these non-terminals: and these grammatical rules: 1. S> PPL going period 2. S PPL going question_mark 3. PPLPP 4. PPL PP PP 5. PPT as for 6. Ti (The English 1st person pronoun " I ") 7. T> you 8. PPL to 9. L> home 10.L store 1. (30 Points) Make the table for the bottom-up parser for the grammar above. (s is the starting symbol.) a. Compute the states b. Compute the parse table Let us get started! 1. Add a new starting non-terminal: 0. AS$ 1.S PPL going period 2.S PPL going question_mark 3. PPL PP 4. PPL PP PP 5. PPT as for 6. Ti (The English 1st person pronoun " I ") 7. T you 8. PPL to 9. L home 10. L store 2. Add the bookmarker at the very beginning of the new first production for State 0: \begin{tabular}{|l|} \hline State 0: \\ \hline \hline A>S$ \\ \hline \end{tabular} 3 Comnute the clocure of State 0 . 4. Figure out actions (i.e. subsequent states): 4. Figure out actions (i.e. subsequent states): Note: These two productions start the same way: 1. S PPL going period 2.S PPL going question_mark And so do these two: 3. PPL PP 4. PPLPPPP Therefore, let us go to the same state for both productions. We will distinguish between the 2 alternatives as we see more input. 5. Start state 1: \begin{tabular}{|l||} \hline State 1: \\ \hlineL> store \\ \hline \end{tabular} 6. Compute the closure of State 1 (nothing else), and figure out actions: LstoreReducebyp10. 7. You continue from here
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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