Question

Give a BNF for var names for the following rules: a) a var consists of one...

Give a BNF for var names for the following rules:

a) a var consists of one or more chars

b) every var MUST begin with a char

c) after the first char the name may contain integers or underscores.

0 0
Add a comment Improve this question Transcribed image text
Know the answer?
Add Answer to:
Give a BNF for var names for the following rules: a) a var consists of one...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Augment the following BNF to write an attribute grammar. Assume the only possible variable types are...

    Augment the following BNF to write an attribute grammar. Assume the only possible variable types are integer and float. The language rules are as follows: 1) The types of variables in an expression do not have to be the same. The type of the expression result is that of the first (or leftmost) variable in the expression. 2) If the type of variable to be assigned is integer, the type of the expression must be integer. 3) If the type...

  • Regular Expressions [25%] Identifier names in a hypothetical language may contain letters (A - Z and...

    Regular Expressions [25%] Identifier names in a hypothetical language may contain letters (A - Z and a - z), digits (0 - 9), and special symbols ($, _ , and #). Additionally, any acceptable identifier name must satisfy the following conditions: a) The first character of an identifier name must be a letter or special symbol. b) An identifier name may contain at most two special symbols. c) If an identifier name contains two special symbols, then all characters after...

  • 1. In a language, each sentence is a string starting with a capital letter followed by...

    1. In a language, each sentence is a string starting with a capital letter followed by two or more small letters and ending with three or more digits. Example sentences are Abc001, Zyxw9876 etc. a) Write a BNF grammar for the language. b) Show the derivation and the parse tree of the string Test3501. 2. Augment the following BNF to write an attribute grammar. Assume the only possible variable types are integer and float. The language rules are as follows:...

  • Consider the following language description: its sentences only contain balanced brackets of various kinds: (), {},...

    Consider the following language description: its sentences only contain balanced brackets of various kinds: (), {}, and < > , all may be included. Whether they are one after the other, or nested, they must balance each open with a matching-style close afterwards. Some valid sentences (members of the language): ()<>{} ((())) ((<{}>))(())<>() Some invalid sentences (not members of the language) ( }{ (<)> Write the BNF (production rules) for this language. write a derivation for the sentence "<()>{}".

  • (8) (3 marks) Write BNF grammar rules for a language that is comprised only of sentences described as follows: symbol,...

    (8) (3 marks) Write BNF grammar rules for a language that is comprised only of sentences described as follows: symbol, fol symbols orjust onéx symbol, A sequence of one or more occurrences of an a lowed by either zero or morez followed by a sequence of one or more b symbols. (9) (1 mark) The following fragment of grammar describes the syntax of the exponentiation operator. What is the associativity ot the operator as detined here? factor | expr factor...

  • Lab 2: (one task for Program 5): Declare an array of C-strings to hold course names,...

    Lab 2: (one task for Program 5): Declare an array of C-strings to hold course names, and read in course names from an input file. Then do the output to show each course name that was read in. See Chapter 8 section on "C-Strings", and the section "Arrays of Strings and C-strings", which gives an example related to this lab. Declare the array for course names as a 2-D char array: char courseNames[10] [ 50]; -each row will be a...

  • You are given a file consisting of students’ names in the following form: lastName, firstName middleName....

    You are given a file consisting of students’ names in the following form: lastName, firstName middleName. (Note that a student may not have a middle name.) Write a C++ program that converts each name to the following form: firstName middleName lastName. Your program must read each student’s entire name in a variable and must consist of a function that takes as input a string, consists of a student’s name, and returns the string consisting of the altered name. Use the...

  • . Each of the following names is wrong. Give the correct name for each compound. a....

    . Each of the following names is wrong. Give the correct name for each compound. a. 3-pentene. b. 3-methyl-2-butene. c. 2-ethyl-3-pentyne.

  • 2. The following names are not the correct IUPAC name, but at least one structure can...

    2. The following names are not the correct IUPAC name, but at least one structure can be drawn from the name provided. In each instance: -Draw the structure based on the name provided Give the correct IUPAC name of the molecule you have drawn. a) 5-butyl-2-isopropylheptane b) 1,3,5-methyl-2-ethylcyclohexane c) 1-ethyl-2-bromo-4-tert-butylpentane

  • C++ Write a program that reads students’ names followed by their test scores from the given...

    C++ Write a program that reads students’ names followed by their test scores from the given input file. The program should output to a file, output.txt, each student’s name followed by the test scores and the relevant grade. Student data should be stored in a struct variable of type StudentType, which has four components: studentFName and studentLName of type string, testScore of type int and grade of type char. Suppose that the class has 20 students. Use an array of...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT