Monday, March 16, 2020

Typography and Keyword End Essay Example

Typography and Keyword End Essay Example Typography and Keyword End Essay Typography and Keyword End Essay Exercise 1 Give a BNF grammar for each of the languages below. For example, a correct answer for the set of all strings consisting of zero or more concatenated copies of the string ab would be this grammar: ab I There are often many correct answers. a. The set of all strings consisting of zero or more as. b. The set of all strings consisting of an uppercase letter followed by zero or more additional characters, each of which is either an uppercase letter or one of the digits O through 9. c. The set of all strings consisting of one or more as. The set of all strings consisting of one or more digits. (Each digit is one of the characters O through 9. ) e. The set of all strings consisting of zero or more as with a semicolon after each one. f. The set of all strings consisting of the keynuord begin, followed by zero or more statements with a semicolon after each one, followed by the keyword end. Use the non-terminal for statements, and do not give productions for it. g. The set of all st rings consisting of one or more as with a semicolon after each ne. h. The set of all strings consisting of the keyword begin, followed by one or more statements with a semicolon after each one, followed by the keyword end. Use the non-terminal for statements, and do not give productions for it. i. The set of all strings consisting of one or more as, with a comma between each a and the next. (There should be no comma before the first or after the last. ) J. The set of all strings consisting of an open bracket (the symbol 0 followed by a list of one or more digits eparated by commas, followed by a closing bracket (the symbol l). . The set of all strings consisting of zero or more as, with a comma between each a and the next. (There should be no comma before the first or after the last. ) l. The set of all strings consisting of an open bracket (the symbol 0 followed by a list of zero or more digits separated by commas, followed by a closing bracket (the symbol l). Exercise 2 Give an EBNF grammar for each of the languages of Exercise 1 . Use the EBNF exten sions wherever possible to simplify the grammars. A few more metasymbols can be added to BNF to help with common patterns of language definition. For example, C, and ) might be added: 1. [something] in the right- hand side of a production means that the something inside is optional. 2. { something } in the right-hand side of a production means that the something inside can be repeated any number of times (zero or more). 3. Parentheses are used to group things on the right-hand side so that l, 0, and 0 can be used in the same production unambiguously. Typography and Keyword End By akosipaw