Modify the Mini-Triangle lexical grammar (Example 4.21) as follows. Allow identifiers to contain single embedded undersc

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899566
Joined: Mon Aug 02, 2021 8:13 am

Modify the Mini-Triangle lexical grammar (Example 4.21) as follows. Allow identifiers to contain single embedded undersc

Post by answerhappygod »

Modify The Mini Triangle Lexical Grammar Example 4 21 As Follows Allow Identifiers To Contain Single Embedded Undersc 1
Modify The Mini Triangle Lexical Grammar Example 4 21 As Follows Allow Identifiers To Contain Single Embedded Undersc 1 (39.36 KiB) Viewed 632 times
Modify the Mini-Triangle lexical grammar (Example 4.21) as follows. Allow identifiers to contain single embedded underscores, e.g.. set-up (but not 'set-up', nor 'set- . nor .-up'). Allow real-literals, with a decimal point surrounded by digits, e.g., "3.1416' (but not 4., nor *. 125'). Example 4.27 Scanner for Mini-Triangle The lexical grammar of Mini-Triangle is partly given by production rules (1.10) through (1.13). We add production rules for Token and Separator Token Identifier Integer-Literal Operator : : : - |-|(et Identifier Letter identifier Letter | Identifier Digit (4.15) Integer-Literal Digit Integer-Literal Digit (4.16) Operator + 1-1 111<1>1-11 (4.17) Separator Comment space col (4:18) Comment I Graphic col (4.19) In these production rules: space stands for a space character: col stands for an end-of-line *character': eot stands for an end-of-text 'character Visible characters can be expressed as themselves in (E)BNF, but these invisible characters cannot.) Also: Digit stands for one of the digits '0', '1'. .... or '9': Show the updated production rules and modify the Triangle Scanner source code accordingly
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!

This question has been solved and has 3 replies.

You must be registered to view answers and replies in this topic. Registration is free.


Register Login
 
Post Reply