6-Write a BNF description of the precedence and associativity rules defined for the expressions in Problem 9 - chapter 7 of the textbook . Assume the only operands are the names a,b,c,d, and e.
The BNF description, or BNF Grammar, of the precedence and associativity rules are
[tex]<identifier>\text{ }::=a|b|c|d|e[/tex]
[tex]<operand>\text{ }::=\text{ }NUMBER\text{ }|\text{ }<Identifier>[/tex]
[tex]<factor>\text{ }::=\text{ }<operand>|\text{ }-<operand>|\text{ }(<expression>)[/tex]
[tex]<power>\text{ }:=\text{ }<factor>\text{ }|\text{ }<factor>\text{**} <power>[/tex]
[tex]<term>\text{ }::=\text{ }<power>\text{ }\\|\text{ }<term>*<power>\text{ }\\|\text{ }<term>/<power>\\\\<expression>\text{ }::=\text{ }<term>\text{ }\\|\text{ }<expression>+<term>\text{ }\\|\text{ }<expression>-<term>[/tex]
BNF, or Backus-Naur Form, is a notation for expressing the syntax of languages. It is made up of a set of derivation rules. For each rule, the Left-Hand-Side specifies a nonterminal symbol, while the Right-Hand-side consists of a sequence of either terminal, or nonterminal symbols.
To define precedence in BNF, note that the rules have to be defined so that:
A negation or bracket matches first, as seen in the nonterminal rule for factorA power matches next, as seen in the rule defining a factorA multiplication, or division expression matches next, as seen in the rule defining a termFinally, addition, or subtraction match, as seen in the rule defining an expression.To make sure that the expression is properly grouped, or associativity is taken into account,
Since powers associate to the right (that is, [tex]x \text{**} y\text{**}z=x \text{**} (y\text{**}z)\text{ and not }(x \text{**} y)\text{**}z[/tex]), the rule defining power does this[tex]<power>\text{ }:=\text{ }<factor>\text{ }|\text{ }<factor>\text{**} <power>[/tex]
and not
[tex]<power>\text{ }:=\text{ }<factor>\text{ }|\text{ }<power>\text{**}<factor>[/tex]
Since multiplication/division are left associative (that is, [tex]x \text{*} y\text{*}z=(x \text{*} y)\text{*}z[/tex]), the rule defining a term takes this into account by specifying its recursion on the right of the operators like so;[tex]<term>\text{ }::=\text{ }<power>\text{ }\\|\text{ }<term>*<power>\text{ }\\|\text{ }<term>/<power>[/tex]
Also, addition and subtraction are left associative (that is, [tex]x \text{+} y\text{+}z=(x \text{+} y)\text{+}z[/tex]), the rule defining an expression takes this into account as seen below[tex]<expression>\text{ }::=\text{ }<term>\text{ }\\|\text{ }<expression>+<term>\text{ }\\|\text{ }<expression>-<term>[/tex]
Learn more about BNF grammars here: https://brainly.com/question/13668912
Can someone help me explain Nvm scheduling in operating systems?
Low-power and short-latency memory access is critical to the performance of chip multiprocessor (CMP) system devices, especially to bridge the performance gap between memory and CPU
Which device can perform both input and output functions?
Answer:
For instance, a keyboard or computer mouse is an input device for a computer, while monitors and printers are output devices. Devices for communication between computers, such as modems and network cards, typically perform both input and output operations.
Answer:
Modems and network cards, typically perform both input and output operations
#include
void main()
{
int m=45,first,last;
first=m/10;
last=m%10;
printf("%d",first);//line 1
printf("\n%d",last);//line 2
printf("\nSum=%d",first*last);//line 3
printf("\n%d",first*last);//line 4
printf("\n%d",last*last);//line 5
printf("\nCube=%d",first*first*first);//line 6
}
Select the correct output for line 1 ~
1 point
4
5
0
Answer:
4
Explanation:
45 divided by 10 using integer division is 4
I ran the program, output is below.
Write a recursive function called DigitCount() that takes a positive integer as a parameter and returns the number of digits in the integer. Hint: The number of digits increases by 1 whenever the input number is divided by 10. Ex: If the input is:
Recursive functions are functions that are called from within itself
The recursive function DigitCount() in Python where comments are used to explain each line is as follows:
#This defines the function
def countDigits(n):
#If the integer is less than 10
if n< 10:
#Then the integer has 1 digit
return 1
#Otherwise,
else:
#Count the number of integers
return 1 + countDigits(n / 10)
At the end of the function, the count of integers is returned to the main function
Read more about similar programs at:
https://brainly.com/question/20397067
The major advantage of the Waterfall approach to software development is the _____. Group of answer choices high degree of management control high level of user interaction throughout the process rapid pace of product iterations informality of ongoing evaluation
A major advantage of the waterfall approach in software development life cycle (SDLC) to software development is the: A. high degree of management control.
What is software development life cycle (SDLC)?
Software development life cycle (SDLC) can be defined as a strategic process (methodology) that defines the key steps or stages that are for the creation and implementation of high quality software programs (applications).
The types of models in SDLC:
Generally, there are six (6) types of models in software development life cycle (SDLC) and these are:
Agile ModelV-Shaped ModelIterative ModelSpiral ModelBig Bang ModelWaterfall ModelWhat is a waterfall model?
In SDLC, a waterfall model refers to a process which involves the sequential breakdown of software development into linear stages (steps or phases). Thus, its development stages takes a downward flow like a waterfall and as such, each stage must be completed before starting another and without any overlap in the process.
In conclusion, a major advantage of the waterfall approach in software development life cycle (SDLC) to software development is the high degree of management control because its development stages and there isn't any room for overlap.
Read more on waterfall model here: https://brainly.com/question/18369405
Why do some computer systems not allow users to activate macros?
O Amacro can be used by only one person.
0 You must close all other programs to run a macro.
O The Word software does not work well with macros.
O Macros can carry viruses that can harm a computer.
Write the function void sort2(double* p, double* p) that receives two pointers and sorts the values to which they point. To test the function, write the main function that prompts the user to enter two values and then print out the sorted values. If you call sort2(&x, &y) then x <= y after the call.
The function illustrates the use of pointers.
Pointers are used to store address in programming languages such as C and C++.
The program in C language where comments are used to explain each line is as follows:
#include <stdio.h>
//This defines the function
void sort2(double* p1, double* p2){
//This declares a temporary variable t
double t;
//If p2 is less than p1,
if (*p2 < *p1) {
//The next 3 lines swap their values
t = *p2;
*p2 = *p1;
*p1 = t;
}
//This prints p1
printf("%f ", *(p1));
//This prints p2
printf("%f ", *(p2));
}
//The main method to test the function begins here
int main(){
double x = 23.0;
double y = 14.1;
sort2(&x, &y);
return 0;
}
//The program ends here
Read more about similar programs at:
https://brainly.com/question/15683939
What is ligma? please someone answers ill give the brainliest.
Answer:
Ligma is just a made-up disease, its not real. Tons of people use that word now for a inappropriate joke, don't fall for it!
Explanation:
The sugma and ligma are the rare diseases cause by the bofa family viruses.
What Sugma and Ligma are related?Sugma and Ligma are both diseases and are related to each other where LIGMA is also known as loose internal gene miaasintits and this is the second stage od BOFA which is biologically offset farkowonian asintits and this diseases interferes with the immune system and it increases the risk of having tuberculosis and if in LIGMA a person enter the BOFA stage.
It is considered as last treatable stage and due to highly weakened immune system the people are most likely to die at this stage but still there is one treatment suggested n this case called as LIGMA balls where as SUGMA is the rarest antibiotic strain resistant of LIGMA virus.
The sugma is non lethal but is contagious and can spread very fast and its great prevention is by awareness of BOFA family viruses s sugma strain can be transferred via both verbal and virtual communication and as it is a rare disease.
Therefore, The sugma and ligma are the rare diseases cause by the bofa family viruses.
Learn more about virus on:
https://brainly.com/question/7480851
#SPJ2
Which two are computing devices? (Choose two)
A. Unix
B. Laptop
C. Server
D. Mac OS
Answer:
ANS is no.B and no. C
hope it helps
What is the best data type for traveling day?
Why does a computer need an operating system?
Answer:
An operating system helps it to manage and run its designed duties.
If it lacks an operating system, it wouldn't be able to work
what are the main barriers to the adoption of an industry standard for internet system
Answer:
Industry experts say that although many companies find the potential of the Internet of Things very attractive, they either lack a clear value proposition for end-users or lack interoperability.
Edhesive 4.3 code practice question 2
Please describe how you can use the login page to get the server run two SQL statements. Try the attack to delete a record from the database, and describe your observation.
Project managers have the overall responsibility for planning, executing, and completing a project. (3 points) True False
Can someone pass me Unit 2 Basic Animations from CMU CS ACADEMY, I'll pay you if you pass it to me.
Answer:
i could but it depends on how much pay
Explanation:
Answer:
ii have the awmsers
Explanation:
unit two
# speedX should be -5 and speedY should be -25.
### Fix Your Code Here ###
Circle(350, 350, 50, fill='ghostWhite', border='black')
ballStitches = Oval(350, 350, 50, 95, fill='ghostWhite', borderWidth=3, dashes=True,
border=gradient('red', 'red', 'red', 'ghostWhite'))
gloveThumb = Oval(260, 375, 75, 120, fill='brown', border='black', rotateAngle=25)
glove = Oval(200, 375, 130, 150, fill='brown', border='black')
# This moves the ball to be 250 away from the mouse in the x-position.
ball.centerX = glove.centerX + 250
ball.centerY = mouseY
# Move the ball stitches to where the ball is.
### Place Your Code Here ###
ball=Circle(350, 350, 50, fill='ghostWhite', border='black')
What was the goal of the COMPETES Act of 2007?
Simply put, the goal was, "To invest in innovation through research and development, and to improve the competitiveness of the United States."
Answer:
Increasing federal investment in scientific research to improve U.S. economic competitiveness.
Explanation:
Hope this helps!
Using WEKA software, answer the following questions based on the Phishing dataset provided.
a) Draw a simple confusion matrix (general one, not from WEKA) of the possible data scenarios for this
Phishing dataset. (0.5 Mark)
b) Draw a table that will outline the Accuracy, Precision, Recall, F-Measure, ROC Area of the following
Rules based algorithms; RIPPER (JRip), PART, and Decision Table (2 Marks)
c) Use Decision Trees algorithms (Random Forest, Random Tree) and Artificial Neural Network
(Multilayer Perceptrol) to compare with the results in part b) above. Do you have better prediction
accuracy with these in this dataset? (2 Marks)
d) What is your conclusion in these experiments pertaining to ML algorithms used? (0.5 Mark)
Answer:
This isn’t a difficult question, its a task
Explanation:
Write a program that lists all ways people can line up for a photo (all permutations of a list of strings). The program will read a list of one word names (until -1), and use a recursive method to create and output all possible orderings of those names separated by a comma, one ordering per line.
The solution is the recursive Python 3 function below:
########################################################
def allNamePermutations(listOfNames):
# return all possible permutations of listOfNames
if len(listOfNames) == 0 or len(listOfNames) == 1:
# base case
return [listOfNames]
else:
# recursive step
result_list = [ ]
remaining_items = [ ]
for firstName in listOfNames:
remaining_items = [otherName for otherName in listOfNames if
(otherName != firstName)]
result_list += concat(firstName,
allNamePermutations(remaining_items))
return result_list
#######################################################
How does the above function work?
As with all recursive functions, this one also has a base case, and a recursive step. The base case tests to make sure the function terminates. Then, it directly returns a fixed value. It does not make a recursive call.
In the case of this function, the base case checked listOfNames to see if it was empty or only had one name. If any of the conditions were satisfied, a new list containing listOfNames is returned.
The recursive step is where the function allNamePermutations() calls itself recursively. The recursive step handles the case where listOfNames has more than one item. This step first iterates over each name in listOfNames, and then does the following;
Gets a name in listOfNameGets a list of other names in listOfNamesCalls allNamePermutations() on the list of other names to get a list of permutation of the other names.(By first getting the list of other names before passing it into
allNamePermutations(), we make sure the recursive step eventually
terminates. This is because we are passing a smaller list each time
we make the recursive call.)
Inserts the current name in front of each permutationAdds the results to the result list to be returned laterAfter the iteration, it returns the result list which will now contain all permutations of the names in the list.
The concat function is defined below
##################################################
def concat(name, listOfNameLists):
# insert name in front of every list in listOfNameLists
result_list = [ ]
for nameList in listOfNameLists:
nameList.insert(0, name)
result_list.append(nameList)
return result_list
#####################################################
If we run the sample test case below
####################################
name_list = ['Adam', 'Barbara', 'Celine']
allNamePermutations(name_list)
####################################
the following output is produced
[['Adam', 'Barbara', 'Celine'],
['Adam', 'Celine', 'Barbara'],
['Barbara', 'Adam', 'Celine'],
['Barbara', 'Celine', 'Adam'],
['Celine', 'Adam', 'Barbara'],
['Celine', 'Barbara', 'Adam']]
For another example of how to use recursion in Python, see the following example in the link below
https://brainly.com/question/17229221
Which one of the following is small and portable?
• Server
• Notebook
• Mainframe
• Desktop
Answer:
server is small and portable
A large company pays its salespeople on a commission basis. The salespeople receive $900 per week, plus 8.75 percent of their gross sales for that week. For example, a salesperson who sells $10000 worth of merchandise in a week receives $900 plus 8.75 percent of $10000, or a total of $1775. You have been supplied with a list of the products sold by each salesperson. The values of these products are as follows:
Item Value
1 100
2 200
3 300
4 400
Develop a script that inputs one salesperson’s items sold for last week, calculates the salesperson’s earnings and outputs HTML5 text that displays the salesperson’s earnings.
Answer:
Explanation:
Which invention made it possible to have an entire computer for a single circuit board
Answer:
ok lang
Explanation:
A programmer will typically write a(n) _____ and pass it to the interpreter. Group of answer choices object method variable script
Answer:
Script
Explanation:
A set of code blocks which is written to solve a particular problem in a certain programming language and passed to the interpreter to run is called a script.
The script is program's body which is made up of codes written in accordance to the syntax of a certain programming language. In other to execute the program written, it has to be passed to the interpreter, which run the script and produces an output.Hence, the set of code written by a programmer is called the script.
Learn more :https://brainly.com/question/14364607
An engine that creates ignites fuel with highly compressed air.
Explanation:
An engine that creates ignites fuel with highly compressed air. air engine
In which wireless configuration type do nodes communicate directly with each other, rather than with an access point?
1)802.11b
2)Mesh network
3)Ad-hoc
4)2.4Ghz
Ad-hoc
Explanation:
In which wireless configuration type do nodes communicate directly with each other, rather than with an access point? In an AD-HOC network, all nodes communicate and transmit directly to each other.
Consider the following class. public class ClassicClass { private static int count = 0; private int num; public ClassicClass() { count++; num = count; } public String toString() { return count + " " + num; } } What is printed when the following code in the main method of another class is run? ClassicClass a = new ClassicClass(); ClassicClass b = new ClassicClass(); ClassicClass c = new ClassicClass(); System.out.println(a + ", " + b + ", " + c);
The the code in the main method is run, it will print
"3 1, 3 2, 3 3"
The static/class field count stores the number of instances of the class created. count is always incremented when the instance constructor is called.
The instance field num acts like an identifier/serial number for the instance created. When the constructor is called, the current count is stored in the num field of the instance.
Each instance's toString( ) method will output the total count (from count) and the serial of the instance (from num).
When the code runs in the main method, it creates three instances (making count==3), so that we have
a = {count: 3, num: 1}b = {count: 3, num: 2}c = {count: 3, num: 3}and implicitly calls toString( ) in the println method for each of the three instances to produce the following output
"3 1, 3 2, 3 3"
Learn more about programs here: https://brainly.com/question/22909010
Without proper synchronization, which is possible, a deadlock, corrupted data, neither or both? Give reasons for your answer.
need answer pls
Without proper synchronization, corrupted data is possible due to the fact that a shared datum can be accessible by multiple processes.
Data synchronization simply means the idea of keeping multiple copies of dataset in coherence with one another in order to maintain data integrity. It's the process of having the same data in two or more locations.
Without proper synchronization, corrupted data is possible because a shared datum could be accessed by multiple processes without mutual exclusive access.
Read related link on:
https://brainly.com/question/25640052
Fill in the blank with the correct response.
_____is considered a reliable source of free and trial software.
When you create a _____ query, the value the user enters in the dialog box determines which records the query displays in the results. a. parameter
When a parameter query is created, the value entered in a dialog box by an end user determines the record that would be displayed in the results.
A query refers to a computational request for data (information) that are saved either in a database table, from existing queries, or from a combination of both a database table and existing queries.
Basically, there are four (4) main types of query and these include:
Select query.Action query.Aggregate query.Parameter query.A parameter query is designed and developed to display a dialog box that prompts an end user for data or field criteria, which determines the record that would be displayed in the results.
Read more: https://brainly.com/question/23388493