Solution:
There are two parts to create language:
1. Lexeme specification:
defines groups of characters that represent a single syntactic
construct like token or terminal value
2. Grammar specification:
defines the valid combinations of syntactic
constructs/tokens/terminal values that make up non-terminal values
that express how the language can be used in level
start ::= list
| list NEWLINE
.
list ::= entry
| list entry
.
entry ::= STRING NEWLINE
| STRING NEWLINE INDENT
list DEDENT
.
Sample if-statement:
x = true
if x:
print("x is true")
else:
print("x is false")
Python uses indention in its program structures. How do you define the syntax of a language...
Explain, or define, briefly but completely: a. If you are told that a language L is finite, what category(ies) is the language in? Why? b. State – carefully, completely -- the Church-Turing Thesis c. If you have an NDFA for L, how do you construct an NFA for L*? Describe in general but perhaps also illustrate with an example. d. If L = a*b*(ab)* what is PREFIX(L) = {x: x is a prefix of some string in L}? e. Define:...
Suppose you can make a program in python (or other language) how would you estimate area of the star inside a square(Not entire code but general approach) Couls you use the same approach in 3D, for example for estimating the volume of a sphere inside cube with edge = 1cm
Describe how you would create a Python program that calculates the exact amount of change to give a customer in denominations of quarters, dimes, nickels, and pennies. For example, if the change is 79 cents, how many of each coin would be needed to give change?
( Python Program) explain how Input/Output data files work in a Python program, and how you would use a loop to process input and/or output. Define the differences in a field, record and file, and define what an exception is.
1. program to use with number 1. 2. Comparing Python and Java Discussion Forum 14 days ago Use the Python IDLE editor to create the source code for the "numberguess.py" pro- gram. This program is in the "Basic Python Pro- gramming" chapter in its "An Example Python Program: Guessing a Number" section. If you mistakenly create syntax errors, find and fix them. Run the program and test it with various values. Refer to the "numberguess.py Program document to see example...
Programming Language : Python Question a) Are there any programming framework for this language? If yes, where and how do you get them (URL) ? b) What is (are) the program development environments (s) available for this language? and what is provided in each program development environment?
1. What is the structure of a relational database? How do you implement a simple relational database in Python and what are some of the benefits? 2. What is the purpose of the “self” argument in the method definitions of a class 3.What does operator-overloading mean in Python? Give an example. 4.Describe the meaning of polymorphism in Object Oriented Programming. Give an example of polymorphism and how it works when the program is executing. 5.What is inheritance in object-oriented design?...
Language: Python Create a program that determines how quickly an object is traveling when it hits the ground. The user will enter the height from which the object is dropped in meters (m). Because the object is dropped its initial speed is 0m/s. Assume that the acceleration due to gravity is 9.8m/s. You can use the formula vf =v^2i + 2ad to compute the final speed, vf, acceleration, a, and distance, d, are known.
python language Problem Description: In this program we are going to explore a list or an array of integers using Python. Your program should read a set of integers from the user and store them in a list. Read numbers from the user until the user enters 0 to quit. Then store them in a list. Your program should them compute the sum of all the numbers in the list and output to the user. You will use lists and...
Search the Web for an example of a structured program in Python. Share the link to the example and describe how it works. Why do we use structured programming in Python?