[Longshu] theoretical exercise (2)

Source: Internet
Author: User

Incorrect. Please note that!

3.3.3: test the number of strings with N length.



3.3.5: Write the formal definitions of the following languages


(1) lowercase strings containing all five vowels.

Nonvowel → [B-DF-HJ-NP-TV-Z]

L → (nonvowel | A) * a (nonvowel | E) * E (nonvowel | I) * I (nonvowel | O) * O (nonvowel | u) * unonvowel *

(2) lowercase string of all letters in ascending order

A * B * C *... y * z *

(3) comment, that is, the string between/* and */, and the string does not contain */that is not in double quotation marks */

Nonquote → Σ -{"}

Quote → "nonquote *"

Star → \*

Nonstarquote Σ -{",\*}

Nonstarslashquote → Σ -{",/,\*}

Comm → quote | nonstarquote | star + (nonstarslashquote | quote)

L →/starcomm * star +/


3. Grammar G: S → ASB | BSA | ABS | bas | SAB | SBA | ε

1) prove that grammar G is a binary Grammar

Evidence: The following two different syntax analysis trees can be provided for AB:


Therefore, this document serves as an example.


(2) What is the language for grammar g recognition?

It is a string of equal numbers of A and B defined on the letter {a, B.


(3) rewrite grammar g to non-Ambiguity grammar G', so that l (G) = L (G ') (too difficult, not required)

S → ABS | bas | ε

A → Baa |

B → ABB | B





[Longshu] theoretical exercise (2)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.