Description
As discussed earlier, I have got some cash now. Please submit the answers for assignment One so I can review and release your payment. I need it earlier.
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.
Explanation & Answer
There you...
Completion Status:
100%
Review
Review
Anonymous
I was struggling with this subject, and this helped me a ton!
Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4
24/7 Homework Help
Stuck on a homework question? Our verified tutors can answer all questions, from basic math to advanced rocket science!
Most Popular Content
MAT 205 UArizona Global Wk 1 Quantitative Explorations in Everyday Life Discussion
Discussion
From MAT205
Prior to beginning work on this discussion, read Chapter 2: Approaches to Problem Solv ...
MAT 205 UArizona Global Wk 1 Quantitative Explorations in Everyday Life Discussion
Discussion
From MAT205
Prior to beginning work on this discussion, read Chapter 2: Approaches to Problem Solving and Chapter 3: Numbers in the Real World in your course text.
Week 1 Discussion Problems
Your instructor will assign you to one of the three groups: Group A, Group B, or Group C. Your instructor will also assign you a number. Do the problem based on the number assigned to you by your instructor. Then, respond to at least three different peers from your own group.
The actual group discussion will function the same as any other discussion. You will only be able to participate and discuss with those peers assigned to your same group.
In order to view your peers’ work and respond to their posts, you need to submit your completed work by Friday (Day 4). You will not be able to view your group’s posts until after you have replied with your completed problem. Also, re-submissions are not allowed in this class.
Your initial post should be at least 250 words in length. It should show all the required math work and explain all the steps. Also include a simple reference for any used resource. For example: Washington Post dated August 13, 2018 or retrieved from .
68. Competition speed skydivers have reached record speeds of 614 miles per hour. At this speed, how many feet would you fail every second?
CMSC 430 Project 2
Could someone help me fix the code below in cgywin64 to correct the errors in bold at the bottom Below is the description ...
CMSC 430 Project 2
Could someone help me fix the code below in cgywin64 to correct the errors in bold at the bottom Below is the description of the question, followed by the codes, and the errors in bold. Thank you so much for the help. Please modify the given code instead of making a new one.Description:The question involves modifying the syntactic analyzer for the attached compiler by adding to the existing grammar. The full grammar of the language is shown below. The highlighted portions of the grammar show what you must either modify or add to the existing grammar.function: function_header {variable} body function_header: FUNCTION IDENTIFIER [parameters] RETURNS type ; variable: IDENTIFIER : type IS statement parameters: parameter {, parameter} parameter: IDENTIFIER : type type: INTEGER | REAL | BOOLEAN body: BEGIN statement END ; statement: expression ; | REDUCE operator {statement} ENDREDUCE ; | IF expression THEN statement ELSE statement ENDIF ; | CASE expression IS {case} OTHERS ARROW statement ENDCASE ; operator: ADDOP | MULOP case: WHEN INT_LITERAL ARROW statement expression: ( expression ) | expression binary_operator expression | NOTOP expression | INT_LITERAL | REAL_LITERAL | BOOL_LITERAL | IDENTIFIER binary_operator: ADDOP | MULOP | REMOP | EXPOP | RELOP | ANDOP |OROPIn the above grammar, the red symbols are nonterminals, the blue symbols are terminals and the black punctuation are EBNF metasymbols. The braces denote repetition 0 or more times and the brackets denote optional. You must rewrite the grammar to eliminate the EBNF brace and bracket metasymbols and to incorporate the significance of parentheses, operator precedence and associativity for all operators. Among arithmetic operators the exponentiation operator has highest precedence following by the multiplying operators and then the adding operators. All relational operators have the same precedence. Among the binary logical operators, and has higher precedence than or. Of the categories of operators, the unary logical operator has highest precedence, the arithmetic operators have next highest precedence, followed by the relational operators and finally the binary logical operators. All operators except the exponentiation operator are left associative. The directives to specify precedence and associativity, such as %prec and %left, may not be used Your parser should be able to correctly parse any syntactically correct program without any problem. You must modify the syntactic analyzer to detect and recover from additional syntax errors using the semicolon as the synchronization token. To accomplish detecting additional errors an error production must be added to the function header, another to the variable declaration and a final one to the when clause of the case statement. Your bison input file should not produce any shift/reduce or reduce/reduce errors. Eliminating them can be difficult so the best strategy is not introduce any. That is best achieved by making small incremental additions to the grammar and ensuring that no addition introduces any such errors. An example of compilation listing output containing syntax errors is shown below: 1 -- Multiple errors 2 3 function main a integer returns real; Syntax Error, Unexpected INTEGER, expecting ':' 4 b: integer is * 2; Syntax Error, Unexpected MULOP 5 c: real is 6.0; 6 begin 7 if a > c then 8 b 3.0; Syntax Error, Unexpected REAL_LITERAL, expecting ';' 9 else 10 b = 4.; 11 endif; 12 ; Syntax Error, Unexpected ';', expecting END Lexical Errors 0 Syntax Errors 4 Semantic Errors 0 listing.cc:// This file contains the bodies of the functions that produces the compilation// listing#include <cstdio>#include <string>using namespace std;#include "listing.h"static int lineNumber;static string error = "";static int totalErrors = 0;static void displayErrors();void firstLine(){lineNumber = 1;printf("\n%4d ",lineNumber);}void nextLine(){displayErrors();lineNumber++;printf("%4d ",lineNumber);}int lastLine(){printf("\r");displayErrors();printf(" \n");return totalErrors;} void appendError(ErrorCategories errorCategory, string message){string messages[] = { "Lexical Error, Invalid Character ", "", "Semantic Error, ", "Semantic Error, Duplicate Identifier: ", "Semantic Error, Undeclared " };error = messages[errorCategory] + message;totalErrors++;}void displayErrors(){if (error != "") printf("%s\n", error.c_str());error = "";}listing.h:// This file contains the function prototypes for the functions that produce the // compilation listingenum ErrorCategories {LEXICAL, SYNTAX, GENERAL_SEMANTIC, DUPLICATE_IDENTIFIER,UNDECLARED};void firstLine();void nextLine();int lastLine();void appendError(ErrorCategories errorCategory, string message);makefile:compile: scanner.o parser.o listing.og++ -o compile scanner.o parser.o listing.oscanner.o: scanner.c listing.h tokens.hg++ -c scanner.cscanner.c: scanner.lflex scanner.lmv lex.yy.c scanner.cparser.o: parser.c listing.h g++ -c parser.cparser.c tokens.h: parser.ybison -d -v parser.ymv parser.tab.c parser.ccp parser.tab.h tokens.hlisting.o: listing.cc listing.hg++ -c listing.ccparser.y:%{#include <string>using namespace std;#include "listing.h"int yylex();void yyerror(const char* message);%}%define parse.error verbose%token IDENTIFIER%token INT_LITERAL%token REAL_LITERAL%token BOOL_LITERAL%token ADDOP MULOP RELOP OROP ANDOP EXPOP REMOP%token BEGIN_ BOOLEAN END ENDREDUCE FUNCTION INTEGER IS REDUCE RETURNS CASE ELSE ARROW%token ENDCASE ENDIF IF OTHERS REAL THEN WHEN NOT%%function:function_header different_parameter body ;function_header:FUNCTION IDENTIFIER diff_parameter RETURNS type ';' ;different_parameter:different_parameter variable |;variable:IDENTIFIER ':' type IS statement_ ;diff_parameter:diff_parameter RETURNS type ',' |parameter ;parameter:IDENTIFIER ':' type |;type: INTEGER | REAL | BOOLEAN ;body:BEGIN_ statement_ END ';' ;statement_:statement ';' |error ';' ;statement:expression |REDUCE operator reductions ENDREDUCE |IF expression THEN statement_ ELSE statement_ ENDIF |CASE expression IS various_cases OTHERS ARROW statement_ ENDCASE ;reductions:reductions statement_ |;various_cases:various_cases case |;case: WHEN INT_LITERAL ARROW statement_ ;operator:ADDOP |MULOP | REMOP |EXPOP ;expression:expression ANDOP relation |expression2;expression2:expression OROP relation |relation;relation:relation RELOP term |term;term:term ADDOP factor |factor ;factor:factor MULOP primary |factor REMOP |exponent ;exponent:factor EXPOP notion |notion;notion:notion NOT primary |primary;primary:'(' expression ')' |INT_LITERAL | REAL_LITERAL | BOOL_LITERAL |IDENTIFIER ;%%void yyerror(const char* message){appendError(SYNTAX, message);}int main(int argc, char *argv[]){firstLine();yyparse();lastLine();return 0;}scanner.l:/* This file contains flex input file */%{#include <cstdio>#include <string>using namespace std;#include "listing.h"#include "tokens.h"%}%option noyywrapws [ \t\r]+comment ("//"|"--").*\nid [A-Za-z](_?[A-Za-z0-9])*real {digit}+\.{digit}*([Ee][+-]?{digit}+)?line [\n]digit [0-9]int {digit}+punc [\(\),:;]%%{ws} { ECHO; }{comment} { ECHO; nextLine();}{line} { ECHO; nextLine();}"+" { ECHO; return(ADDOP); }"*" { ECHO; return(MULOP); }"=>" { ECHO; return(ARROW); }"<" { ECHO; return(RELOP); }"=" { ECHO; return(RELOP); }"/=" { ECHO; return(RELOP); }">" { ECHO; return(RELOP); }">=" { ECHO; return(RELOP); }"<=" { ECHO; return(RELOP); }"-" { ECHO; return(ADDOP); }"/" { ECHO; return(MULOP); }"**" { ECHO; return(EXPOP); }"." { ECHO; return(MULOP); }rem { ECHO; return(REMOP); }or { ECHO; return(OROP); }not { ECHO; return(NOTOP); }case { ECHO; return(CASE); }else { ECHO; return(ELSE); }endcase { ECHO; return(ENDCASE); }others { ECHO; return(OTHERS); }endif { ECHO; return(ENDIF); }if { ECHO; return(IF); }real { ECHO; return(REAL); }then { ECHO; return(THEN); }when { ECHO; return(WHEN); }begin { ECHO; return(BEGIN_); }boolean { ECHO; return(BOOLEAN); }end { ECHO; return(END); }endreduce { ECHO; return(ENDREDUCE); }function { ECHO; return(FUNCTION); }integer { ECHO; return(INTEGER); }is { ECHO; return(IS); }reduce { ECHO; return (REDUCE); }returns { ECHO; return(RETURNS); }and { ECHO; return(ANDOP); }true { ECHO; return(BOOL_LITERAL); }false { ECHO; return(BOOL_LITERAL); }{id} { ECHO; return(IDENTIFIER);}{real} {ECHO; return(REAL_LITERAL);}{int} { ECHO; return(INT_LITERAL); }{punc} { ECHO; return(yytext[0]); }. { ECHO; appendError(LEXICAL, yytext); }%%tokens.h:/* A Bison parser, made by GNU Bison 3.8.2. *//* Bison interface for Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . *//* As a special exception, you may make a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. *//* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, especially those whose name start with YY_ or yy_. They are private implementation details that can be changed or removed. */#ifndef YY_YY_PARSER_TAB_H_INCLUDED# define YY_YY_PARSER_TAB_H_INCLUDED/* Debug traces. */#ifndef YYDEBUG# define YYDEBUG 0#endif#if YYDEBUGextern int yydebug;#endif/* Token kinds. */#ifndef YYTOKENTYPE# define YYTOKENTYPE enum yytokentype { YYEMPTY = -2, YYEOF = 0, /* "end of file" */ YYerror = 256, /* error */ YYUNDEF = 257, /* "invalid token" */ IDENTIFIER = 258, /* IDENTIFIER */ INT_LITERAL = 259, /* INT_LITERAL */ REAL_LITERAL = 260, /* REAL_LITERAL */ BOOL_LITERAL = 261, /* BOOL_LITERAL */ ADDOP = 262, /* ADDOP */ MULOP = 263, /* MULOP */ RELOP = 264, /* RELOP */ OROP = 265, /* OROP */ ANDOP = 266, /* ANDOP */ EXPOP = 267, /* EXPOP */ REMOP = 268, /* REMOP */ BEGIN_ = 269, /* BEGIN_ */ BOOLEAN = 270, /* BOOLEAN */ END = 271, /* END */ ENDREDUCE = 272, /* ENDREDUCE */ FUNCTION = 273, /* FUNCTION */ INTEGER = 274, /* INTEGER */ IS = 275, /* IS */ REDUCE = 276, /* REDUCE */ RETURNS = 277, /* RETURNS */ CASE = 278, /* CASE */ ELSE = 279, /* ELSE */ ARROW = 280, /* ARROW */ ENDCASE = 281, /* ENDCASE */ ENDIF = 282, /* ENDIF */ IF = 283, /* IF */ OTHERS = 284, /* OTHERS */ REAL = 285, /* REAL */ THEN = 286, /* THEN */ WHEN = 287, /* WHEN */ NOT = 288, /* NOT */ NOTOP = 289 }; typedef enum yytokentype yytoken_kind_t;#endif/* Value type. */#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLAREDtypedef int YYSTYPE;# define YYSTYPE_IS_TRIVIAL 1# define YYSTYPE_IS_DECLARED 1#endifextern YYSTYPE yylval;int yyparse (void);#endif /* !YY_YY_PARSER_TAB_H_INCLUDED */ This production is not correct:function: function_header different_parameter body ;What is the diferent_parameter there for? Parameters are inside the function header not after it.Also this one does not look right:diff_parameter:diff_parameter RETURNS type ',' |parameter ;Professors notes: The RETURNS is already in function header. It should not be part of the parameter production.What you need is something like this:function_header: FUNCTION IDENTIFIER optional_parameters RETURNS type ;Then you need a production for optional_parameters that has two RHSs. One is empty, the other another nonterminal, call it parameters, for example.Then the parameters production must have a recursive RHS that separates parameters by a comma and a non-recursive RHS that defines a single parameter.The only other thing is see that obviously looks wrong is you production for not. Not is a unary operator. It should only have one operand.I have attached the Project Requirements, the Project Approach and the test cases. Please make sure that all the test cases work and match the Project Approach.
Application that Allows Users to Comment on A Static Posting Project
Create an application that allows users to comment on a static posting that you provide. In one version,
the user’s nam ...
Application that Allows Users to Comment on A Static Posting Project
Create an application that allows users to comment on a static posting that you provide. In one version,
the user’s name, contact information (e-mail address), and comment will be saved to a single text file. In
the other version, the same information will be saved to a database table.
CSIS208 Lincoln University Week 4 Application Programming Research Paper
create a program to store the amounts received for donations. The application is going to create an array to store 5 diff ...
CSIS208 Lincoln University Week 4 Application Programming Research Paper
create a program to store the amounts received for donations. The application is going to create an array to store 5 different areas of donations. The user is going to enter a name, the amount, select a donation area, and the information will be displayed and the the totals for each donation area will be displayed. The totals for each donation area will be a running totalPlease see attachment
ECE15 University of California San Artificial Intelligence & 2D Arrays HW
In this programming assignment, you will be building your very own connect-four computer
game. It will let a user play ag ...
ECE15 University of California San Artificial Intelligence & 2D Arrays HW
In this programming assignment, you will be building your very own connect-four computer
game. It will let a user play against a computer AI (Artificial Intelligence), which you can make as
complex as you like. As a challenge, your AI will be pitted against that of your classmates in a
connect-four tournament. This PA will introduce you to 2D arrays, searching through arrays and
lets you practice implementing more complex logic.
Similar Content
The Internet of Things Software Defined Cloud & Operating Systems Discussion
answer the following questions on the world documentation feel free to ask when it is not clear.thank you...
UL The Ways of Converting Liability to Personal Loan Customers Question
4KG3 Data Mining Assignment 2 - Classification
Total Marks: 15 points
Background:
A relatively young bank is growing rapid...
Need programming help with Webpage fix
Your task is polish webpage on attachment file and make it look better.Attachment.rar and then apply the following"Yo...
Computing and Printing the Average of The Numbers in A Text File Program
Write a program that computes and prints the average of the numbers in a text file. You should make use of two higher-orde...
CIS 302 ASU Internet Programming Javascript Programming If Else Construct
CIS 302 Internet Programming
Javascript Programming Assignment – if-else Construct
Write a Javascript program in an HTML...
Barclay College Encryption Algorithm Decoding Messages
please check up the doc and follow the instructor.please check up the doc and follow the instructor.please check up the do...
Classification Model
Machine learning classification or classification model is a type of monitored learning where one is in a position of lear...
Iris.yang Ex2016 Fixit 2 6
...
Path Analysis 2
i) M AT HAT T = β41 ∗ F AM COM P + β42 ∗ SES + ϵ4 ii) M AT HACH = β31 ∗ F AM COM P + β32 ∗ SES + ϵ3 These tw...
Related Tags
Book Guides
The Tipping Point
by Malcolm Gladwell
Black Beauty
by Anna Sewell
Calypso
by David Sedaris
The Fault in Our Stars
by John Green
Sharp Objects
by Gillian Flynn
Into the Wild
by Jon Krakauer
I Cant Make This Up - Life Lessons
by Kevin Hart
The Red Badge of Courage
by Stephen Crane
Fear - Trump in the White House
by Bob Woodward
Get 24/7
Homework help
Our tutors provide high quality explanations & answers.
Post question
Most Popular Content
MAT 205 UArizona Global Wk 1 Quantitative Explorations in Everyday Life Discussion
Discussion
From MAT205
Prior to beginning work on this discussion, read Chapter 2: Approaches to Problem Solv ...
MAT 205 UArizona Global Wk 1 Quantitative Explorations in Everyday Life Discussion
Discussion
From MAT205
Prior to beginning work on this discussion, read Chapter 2: Approaches to Problem Solving and Chapter 3: Numbers in the Real World in your course text.
Week 1 Discussion Problems
Your instructor will assign you to one of the three groups: Group A, Group B, or Group C. Your instructor will also assign you a number. Do the problem based on the number assigned to you by your instructor. Then, respond to at least three different peers from your own group.
The actual group discussion will function the same as any other discussion. You will only be able to participate and discuss with those peers assigned to your same group.
In order to view your peers’ work and respond to their posts, you need to submit your completed work by Friday (Day 4). You will not be able to view your group’s posts until after you have replied with your completed problem. Also, re-submissions are not allowed in this class.
Your initial post should be at least 250 words in length. It should show all the required math work and explain all the steps. Also include a simple reference for any used resource. For example: Washington Post dated August 13, 2018 or retrieved from .
68. Competition speed skydivers have reached record speeds of 614 miles per hour. At this speed, how many feet would you fail every second?
CMSC 430 Project 2
Could someone help me fix the code below in cgywin64 to correct the errors in bold at the bottom Below is the description ...
CMSC 430 Project 2
Could someone help me fix the code below in cgywin64 to correct the errors in bold at the bottom Below is the description of the question, followed by the codes, and the errors in bold. Thank you so much for the help. Please modify the given code instead of making a new one.Description:The question involves modifying the syntactic analyzer for the attached compiler by adding to the existing grammar. The full grammar of the language is shown below. The highlighted portions of the grammar show what you must either modify or add to the existing grammar.function: function_header {variable} body function_header: FUNCTION IDENTIFIER [parameters] RETURNS type ; variable: IDENTIFIER : type IS statement parameters: parameter {, parameter} parameter: IDENTIFIER : type type: INTEGER | REAL | BOOLEAN body: BEGIN statement END ; statement: expression ; | REDUCE operator {statement} ENDREDUCE ; | IF expression THEN statement ELSE statement ENDIF ; | CASE expression IS {case} OTHERS ARROW statement ENDCASE ; operator: ADDOP | MULOP case: WHEN INT_LITERAL ARROW statement expression: ( expression ) | expression binary_operator expression | NOTOP expression | INT_LITERAL | REAL_LITERAL | BOOL_LITERAL | IDENTIFIER binary_operator: ADDOP | MULOP | REMOP | EXPOP | RELOP | ANDOP |OROPIn the above grammar, the red symbols are nonterminals, the blue symbols are terminals and the black punctuation are EBNF metasymbols. The braces denote repetition 0 or more times and the brackets denote optional. You must rewrite the grammar to eliminate the EBNF brace and bracket metasymbols and to incorporate the significance of parentheses, operator precedence and associativity for all operators. Among arithmetic operators the exponentiation operator has highest precedence following by the multiplying operators and then the adding operators. All relational operators have the same precedence. Among the binary logical operators, and has higher precedence than or. Of the categories of operators, the unary logical operator has highest precedence, the arithmetic operators have next highest precedence, followed by the relational operators and finally the binary logical operators. All operators except the exponentiation operator are left associative. The directives to specify precedence and associativity, such as %prec and %left, may not be used Your parser should be able to correctly parse any syntactically correct program without any problem. You must modify the syntactic analyzer to detect and recover from additional syntax errors using the semicolon as the synchronization token. To accomplish detecting additional errors an error production must be added to the function header, another to the variable declaration and a final one to the when clause of the case statement. Your bison input file should not produce any shift/reduce or reduce/reduce errors. Eliminating them can be difficult so the best strategy is not introduce any. That is best achieved by making small incremental additions to the grammar and ensuring that no addition introduces any such errors. An example of compilation listing output containing syntax errors is shown below: 1 -- Multiple errors 2 3 function main a integer returns real; Syntax Error, Unexpected INTEGER, expecting ':' 4 b: integer is * 2; Syntax Error, Unexpected MULOP 5 c: real is 6.0; 6 begin 7 if a > c then 8 b 3.0; Syntax Error, Unexpected REAL_LITERAL, expecting ';' 9 else 10 b = 4.; 11 endif; 12 ; Syntax Error, Unexpected ';', expecting END Lexical Errors 0 Syntax Errors 4 Semantic Errors 0 listing.cc:// This file contains the bodies of the functions that produces the compilation// listing#include <cstdio>#include <string>using namespace std;#include "listing.h"static int lineNumber;static string error = "";static int totalErrors = 0;static void displayErrors();void firstLine(){lineNumber = 1;printf("\n%4d ",lineNumber);}void nextLine(){displayErrors();lineNumber++;printf("%4d ",lineNumber);}int lastLine(){printf("\r");displayErrors();printf(" \n");return totalErrors;} void appendError(ErrorCategories errorCategory, string message){string messages[] = { "Lexical Error, Invalid Character ", "", "Semantic Error, ", "Semantic Error, Duplicate Identifier: ", "Semantic Error, Undeclared " };error = messages[errorCategory] + message;totalErrors++;}void displayErrors(){if (error != "") printf("%s\n", error.c_str());error = "";}listing.h:// This file contains the function prototypes for the functions that produce the // compilation listingenum ErrorCategories {LEXICAL, SYNTAX, GENERAL_SEMANTIC, DUPLICATE_IDENTIFIER,UNDECLARED};void firstLine();void nextLine();int lastLine();void appendError(ErrorCategories errorCategory, string message);makefile:compile: scanner.o parser.o listing.og++ -o compile scanner.o parser.o listing.oscanner.o: scanner.c listing.h tokens.hg++ -c scanner.cscanner.c: scanner.lflex scanner.lmv lex.yy.c scanner.cparser.o: parser.c listing.h g++ -c parser.cparser.c tokens.h: parser.ybison -d -v parser.ymv parser.tab.c parser.ccp parser.tab.h tokens.hlisting.o: listing.cc listing.hg++ -c listing.ccparser.y:%{#include <string>using namespace std;#include "listing.h"int yylex();void yyerror(const char* message);%}%define parse.error verbose%token IDENTIFIER%token INT_LITERAL%token REAL_LITERAL%token BOOL_LITERAL%token ADDOP MULOP RELOP OROP ANDOP EXPOP REMOP%token BEGIN_ BOOLEAN END ENDREDUCE FUNCTION INTEGER IS REDUCE RETURNS CASE ELSE ARROW%token ENDCASE ENDIF IF OTHERS REAL THEN WHEN NOT%%function:function_header different_parameter body ;function_header:FUNCTION IDENTIFIER diff_parameter RETURNS type ';' ;different_parameter:different_parameter variable |;variable:IDENTIFIER ':' type IS statement_ ;diff_parameter:diff_parameter RETURNS type ',' |parameter ;parameter:IDENTIFIER ':' type |;type: INTEGER | REAL | BOOLEAN ;body:BEGIN_ statement_ END ';' ;statement_:statement ';' |error ';' ;statement:expression |REDUCE operator reductions ENDREDUCE |IF expression THEN statement_ ELSE statement_ ENDIF |CASE expression IS various_cases OTHERS ARROW statement_ ENDCASE ;reductions:reductions statement_ |;various_cases:various_cases case |;case: WHEN INT_LITERAL ARROW statement_ ;operator:ADDOP |MULOP | REMOP |EXPOP ;expression:expression ANDOP relation |expression2;expression2:expression OROP relation |relation;relation:relation RELOP term |term;term:term ADDOP factor |factor ;factor:factor MULOP primary |factor REMOP |exponent ;exponent:factor EXPOP notion |notion;notion:notion NOT primary |primary;primary:'(' expression ')' |INT_LITERAL | REAL_LITERAL | BOOL_LITERAL |IDENTIFIER ;%%void yyerror(const char* message){appendError(SYNTAX, message);}int main(int argc, char *argv[]){firstLine();yyparse();lastLine();return 0;}scanner.l:/* This file contains flex input file */%{#include <cstdio>#include <string>using namespace std;#include "listing.h"#include "tokens.h"%}%option noyywrapws [ \t\r]+comment ("//"|"--").*\nid [A-Za-z](_?[A-Za-z0-9])*real {digit}+\.{digit}*([Ee][+-]?{digit}+)?line [\n]digit [0-9]int {digit}+punc [\(\),:;]%%{ws} { ECHO; }{comment} { ECHO; nextLine();}{line} { ECHO; nextLine();}"+" { ECHO; return(ADDOP); }"*" { ECHO; return(MULOP); }"=>" { ECHO; return(ARROW); }"<" { ECHO; return(RELOP); }"=" { ECHO; return(RELOP); }"/=" { ECHO; return(RELOP); }">" { ECHO; return(RELOP); }">=" { ECHO; return(RELOP); }"<=" { ECHO; return(RELOP); }"-" { ECHO; return(ADDOP); }"/" { ECHO; return(MULOP); }"**" { ECHO; return(EXPOP); }"." { ECHO; return(MULOP); }rem { ECHO; return(REMOP); }or { ECHO; return(OROP); }not { ECHO; return(NOTOP); }case { ECHO; return(CASE); }else { ECHO; return(ELSE); }endcase { ECHO; return(ENDCASE); }others { ECHO; return(OTHERS); }endif { ECHO; return(ENDIF); }if { ECHO; return(IF); }real { ECHO; return(REAL); }then { ECHO; return(THEN); }when { ECHO; return(WHEN); }begin { ECHO; return(BEGIN_); }boolean { ECHO; return(BOOLEAN); }end { ECHO; return(END); }endreduce { ECHO; return(ENDREDUCE); }function { ECHO; return(FUNCTION); }integer { ECHO; return(INTEGER); }is { ECHO; return(IS); }reduce { ECHO; return (REDUCE); }returns { ECHO; return(RETURNS); }and { ECHO; return(ANDOP); }true { ECHO; return(BOOL_LITERAL); }false { ECHO; return(BOOL_LITERAL); }{id} { ECHO; return(IDENTIFIER);}{real} {ECHO; return(REAL_LITERAL);}{int} { ECHO; return(INT_LITERAL); }{punc} { ECHO; return(yytext[0]); }. { ECHO; appendError(LEXICAL, yytext); }%%tokens.h:/* A Bison parser, made by GNU Bison 3.8.2. *//* Bison interface for Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . *//* As a special exception, you may make a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. *//* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, especially those whose name start with YY_ or yy_. They are private implementation details that can be changed or removed. */#ifndef YY_YY_PARSER_TAB_H_INCLUDED# define YY_YY_PARSER_TAB_H_INCLUDED/* Debug traces. */#ifndef YYDEBUG# define YYDEBUG 0#endif#if YYDEBUGextern int yydebug;#endif/* Token kinds. */#ifndef YYTOKENTYPE# define YYTOKENTYPE enum yytokentype { YYEMPTY = -2, YYEOF = 0, /* "end of file" */ YYerror = 256, /* error */ YYUNDEF = 257, /* "invalid token" */ IDENTIFIER = 258, /* IDENTIFIER */ INT_LITERAL = 259, /* INT_LITERAL */ REAL_LITERAL = 260, /* REAL_LITERAL */ BOOL_LITERAL = 261, /* BOOL_LITERAL */ ADDOP = 262, /* ADDOP */ MULOP = 263, /* MULOP */ RELOP = 264, /* RELOP */ OROP = 265, /* OROP */ ANDOP = 266, /* ANDOP */ EXPOP = 267, /* EXPOP */ REMOP = 268, /* REMOP */ BEGIN_ = 269, /* BEGIN_ */ BOOLEAN = 270, /* BOOLEAN */ END = 271, /* END */ ENDREDUCE = 272, /* ENDREDUCE */ FUNCTION = 273, /* FUNCTION */ INTEGER = 274, /* INTEGER */ IS = 275, /* IS */ REDUCE = 276, /* REDUCE */ RETURNS = 277, /* RETURNS */ CASE = 278, /* CASE */ ELSE = 279, /* ELSE */ ARROW = 280, /* ARROW */ ENDCASE = 281, /* ENDCASE */ ENDIF = 282, /* ENDIF */ IF = 283, /* IF */ OTHERS = 284, /* OTHERS */ REAL = 285, /* REAL */ THEN = 286, /* THEN */ WHEN = 287, /* WHEN */ NOT = 288, /* NOT */ NOTOP = 289 }; typedef enum yytokentype yytoken_kind_t;#endif/* Value type. */#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLAREDtypedef int YYSTYPE;# define YYSTYPE_IS_TRIVIAL 1# define YYSTYPE_IS_DECLARED 1#endifextern YYSTYPE yylval;int yyparse (void);#endif /* !YY_YY_PARSER_TAB_H_INCLUDED */ This production is not correct:function: function_header different_parameter body ;What is the diferent_parameter there for? Parameters are inside the function header not after it.Also this one does not look right:diff_parameter:diff_parameter RETURNS type ',' |parameter ;Professors notes: The RETURNS is already in function header. It should not be part of the parameter production.What you need is something like this:function_header: FUNCTION IDENTIFIER optional_parameters RETURNS type ;Then you need a production for optional_parameters that has two RHSs. One is empty, the other another nonterminal, call it parameters, for example.Then the parameters production must have a recursive RHS that separates parameters by a comma and a non-recursive RHS that defines a single parameter.The only other thing is see that obviously looks wrong is you production for not. Not is a unary operator. It should only have one operand.I have attached the Project Requirements, the Project Approach and the test cases. Please make sure that all the test cases work and match the Project Approach.
Application that Allows Users to Comment on A Static Posting Project
Create an application that allows users to comment on a static posting that you provide. In one version,
the user’s nam ...
Application that Allows Users to Comment on A Static Posting Project
Create an application that allows users to comment on a static posting that you provide. In one version,
the user’s name, contact information (e-mail address), and comment will be saved to a single text file. In
the other version, the same information will be saved to a database table.
CSIS208 Lincoln University Week 4 Application Programming Research Paper
create a program to store the amounts received for donations. The application is going to create an array to store 5 diff ...
CSIS208 Lincoln University Week 4 Application Programming Research Paper
create a program to store the amounts received for donations. The application is going to create an array to store 5 different areas of donations. The user is going to enter a name, the amount, select a donation area, and the information will be displayed and the the totals for each donation area will be displayed. The totals for each donation area will be a running totalPlease see attachment
ECE15 University of California San Artificial Intelligence & 2D Arrays HW
In this programming assignment, you will be building your very own connect-four computer
game. It will let a user play ag ...
ECE15 University of California San Artificial Intelligence & 2D Arrays HW
In this programming assignment, you will be building your very own connect-four computer
game. It will let a user play against a computer AI (Artificial Intelligence), which you can make as
complex as you like. As a challenge, your AI will be pitted against that of your classmates in a
connect-four tournament. This PA will introduce you to 2D arrays, searching through arrays and
lets you practice implementing more complex logic.
Earn money selling
your Study Documents