Question

Context Free Grammar for the language of C++ identifiers consisting of uppercase and lowercase letters, digits,...

Context Free Grammar for the language of C++ identifiers consisting of uppercase and lowercase letters, digits, and the underscore character ‘_’, and starting with a letter or underscore

Homework Answers

Answer #1

C++ is not a context-free language. It is context-sensitive.C++ has syntax and semantics.The syntax is a set of rules or grammar .and semantics refers to the meaning.

C++ has a set of naming conventions

1. It should not begin with a digit or an underscore: int 4d; is invalid

2. Uppercase and Lower case is different: int a; and int A; are both considered as different in C++.

3. Special characters are not allowed: int c#a; this kind of naming is not allowed

4.keywords are not allowed: int struct; such kind is invalid because struct is a keyword used for the structure.

5. White spaces are not allowed: int new Delhi; is invalid.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Please make a Context Free Grammar (CFG) for the regular languages below: The language that is...
Please make a Context Free Grammar (CFG) for the regular languages below: The language that is in C++ and containing lowercase and upper case letters, and also can have digits, and can also contain the underscore character '_', and it must begin with an underscore or a letter.
Consider the following grammar. Nonterminals are lowercase and terminals are uppercase. s -> c A c...
Consider the following grammar. Nonterminals are lowercase and terminals are uppercase. s -> c A c -> c B | B Which of the following sentences is in the language generated by the grammar? a) BAA b) BBBA c) BBAAAAA d) none of the above
Give a right-linear grammar to generate each of the following: (a) All identifiers of lowercase letters...
Give a right-linear grammar to generate each of the following: (a) All identifiers of lowercase letters that either begin or end in a (or both). (b) The set of all integers and real numbers in decimal notation. No leading zeros should be generated and real numbers must have at least one digit on both sides of the decimal point. For instance, 3, +3, -3, 0, +0, -0, 0.00328, -100.46, and +100.000 are in the language, but 100., +, -, 003...
If you use a randomly chosen 4 character password (comprising of all the lowercase, uppercase letters...
If you use a randomly chosen 4 character password (comprising of all the lowercase, uppercase letters and digits 0 to 9), say “Xp9m” how many maximum guesses are required by a computer to guess this password? Compare the strength of this password with an 8 character password instead (say “Cm8Rz0pQ”) ? Show the simple math that is underlying the calculation. Do you agree with the statement “ An 8 letter password is around two times more secure than a 4...
For the given language descriptions below, write a context-free grammar. Assume that your alphabet is ∑...
For the given language descriptions below, write a context-free grammar. Assume that your alphabet is ∑ = {?, ?, ?}, define a grammar that generates a string cmanbanck, where ‘m’, ‘k’, and ‘n’ represents the amount of a character. Assume that m, k ≥ n and m, k, n ≥ 0.
Use C language fist one to check if is lowercase,and second one to conver it to...
Use C language fist one to check if is lowercase,and second one to conver it to uppercase. Use ASCII table. boolean islowcase(char n) void strupper(char c)
Write a BNF grammar for a new language called 4040. It should include the following rules:...
Write a BNF grammar for a new language called 4040. It should include the following rules: Variable definitions should start with var. There must be only single space after var. Variable names should come after the var and single space. Variable names should start with a letter or underscore(_). Starting with a digit is not allowed. Variable names can have digits after the first letter. There can be multiple variable names separated by comma. Between variables, spaces are allowed. There...
A license plate is to consist of 3 digits followed by 5 uppercase letters. Determine the...
A license plate is to consist of 3 digits followed by 5 uppercase letters. Determine the number of different license plates possible if the first and second digits must be? odd, and repetition is not permitted. Choose the correcrt answer below. A. 707 comma 266 comma 560 comma 000 B. 7 comma 893 comma 760 C. 1 comma 262 comma 976 comma 000 D. 63 comma 653 comma 990 comma 400 comma 000
Use C language    bool isupper(char c): This function returns true if the character in c is...
Use C language    bool isupper(char c): This function returns true if the character in c is an uppercase character between A and Z (inclusive). Note that the C standard library function isupper() both accepts and returns an int, not char or bool, but the behavior is equivalent.     void strlower(char str[]): Change all uppercase ASCII characters in the C string str to their lowercase equivalents. For example, A would become a, and G would become g. All other characters in...
prove that the language L over {c,d,e} is not context free. (using pumping lemma for context...
prove that the language L over {c,d,e} is not context free. (using pumping lemma for context free languages) L= {w ∈ {c,d,e}* : number of c's, number of d's, and number of e's have a common factor greater than 1}
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT