1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
pishuonlain [190]
3 years ago
5

1. Write a CFG to generate identifiers (IDs) in the Java Programming Language. An ID in Java is a string of characters consistin

g of letters (upper-level or lower-level), digits, underscore _ , or dollar sign $. It cannot start with a digit.

Computers and Technology
1 answer:
nordsb [41]3 years ago
3 0

Answer:

Explanation:

From the given condition in the question, An ID in Java is a string of characters consisting of letters (upper-level or lower-level), digits, underscore _ , or dollar sign $. It cannot start with a digit. Let C be a sequence of characters consisting of letters (upper-level or lower-level), digits, underscore _ , or dollar sign $ with no restriction on starting character. We can observe that it is the ID except first character. So, ID can be defined as $ followed by C, _ followed by C, digits followed by C and alphabets followed by C. Let N be a digit, and A be an alphabet, we define ID as  follows

S ------> $C / _C   / AC

N ------->0/1/2/3/4/5/6/7/8/9

A -------->a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z

We need to define C also, which is nothing but the string of character consisting of letters (upper-level or lower-level), digits, underscore _ , or dollar sign $. So, C can be defined as

C --------> $C / _C  /  NC  / AC / N / A

Hence our grammar for ID in java is:

S ------> $C / _C   / AC

C --------> $C / _C  /  NC  / AC / N / A

N ------->0/1/2/3/4/5/6/7/8/9

A -------->a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z

In a leftmost derivation, we start with the start symbol and put the value of Non terminal that appers in the leftmost position and move gradually to right.

Here is the leftmost derivation of string $$_1uP

S

$C ...........using S--->$C

$$C ............using C---->$C

$$_C .........using C------->_C

$$_NC ........using C------->NC

$$_1C ........using N----->1

$$_1AC ........using C----->AC

$$_1uC .......using A------>u

$$_1uA ......using C----->A

$$_1uP ........using A----->P

You might be interested in
Which testing is used for a program's individual components functionality testing?
xxMikexx [17]

Functionality testing of a program's constituent components is done via unit testing.

<h3>What is Unit Testing?</h3>
  • Program testing known as "unit testing" involves testing individual software components.
  • When developing an application, unit testing is done on the software product.
  • Unit testing is a software testing technique used in computer programming to evaluate the suitability of individual units of source code—sets of one or more computer program modules along with related control data, usage processes, and operating procedures.
  • The smallest testable components of an application, known as units, are separately and independently examined for appropriate operation as part of the unit testing phase of software development.
  • Software developers and occasionally QA employees use this testing methodology when the software is still in the development stage.

To learn more about Unit Testing, refer to:

brainly.com/question/24964187

#SPJ4

3 0
2 years ago
Processing is handled by the computer’s central processing unit (cpu).​ <br> a. True <br> b. False
zhuklara [117]
It is true, the cpu handles the processing
7 0
4 years ago
Electronic files created on a computer using programs such as word software are considered to be
nika2105 [10]

From the Page Layout tab, click Margins. Select Custom Margins... from the drop-down menu. Selecting Custom Margins...

The Page Setup dialog box will appear.

Adjust the values for each margin, then click OK. The Page Setup dialog box.

The margins of the document will be changed

6 0
4 years ago
How are XY coordinates utilized in construct ?
marshall27 [118]

Answer:

In 2d space we can describe an object's position using 2 values that represent an object's placement on a grid, invisible or not. Typically this is referred to as a 2d coordinate; X and Y. X describes which column the object is in and Y tells what row the object is in. It is pretty much like bingo. A 2d coordinate should look something like these examples: (56,2) or (-1,3). The first number is the X position and tells us how far left or right the position is. The second number is Y and tells us an objects position up and down.

The pixel at the very top left of your screen is always pixel (0,0) - not (1,1). This is because computers always start counting at 0. They think of 0 as being the first position a number can be. This means if your screen is 640 pixels wide, your screen X position will go from 0-639. Any object on screen will have an (x,y) position. and this position can be manipulated by changing these values.

If you subtract from an objects X position it will appear to move left. If you add to it, it will seem as the object is going to the right. Adding to the Y value makes the object go down and subtracting from Y makes it go up.

Just remember: Add to X = right, Subtract from X = left, Add to Y = down, and subtract from Y = Up.

The more you handle (X,Y) coordinates the more second nature this becomes, so don't worry if it seems odd at first.

MOVING AN OBJECT USING VELOCITY

If you simply change an objects position to where you want it to be it will seem as if it is teleporting. Going from (10,10) to (100,100) is a big jump. If you want an object to seem as if it is moving from one place to another then you need to gradually change its position over time. This is an easy process.

In construct 2, a sprite object already has an X and Y position, so all you need to do is create 2 variables, each representing velocity along either the X or Y axis. I normally call them velocityX and velocityY.

Every frame of the game you then add velocity to position. It looks like this below:

notice that I am multiplying velocity by dt. dt stands for Delta Time and tells us how much time has passed since our last frame. Most games will run 60 frames per second, meaning the computer will run the code you made 60 times a second. In this case dt = 0.0166666- or 1/60. Since we want our velocity to be in pixels per second (and not per frame) we multiply velocity by dt. If our velocity was 100 then per frame it would only add 1.6666 to the position of an object. Over the course of a full second the total of the changes will equal 100.

velocity dt frames per second = velocity.

Here is a quick velocity cheat sheet; The velocity of the object is on the left, described using X and Y. The direction the object would be moving as a result is written next to it.

(0,0) - not moving.

(1,0) - moving right.

(-1,0) - moving left.

(0,1) - moving down.

(0,-1) - moving up.

(-1,-1) - moving diagonally up left.

(1,-1) - moving diagonally up right.

(-1,1) - moving diagonally down left.

(1,1) - moving diagonally down right.

Hopefully that wraps it up. Let me know if you have questions.

Introduction to rotation and angles!

6 0
4 years ago
Danny wants to create a web page for her friends dog walking service. Which coding language should she use
expeople1 [14]

Answer:

html js css

Explanation:

7 0
3 years ago
Other questions:
  • Assume you're using a 3 button mouse. to access shortcut menus, you would
    6·2 answers
  • To select all the text in a document, press ____.
    12·2 answers
  • You will extend zyLab3, by adding a Player class and extending the PokemonField class. You will be working with three.java files
    13·1 answer
  • Which of the following is an example of indirect perception checking?
    7·2 answers
  • This type of software works with end users, application software, and computer hardware to handle the majority of technical deta
    12·1 answer
  • Which of the following is not a SQL*Loader file?
    11·1 answer
  • The Many–Hands Problem makes it difficult to determine who should be held accountable for mistakes since:
    7·1 answer
  • Resize vector countDown to have newSize elements. Populate the vector with integers {newSize, newSize - 1, ..., 1}. Ex: If newSi
    6·1 answer
  • Term of The surroundings and conditions of your workplace
    6·1 answer
  • What is another word for: a location in memory that contains a value?
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!