Question: 5 . ( 1 0 Points ) Consider a simple markup language L that uses tags ( similar to those in HTML and XML )

5.(10 Points) Consider a simple markup language L that uses tags (similar to those in HTML and XML). To create tags, L supports the following tokens as terminal states: {<,>,/,=, word}. The following list provides the criteria for this language: Every tag begins with < and ends with >. A tag may be an opening tag or a closing tag. Inside an opening tag, the first token that follows < is a word (word) representing the name of the tag. The tag also contains an optional list of attributes, which are pairs of words connected by =(i.e., word = word). In a closing tag, the first token that follows < is /, followed by the name of the tag (again, word). There are no attributes in the closing tag. Every opening tag must be paired with a matching closing tag. Any number of words or tags may appear between an opening tag and a closing tag. Examples of valid inputs for L: < word ></word >< word > word </word >< word >< word word = word > word word word </word ></word >< word word = word word = word ></word >< word > word word < word word = word ></word ></word >< word > word < word word = word > word </word > word </word >< word ></word >< word ></word > Examples of invalid inputs for L: <></>(no presence of word following < in the opening tag and following / in the closing tag)< word >(no matching closing tag)< word word =></word >(incomplete attribute)< word ></word word = word >(closing tag contains attributes)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!