Description
Explanation & Answer:
code

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

Please view explanation ...

Completion Status:
100%
Review
Review

Anonymous
This is great! Exactly what I wanted.

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

Access 2010
I need help with attached assignment. Thank youI need help with attached assignment. Thank youI need help with attached as ...
Access 2010
I need help with attached assignment. Thank youI need help with attached assignment. Thank youI need help with attached assignment. Thank youI need help with attached assignment. Thank youI need help with attached assignment. Thank you

Saudi Electronic University Similarities Between Windows and Linux Systems Essay
At this point, you have worked with both Windows and Linux systems. You have gone over data recovery and forensics tools f ...
Saudi Electronic University Similarities Between Windows and Linux Systems Essay
At this point, you have worked with both Windows and Linux systems. You have gone over data recovery and forensics tools for both operating systems. Compare the similarities, differences, and vulnerabilities of both operating systems.

Explain how traffic will flow across the connectivity between LANs based, computer science homework help
You are the leader of a small group of engineers who were issued a request for proposal (RFP) for the implementation of a ...
Explain how traffic will flow across the connectivity between LANs based, computer science homework help
You are the leader of a small group of engineers who were issued a request for proposal (RFP) for the implementation of a WAN solution that will connect 3 local offices of a corporation. These local offices are located in Los Angeles, New York City, and Chicago and have a fully functioning LAN. The WAN must be connected leveraging technologies offered by a switched network. Write 1200 words explaining the following:Which switched network are you and your group proposing? Why?Explain how traffic will flow across the connectivity between LANs based on the selection you have made.Diagram your LANs and how they are interconnected by the WAN (VISIO)When you finish your document, create a brief PowerPoint presentation to show your proposal to your prospective clients (8 slides)

assignment
Software licensing is a major problem in cloud computing. In a 3 to 4 page paper come up with several ideas to prevent an ...
assignment
Software licensing is a major problem in cloud computing. In a 3 to 4 page paper come up with several ideas to prevent an administrator from hijacking the authorization to use a software license. Make sure you adhere to the writing rubric, which includes citing your sourcesWriting Requirements3–4 pages in length (excluding cover page, abstract, and reference list)At least two peer reviewed sources that are properly cited and referencedAPA format, Use the APA template located in the Student Resource Center to complete the assignment.Please use the Case Study Guide as a reference point for writing your case study.

Project management exercise 2
In this exercise, you will continue to gain familiarity with MS Project 2013. For this exercise, you will update the proje ...
Project management exercise 2
In this exercise, you will continue to gain familiarity with MS Project 2013. For this exercise, you will update the project file you created in Module One for Exercise I, following the directions in the MS Project Exercise II Guidelines and Rubric document. If you have questions or concerns with this assignment, you can post them to the General Questions discussion board to obtain peer/instructor assistance. For additional details, please refer to the MS Project 2013 Exercise II Guidelines and Rubric document in the Assignment Guidelines and Rubrics section of the course.Please see teh PDF

ASA CMSC 430 Modifying the Attached Interpreter Project
The third project involves modifying the attached interpreter so that it interprets programs for the complete language.You ...
ASA CMSC 430 Modifying the Attached Interpreter Project
The third project involves modifying the attached interpreter so that it interprets programs for the complete language.You may convert all values to double values, although you can maintain their individual types if you wish. When the program is run on the command line, the parameters to the function should be supplied as command line arguments. For example, for the following function header of a program in the file text.txt: function main a: integer, b: integer returns integer;One would execute the program as follows: $ ./compile < test.txt 2 4In this case, the parameter a would be initialized to 2 and the parameter b to 4. An example of a program execution is shown below:$ ./compile < test.txt 2 41 function main a: integer, b: integer returns integer;2 c: integer is3 if a > b then4 a rem b;5 else6 a ** 2;7 endif;8 begin9 case a is10 when 1 => c;11 when 2 => (a + b / 2 - 4) * 3;12 others => 4;13 endcase;14 end;Compiled SuccessfullyResult = 0After the compilation listing is output, the value of the expression which comprises the body of the function should be displayed as shown above. The existing code evaluates some of the arithmetic, relational and logical operators together with the reduction statement. You are to add the necessary code to include all of the following: All additional arithmetic operators All additional relational and logical operators Both if and case statements Functions with multiple variables Functions with parametersThis project requires modification to the bison input file, so that it defines the additional the necessary computations for the above added features. You will need to add functions to the library of evaluation functions already provided in values.cc. You must also make some modifications to the functions already provided.Skeleton Files:listing.cc// Compiler Theory and Design// Dr. Duane J. Jarc// 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// Compiler Theory and Design// Duane J. Jarc// 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);parser.y/* Compiler Theory and DesignDuane J. Jarc */%{#include <iostream>#include <string>#include <vector>#include <map>using namespace std;#include "values.h"#include "listing.h"#include "symbols.h"int yylex();void yyerror(const char* message);Symbols<int> symbols;int result;%}%error-verbose%union{ CharPtr iden; Operators oper; int value;}%token <iden> IDENTIFIER%token <value> INT_LITERAL%token <oper> ADDOP MULOP RELOP%token ANDOP%token BEGIN_ BOOLEAN END ENDREDUCE FUNCTION INTEGER IS REDUCE RETURNS%type <value> body statement_ statement reductions expression relation term factor primary%type <oper> operator%%function: function_header optional_variable body {result = $3;} ; function_header: FUNCTION IDENTIFIER RETURNS type ';' ;optional_variable: variable | ;variable: IDENTIFIER ':' type IS statement_ {symbols.insert($1, $5);} ;type: INTEGER | BOOLEAN ;body: BEGIN_ statement_ END ';' {$$ = $2;} ; statement_: statement ';' | error ';' {$$ = 0;} ; statement: expression | REDUCE operator reductions ENDREDUCE {$$ = $3;} ;operator: ADDOP | MULOP ;reductions: reductions statement_ {$$ = evaluateReduction($<oper>0, $1, $2);} | {$$ = $<oper>0 == ADD ? 0 : 1;} ;expression: expression ANDOP relation {$$ = $1 && $3;} | relation ;relation: relation RELOP term {$$ = evaluateRelational($1, $2, $3);} | term ;term: term ADDOP factor {$$ = evaluateArithmetic($1, $2, $3);} | factor ; factor: factor MULOP primary {$$ = evaluateArithmetic($1, $2, $3);} | primary ;primary: '(' expression ')' {$$ = $2;} | INT_LITERAL | IDENTIFIER {if (!symbols.find($1, $$)) appendError(UNDECLARED, $1);} ;%%void yyerror(const char* message){ appendError(SYNTAX, message);}int main(int argc, char *argv[]){ firstLine(); yyparse(); if (lastLine() == 0) cout << "Result = " << result << endl; return 0;}scanner.l/* Compiler Theory and DesignDuane J. Jarc *//* This file contains flex input file */%{#include <string>using namespace std;#include "values.h"#include "listing.h"#include "tokens.h"%}%option noyywrapws [ \t\r]+comment \-\-.*\nline [\n]id [A-Za-z][A-Za-z0-9]*digit [0-9]int {digit}+punc [\(\),:;]%%{ws} { ECHO; }{comment} { ECHO; nextLine();}{line} { ECHO; nextLine();}"<" { ECHO; yylval.oper = LESS; return(RELOP); }"+" { ECHO; yylval.oper = ADD; return(ADDOP); }"*" { ECHO; yylval.oper = MULTIPLY; return(MULOP); }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); }{id} { ECHO; yylval.iden = (CharPtr)malloc(yyleng + 1); strcpy(yylval.iden, yytext); return(IDENTIFIER);}{int} { ECHO; yylval.value = atoi(yytext); return(INT_LITERAL); }{punc} { ECHO; return(yytext[0]); }. { ECHO; appendError(LEXICAL, yytext); }%%symbols.h// Compiler Theory and Design// Dr. Duane J. Jarctemplate <typename T>class Symbols{public: void insert(char* lexeme, T entry); bool find(char* lexeme, T& entry);private: map<string, T> symbols;};template <typename T>void Symbols<T>::insert(char* lexeme, T entry){ string name(lexeme); symbols[name] = entry;}template <typename T>bool Symbols<T>::find(char* lexeme, T& entry){ string name(lexeme); typedef typename map<string, T>::iterator Iterator; Iterator iterator = symbols.find(name); bool found = iterator != symbols.end(); if (found) entry = iterator->second; return found;}values.cc// CMSC 430// Duane J. Jarc// This file contains the bodies of the evaluation functions#include <string>#include <vector>#include <cmath>using namespace std;#include "values.h"#include "listing.h"int evaluateReduction(Operators operator_, int head, int tail){ if (operator_ == ADD) return head + tail; return head * tail;}int evaluateRelational(int left, Operators operator_, int right){ int result; switch (operator_) { case LESS: result = left < right; break; } return result;}int evaluateArithmetic(int left, Operators operator_, int right){ int result; switch (operator_) { case ADD: result = left + right; break; case MULTIPLY: result = left * right; break; } return result;}values.h// CMSC 430// Duane J. Jarc// This file contains function definitions for the evaluation functionstypedef char* CharPtr;enum Operators {LESS, ADD, MULTIPLY};int evaluateReduction(Operators operator_, int head, int tail);int evaluateRelational(int left, Operators operator_, int right);int evaluateArithmetic(int left, Operators operator_, int right);
Similar Content
vam-week 5 discussion
words:600mportant: Turnitin is active. Turnitin score greater than 25% will be investigated. In addition, you may lose poi...
Security Policies, computer science homework help
The policies that organizations put in place are similar to laws in that they are directives for how to act properly. Like...
Disaster Recovery Plan.
This assignment is the PowerPoint presentation of your Disaster Recovery Plan , i need 3 references.Topic: Disaster Recove...
Windows Forensic Artifact Analysis on Windows 10 User Activities Questions
After watching the NTUser.DAT video - please look and then find your NTUser.DAT file and extract it from your hard drive u...
I do have some work but it deals with working in a group I have two other people
Group Project 2 part 1.docx I do have some work but it deals with working in a group I have two other people in the g...
DATA 2001 Final University of Leeds Computer Science Questions
期末总复习
李指导
DATA2001 Final 总 复 习
目录
DATA2001 Final 总复习 ..................
Qualitative And Quantitative Risk Analysis
The quantitative and qualitative risk analysis forms as the fourth and fifth step in the risk analysis process. These anal...
Assignment 9 Azure
...
20181003034739legal Options
Mr. Antoniou’s has the legal option of reaching out to his patent counsel to bring in the issue. In this case,...
Related Tags
Book Guides
The BFG
by Roald Dahl
The Eyes Were Watching God
by Zora Neale Hurston
Good Kids Bad City
by Kyle Swenson
The Age Of Light
by Whitney Scharer
The Woman in the Window
by A. J. Finn
The Unwinding of the Miracle
by Julie Yip-Williams
Rules Of Civility
by Amor Towles
The Underground Railroad
by Colson Whitehead
The Iliad
by Homer

Get 24/7
Homework help
Our tutors provide high quality explanations & answers.
Post question
Most Popular Content

Access 2010
I need help with attached assignment. Thank youI need help with attached assignment. Thank youI need help with attached as ...
Access 2010
I need help with attached assignment. Thank youI need help with attached assignment. Thank youI need help with attached assignment. Thank youI need help with attached assignment. Thank youI need help with attached assignment. Thank you

Saudi Electronic University Similarities Between Windows and Linux Systems Essay
At this point, you have worked with both Windows and Linux systems. You have gone over data recovery and forensics tools f ...
Saudi Electronic University Similarities Between Windows and Linux Systems Essay
At this point, you have worked with both Windows and Linux systems. You have gone over data recovery and forensics tools for both operating systems. Compare the similarities, differences, and vulnerabilities of both operating systems.

Explain how traffic will flow across the connectivity between LANs based, computer science homework help
You are the leader of a small group of engineers who were issued a request for proposal (RFP) for the implementation of a ...
Explain how traffic will flow across the connectivity between LANs based, computer science homework help
You are the leader of a small group of engineers who were issued a request for proposal (RFP) for the implementation of a WAN solution that will connect 3 local offices of a corporation. These local offices are located in Los Angeles, New York City, and Chicago and have a fully functioning LAN. The WAN must be connected leveraging technologies offered by a switched network. Write 1200 words explaining the following:Which switched network are you and your group proposing? Why?Explain how traffic will flow across the connectivity between LANs based on the selection you have made.Diagram your LANs and how they are interconnected by the WAN (VISIO)When you finish your document, create a brief PowerPoint presentation to show your proposal to your prospective clients (8 slides)

assignment
Software licensing is a major problem in cloud computing. In a 3 to 4 page paper come up with several ideas to prevent an ...
assignment
Software licensing is a major problem in cloud computing. In a 3 to 4 page paper come up with several ideas to prevent an administrator from hijacking the authorization to use a software license. Make sure you adhere to the writing rubric, which includes citing your sourcesWriting Requirements3–4 pages in length (excluding cover page, abstract, and reference list)At least two peer reviewed sources that are properly cited and referencedAPA format, Use the APA template located in the Student Resource Center to complete the assignment.Please use the Case Study Guide as a reference point for writing your case study.

Project management exercise 2
In this exercise, you will continue to gain familiarity with MS Project 2013. For this exercise, you will update the proje ...
Project management exercise 2
In this exercise, you will continue to gain familiarity with MS Project 2013. For this exercise, you will update the project file you created in Module One for Exercise I, following the directions in the MS Project Exercise II Guidelines and Rubric document. If you have questions or concerns with this assignment, you can post them to the General Questions discussion board to obtain peer/instructor assistance. For additional details, please refer to the MS Project 2013 Exercise II Guidelines and Rubric document in the Assignment Guidelines and Rubrics section of the course.Please see teh PDF

ASA CMSC 430 Modifying the Attached Interpreter Project
The third project involves modifying the attached interpreter so that it interprets programs for the complete language.You ...
ASA CMSC 430 Modifying the Attached Interpreter Project
The third project involves modifying the attached interpreter so that it interprets programs for the complete language.You may convert all values to double values, although you can maintain their individual types if you wish. When the program is run on the command line, the parameters to the function should be supplied as command line arguments. For example, for the following function header of a program in the file text.txt: function main a: integer, b: integer returns integer;One would execute the program as follows: $ ./compile < test.txt 2 4In this case, the parameter a would be initialized to 2 and the parameter b to 4. An example of a program execution is shown below:$ ./compile < test.txt 2 41 function main a: integer, b: integer returns integer;2 c: integer is3 if a > b then4 a rem b;5 else6 a ** 2;7 endif;8 begin9 case a is10 when 1 => c;11 when 2 => (a + b / 2 - 4) * 3;12 others => 4;13 endcase;14 end;Compiled SuccessfullyResult = 0After the compilation listing is output, the value of the expression which comprises the body of the function should be displayed as shown above. The existing code evaluates some of the arithmetic, relational and logical operators together with the reduction statement. You are to add the necessary code to include all of the following: All additional arithmetic operators All additional relational and logical operators Both if and case statements Functions with multiple variables Functions with parametersThis project requires modification to the bison input file, so that it defines the additional the necessary computations for the above added features. You will need to add functions to the library of evaluation functions already provided in values.cc. You must also make some modifications to the functions already provided.Skeleton Files:listing.cc// Compiler Theory and Design// Dr. Duane J. Jarc// 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// Compiler Theory and Design// Duane J. Jarc// 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);parser.y/* Compiler Theory and DesignDuane J. Jarc */%{#include <iostream>#include <string>#include <vector>#include <map>using namespace std;#include "values.h"#include "listing.h"#include "symbols.h"int yylex();void yyerror(const char* message);Symbols<int> symbols;int result;%}%error-verbose%union{ CharPtr iden; Operators oper; int value;}%token <iden> IDENTIFIER%token <value> INT_LITERAL%token <oper> ADDOP MULOP RELOP%token ANDOP%token BEGIN_ BOOLEAN END ENDREDUCE FUNCTION INTEGER IS REDUCE RETURNS%type <value> body statement_ statement reductions expression relation term factor primary%type <oper> operator%%function: function_header optional_variable body {result = $3;} ; function_header: FUNCTION IDENTIFIER RETURNS type ';' ;optional_variable: variable | ;variable: IDENTIFIER ':' type IS statement_ {symbols.insert($1, $5);} ;type: INTEGER | BOOLEAN ;body: BEGIN_ statement_ END ';' {$$ = $2;} ; statement_: statement ';' | error ';' {$$ = 0;} ; statement: expression | REDUCE operator reductions ENDREDUCE {$$ = $3;} ;operator: ADDOP | MULOP ;reductions: reductions statement_ {$$ = evaluateReduction($<oper>0, $1, $2);} | {$$ = $<oper>0 == ADD ? 0 : 1;} ;expression: expression ANDOP relation {$$ = $1 && $3;} | relation ;relation: relation RELOP term {$$ = evaluateRelational($1, $2, $3);} | term ;term: term ADDOP factor {$$ = evaluateArithmetic($1, $2, $3);} | factor ; factor: factor MULOP primary {$$ = evaluateArithmetic($1, $2, $3);} | primary ;primary: '(' expression ')' {$$ = $2;} | INT_LITERAL | IDENTIFIER {if (!symbols.find($1, $$)) appendError(UNDECLARED, $1);} ;%%void yyerror(const char* message){ appendError(SYNTAX, message);}int main(int argc, char *argv[]){ firstLine(); yyparse(); if (lastLine() == 0) cout << "Result = " << result << endl; return 0;}scanner.l/* Compiler Theory and DesignDuane J. Jarc *//* This file contains flex input file */%{#include <string>using namespace std;#include "values.h"#include "listing.h"#include "tokens.h"%}%option noyywrapws [ \t\r]+comment \-\-.*\nline [\n]id [A-Za-z][A-Za-z0-9]*digit [0-9]int {digit}+punc [\(\),:;]%%{ws} { ECHO; }{comment} { ECHO; nextLine();}{line} { ECHO; nextLine();}"<" { ECHO; yylval.oper = LESS; return(RELOP); }"+" { ECHO; yylval.oper = ADD; return(ADDOP); }"*" { ECHO; yylval.oper = MULTIPLY; return(MULOP); }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); }{id} { ECHO; yylval.iden = (CharPtr)malloc(yyleng + 1); strcpy(yylval.iden, yytext); return(IDENTIFIER);}{int} { ECHO; yylval.value = atoi(yytext); return(INT_LITERAL); }{punc} { ECHO; return(yytext[0]); }. { ECHO; appendError(LEXICAL, yytext); }%%symbols.h// Compiler Theory and Design// Dr. Duane J. Jarctemplate <typename T>class Symbols{public: void insert(char* lexeme, T entry); bool find(char* lexeme, T& entry);private: map<string, T> symbols;};template <typename T>void Symbols<T>::insert(char* lexeme, T entry){ string name(lexeme); symbols[name] = entry;}template <typename T>bool Symbols<T>::find(char* lexeme, T& entry){ string name(lexeme); typedef typename map<string, T>::iterator Iterator; Iterator iterator = symbols.find(name); bool found = iterator != symbols.end(); if (found) entry = iterator->second; return found;}values.cc// CMSC 430// Duane J. Jarc// This file contains the bodies of the evaluation functions#include <string>#include <vector>#include <cmath>using namespace std;#include "values.h"#include "listing.h"int evaluateReduction(Operators operator_, int head, int tail){ if (operator_ == ADD) return head + tail; return head * tail;}int evaluateRelational(int left, Operators operator_, int right){ int result; switch (operator_) { case LESS: result = left < right; break; } return result;}int evaluateArithmetic(int left, Operators operator_, int right){ int result; switch (operator_) { case ADD: result = left + right; break; case MULTIPLY: result = left * right; break; } return result;}values.h// CMSC 430// Duane J. Jarc// This file contains function definitions for the evaluation functionstypedef char* CharPtr;enum Operators {LESS, ADD, MULTIPLY};int evaluateReduction(Operators operator_, int head, int tail);int evaluateRelational(int left, Operators operator_, int right);int evaluateArithmetic(int left, Operators operator_, int right);
Earn money selling
your Study Documents