4. When describing the structure of a programming language, we often use the formalisms of regular...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
4. When describing the structure of a programming language, we often use the formalisms of regular languages (to represent legal tokens) and context-free languages (to represent legal structures built up of these tokens). However, the formal machines that recognize these language families (finite-state automata and push-down automata) aren't imme- diately useful for scanning and parsing, respectively. Answer the following questions concerning how these machines are adapted for use in a compiler: (a) (2 points) To start off, the automata are recognizers: they simply say whether a string is in the language or not. What additional actions are needed for the tasks of scanning and parsing? (b) (2 points). A program usually consists of more than one token, and yet a finite-state au- tomaton only recognizes a single string. How can a compiler use a finite state automaton? (c) (2 points) Tokens are often not self-delimiting. For example, the string a 2i could be a single identifier token or could be three tokens (the identifier a followed by the number 2 followed by the identifier i). How is this ambiguity resolved in a compiler? 4. When describing the structure of a programming language, we often use the formalisms of regular languages (to represent legal tokens) and context-free languages (to represent legal structures built up of these tokens). However, the formal machines that recognize these language families (finite-state automata and push-down automata) aren't imme- diately useful for scanning and parsing, respectively. Answer the following questions concerning how these machines are adapted for use in a compiler: (a) (2 points) To start off, the automata are recognizers: they simply say whether a string is in the language or not. What additional actions are needed for the tasks of scanning and parsing? (b) (2 points). A program usually consists of more than one token, and yet a finite-state au- tomaton only recognizes a single string. How can a compiler use a finite state automaton? (c) (2 points) Tokens are often not self-delimiting. For example, the string a 2i could be a single identifier token or could be three tokens (the identifier a followed by the number 2 followed by the identifier i). How is this ambiguity resolved in a compiler?
Expert Answer:
Answer rating: 100% (QA)
a Additional actions needed for scanning and parsing For the task of scanning additional actions are required to identify and categorize tokens within ... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
QUIZ... Let D be a poset and let f : D D be a monotone function. (i) Give the definition of the least pre-fixed point, fix (f), of f. Show that fix (f) is a fixed point of f. [5 marks] (ii) Show that...
-
Data gistrun sending inside a pack fills in as conventional allowing subordinate rules to execute on progressive clock cycles. Correspondence between gatherings conventionally causes a surprising...
-
Match the accounting terminology to the definitions. 1. Sarbanes-Oxley Act 2. Internal control 3. Encryption 4. Separation of duties 5. Internal auditors
-
For each choice of f (t, y) given in parts (a)-(d): i. Does f satisfy a Lipschitz condition on D = {(t, y) | 0 t 1, < y < }? ii. Can Theorem 5.6 be used to show that the initial-value problem y' =...
-
The Stilton Company has the following inventory and credit purchases during the fiscal year ended December 3 1 , 2 0 2 3 . Beginning 5 2 1 units @ $ 8 8 / unit Feb. 1 0 2 6 5 units @ $ 8 5 / unit...
-
Number of classes: 5 Data set: Strengths (in parts per thousands) of 24 acids Construct a frequency distribution and a frequency histogram for the data set using the indicated number of classes....
-
Henderson Window Company was a privately held corporation until January 1, 2011. On January 1, 2011, Cool Glass Company acquired a 70% interest in Henderson at a price well in excess of book value....
-
How can I enhance this statement, to include the following skillsets/professional skills/generic skills, how can i quantify my skills? Throughout my nineteen years of experience providing customer...
-
You are the audit partner at Preston & Associates and are responsible for the audits of the following three independent entities for the year ended 30 June 2020: 1. One of your clients, FFCs...
-
Under which theory set forth by M&M would the value of a company rise as it increased it's use of debt?
-
What is a raincheck at the grocery store? Explain.
-
On a credit card statement what is the suggested payment option to be on-time with their account?
-
John drove his nine-year-old son, Johnny, and the family four wheeler to Larry's farm. Neither John nor Johnny had permission from Larry to be on his farm. John put Johnny on the four wheeler. John...
-
In writing your response, the following points must be addressed fully, a ) Determine the type of fraud committed and describe with examples the symptoms of fraud that are evident in the case study c...
-
Financial markets and intermediaries allow investors and businesses to reduce and reallocate risk. For a Fortune 500sized company provide 3 specific examples of how that reducing and reallocating...
-
Figure displays a 12.0 V battery 3 four uncharged capacitors of capacitances C1 = 4.00F, C2 = 6.00F, and C3 = 3.00F. The switch is thrown to the left side until capacitor 1 is fully charged. Then the...
-
Eliza Perry obtained registration to practice as an aesthetic nurse, and spent the month of July 2024 setting up her business E. Perry, Naturals. Eliza prepared a new statement of financial position...
-
Financial balances for the car hire business of Terry's Wedding Cars on 31 March 2024 are provided below in a table in accounting equation form similar to the chapter illustrations. During April, the...
-
Trans Clothing Alterations began operations on 1 August 2024 and completed the following transactions during the first month. 1. Tran deposited \($18\) 000 of her personal funds in a current account...
Study smarter with the SolutionInn App