Paper Writing Services name begins with a letter, and can be followed by any number of digits, letters or hyphens. The second line has the

Abstract
words and and print out the revised expression. If there are any occurrences of , , , or left in the expression after ts step, an error message should be printed and the processing stopped for ts expression. The next phase of parsing is to recognize various subexpressions in the expression that involve addition and subtraction operators. The

write a python script that is capable of validating the format of an assignment statement in a pretend language as specified below, much like a compiler or interpreter might do. Potential statements to verify will be contained in a file, one per line, where the name of the file is specified as a command line argument. The parsing process will be done incrementally using regular expressions and the intermediate results will be printed out along the way. The format of a statement is described below. The first two lines of the file will define the valid variables that can be used in the expressions in the rest of the file. The first line will consist of the keyword , followed by a space and a comma separated list of names. A valid name begins with a letter, and can be followed by any number of digits, letters or hyphens. The second line has the same format, except the keyword at the beginning of the line is the word You should validate that the format of each of these lines is correct. If not, print an error message and exit the program. Otherwise, make a list of the valid variable names and their types. The remaining lines of the file will represent assignment statements. These can be composed of various operators and operands according to a special format wch has very little to do with actual Python syntax. The first phase of parsing is to find potential operands. An operand can be either a valid variable name from the lists supplied on the first two lines, or a literal integer or real number. A literal integer can have an optional plus or minus sign to start, followed by a series of digits beginning with a non-zero digit, unless the value is 0 itself. A literal real number begins as an integer does, but is then followed by a period, and at least one digit (no multiple zeros). You should replace occurrences of valid integer variable names with the word . You should replace occurrences of valid real variable names with the word . You should replace occurrences of real literals with the word . You should replace occurrences of integer literals with the word . You should print out intermediate versions of an expression string after replacements for each type of operand have occurred. There are seven valid operators: 1) = is the assignment operator, 2) + is for integer or real addition, 3) – is for integer or real subtraction, 4) * is for integer or real multiplication, 5) / is for real division, 6) // is for integer division, and 7) ** for exponentiation. You should replace occurrences of these operators with the corresponding words: , , , , , , and . You should print out intermediate versions of an expression string after replacements for each type of operator have occurred. After having done all of the operand and operator replacements, if there is anytng in the revised expression other than the four words for operand types and the seven words for operator types, an error message should be printed and the processing stopped for ts expression. The next phase of parsing is to recognize various terms in the expression that involve multiplication, division, and exponentiation operators. The definition of an integer term is the following: an or followed by , , or , followed by another or . It is represented by the word . It is also possible for an integer term to begin with the word rather than or . The definition of a real term is the following: a or followed by , , or , followed by another or in the case of multiplication and division, but only by an or for . It is represented by the word . It is also possible for a real term to begin with the word rather than or . You should replace all occurrences of the terms involving multiplication, division, and exponentiation by the appropriate words and and print out the revised expression. If there are any occurrences of , , , or left in the expression after ts step, an error message should be printed and the processing stopped for ts expression. The next phase of parsing is to recognize various subexpressions in the expression that involve addition and subtraction operators. The definition of an integer subexpression is the following: an , or followed by or followed by another , or . It is represented by the word . It is also possible for an integer subexpression to begin with the word rather than , or . The definition of a real subexpression is the following: a , or followed by or followed by another , or . It is represented by the word . It is also possible for a real subexpression to begin with the word rather than , or . You should replace all occurrences of the subexpressions involving addition and subtraction by the appropriate words and and print out the revised expression. If there are any occurrences of or left after ts step, an error message should be printed and the processing stopped for ts expression. It is possible to have one pair of parentheses in an expression for grouping. Before doing a final set of parsing for terms and subexpressions, you should first determine if there is such a pair of parentheses. If there is, then you should first process terms and subexpressions in the string bounded by the parentheses. Then you can do parsing for terms and subexpressions across the entire calculation. The final expression check is to see if a valid statement remains. It takes one of two forms: 1) an followed by followed by an , , or , or 2) a followed by followed by a , , or . If you find such a pattern it should be replaced by the word and the resulting string should be printed out. If there is anytng left in the expression string other than the word , an error message should be printed out. You should process all lines of the file in ts manner, using regular expressions as often as possible. Submit your commented source code here, along with a sample input file of text expressions and the corresponding output generated by the program for these test expressions.

Sample references
  • (‘Jette, DU, Bacon, K, Batty, C, Carlson, M, Ferland, A, Hemingway, RD … & Volk, D. 2003. Evidence-based practice: beliefs, attitudes, knowledge, and behaviors of physical therapists. Physical Therapy, 83: 786-805’,)
  • (‘Costanza, R., W. J. Mitsch, and J. W. Day. 2006. A new vision for New Orleans and the Mississippi delta: Applying ecological economics and ecological engineering. Frontiers in Ecology and the Environment 4(9):465-472.’,)
  • (‘Heinz Center. 2008a. The State of the Nation’s Ecosystems 2008. Washington, DC: Island Press and Heinz III Center for Science, Economics and the Environment.’,)
  • (‘Goulder, L. H. 2004. Induced Technological Change and Climate Policy. Arlington, VA: Pew Center on Global Climate Change.’,)

Need your ASSIGNMENT done? Use our paper writing service to score better and meet your deadline.


Click Here to Make an Order Click Here to Hire a Writer