SlideShare a Scribd company logo
It is a simple program that that parses a simple expression grammar.
The grammar:
P ---> E '$'
E ---> T { ('+' '-') T }
T ---> F { ('/' '*') F }
F ---> '(' E ')' | digit | letter or in BNF
P ---> E '$'
E ---> E + T | E - T | T
T ---> T * F | T / F | F
F ---> '(' E ')' | digit | letter
Your task is to modify the code to add exponentiation and modulus operations
To add these functions we will change the Grammar to be the following:
P ---> E '$'
E ---> E + T | E - T | T
T ---> T * F | T / F | F
F ---> P ^ F | P
P ---> '(' E ')' | digit | letter
The grammars are very similar but the new grammar but has a a minor change to TERM for
modulus a rewrite of FACTOR to handle exponent operation and a completely new method
called PRIMARY that does what the old FACTOR did
To add the modulus you will need to add the modulus operator '%' character
To add the power (exponentiation) operation you will need to again add a character ('^') and then
rewrite the FACTOR NEW method for PRIMARY Comment your code. You should add a
comment ALL the line you add or modify (required) You must use the given code and you are to
change as little as possible (don't rewrite the whole thing or add any additional functionality)
______________________________________________________________________________
________________________________________________________

More Related Content

More from ColinjSWDavidsonn

In a particular hospital- 6 newborn babies were delivered yesterday- H.pdf
In a particular hospital- 6 newborn babies were delivered yesterday- H.pdfIn a particular hospital- 6 newborn babies were delivered yesterday- H.pdf
In a particular hospital- 6 newborn babies were delivered yesterday- H.pdf
ColinjSWDavidsonn
 
In Chapter 8 you were introduced to the water-soluble vitamins- includ (1).pdf
In Chapter 8 you were introduced to the water-soluble vitamins- includ (1).pdfIn Chapter 8 you were introduced to the water-soluble vitamins- includ (1).pdf
In Chapter 8 you were introduced to the water-soluble vitamins- includ (1).pdf
ColinjSWDavidsonn
 
In Chapter 12- you learned about the distribution and marketing channe.pdf
In Chapter 12- you learned about the distribution and marketing channe.pdfIn Chapter 12- you learned about the distribution and marketing channe.pdf
In Chapter 12- you learned about the distribution and marketing channe.pdf
ColinjSWDavidsonn
 
In detail- please discuss the technical structure of the Customs Tarif.pdf
In detail- please discuss the technical structure of the Customs Tarif.pdfIn detail- please discuss the technical structure of the Customs Tarif.pdf
In detail- please discuss the technical structure of the Customs Tarif.pdf
ColinjSWDavidsonn
 
In an experiment of rolling a die twce Lel x be random variable to be.pdf
In an experiment of rolling a die twce Lel x be random variable to be.pdfIn an experiment of rolling a die twce Lel x be random variable to be.pdf
In an experiment of rolling a die twce Lel x be random variable to be.pdf
ColinjSWDavidsonn
 
In a school- 16- of the students have seen a school counselor about an.pdf
In a school- 16- of the students have seen a school counselor about an.pdfIn a school- 16- of the students have seen a school counselor about an.pdf
In a school- 16- of the students have seen a school counselor about an.pdf
ColinjSWDavidsonn
 
In a Poisson distribution- -2-00- (Round your answers to 4 decimal pla.pdf
In a Poisson distribution- -2-00- (Round your answers to 4 decimal pla.pdfIn a Poisson distribution- -2-00- (Round your answers to 4 decimal pla.pdf
In a Poisson distribution- -2-00- (Round your answers to 4 decimal pla.pdf
ColinjSWDavidsonn
 
it ingents ford It tacks cell watlls Question 4 Bictaterally symimetri.pdf
it ingents ford It tacks cell watlls Question 4 Bictaterally symimetri.pdfit ingents ford It tacks cell watlls Question 4 Bictaterally symimetri.pdf
it ingents ford It tacks cell watlls Question 4 Bictaterally symimetri.pdf
ColinjSWDavidsonn
 
Is this x-lined dominant or recessive inheritance- Write all possible.pdf
Is this x-lined dominant or recessive inheritance- Write all possible.pdfIs this x-lined dominant or recessive inheritance- Write all possible.pdf
Is this x-lined dominant or recessive inheritance- Write all possible.pdf
ColinjSWDavidsonn
 
Is the study experimental- observational- or niether- 7) A political p.pdf
Is the study experimental- observational- or niether- 7) A political p.pdfIs the study experimental- observational- or niether- 7) A political p.pdf
Is the study experimental- observational- or niether- 7) A political p.pdf
ColinjSWDavidsonn
 
Is Ethnicity a Foreign Concept-.pdf
Is Ethnicity a Foreign Concept-.pdfIs Ethnicity a Foreign Concept-.pdf
Is Ethnicity a Foreign Concept-.pdf
ColinjSWDavidsonn
 
is arguably the most important factor currently shaping the world econ.pdf
is arguably the most important factor currently shaping the world econ.pdfis arguably the most important factor currently shaping the world econ.pdf
is arguably the most important factor currently shaping the world econ.pdf
ColinjSWDavidsonn
 
Introduction to Parallel Computing Assignment.pdf
Introduction to Parallel Computing  Assignment.pdfIntroduction to Parallel Computing  Assignment.pdf
Introduction to Parallel Computing Assignment.pdf
ColinjSWDavidsonn
 
Interrelationships of the financial statements- please in your own wor.pdf
Interrelationships of the financial statements- please in your own wor.pdfInterrelationships of the financial statements- please in your own wor.pdf
Interrelationships of the financial statements- please in your own wor.pdf
ColinjSWDavidsonn
 
Internal users of accounting information would not include A- officers.pdf
Internal users of accounting information would not include A- officers.pdfInternal users of accounting information would not include A- officers.pdf
Internal users of accounting information would not include A- officers.pdf
ColinjSWDavidsonn
 
int a-0- for {i-0-i-N-i++){ for (j-N-j-i-j){ }a-a+i+j- -} T(n)-.pdf
int a-0- for {i-0-i-N-i++){ for (j-N-j-i-j){ }a-a+i+j- -} T(n)-.pdfint a-0- for {i-0-i-N-i++){ for (j-N-j-i-j){ }a-a+i+j- -} T(n)-.pdf
int a-0- for {i-0-i-N-i++){ for (j-N-j-i-j){ }a-a+i+j- -} T(n)-.pdf
ColinjSWDavidsonn
 
Insurance protects and safeguards assets from the financial effects of.pdf
Insurance protects and safeguards assets from the financial effects of.pdfInsurance protects and safeguards assets from the financial effects of.pdf
Insurance protects and safeguards assets from the financial effects of.pdf
ColinjSWDavidsonn
 
Insulin (a peptide hormone) stimulates the uptake glucose blood by act.pdf
Insulin (a peptide hormone) stimulates the uptake glucose blood by act.pdfInsulin (a peptide hormone) stimulates the uptake glucose blood by act.pdf
Insulin (a peptide hormone) stimulates the uptake glucose blood by act.pdf
ColinjSWDavidsonn
 
INSTRuctions- Rost the fellewing jeurnal entries te the ledrer account.pdf
INSTRuctions- Rost the fellewing jeurnal entries te the ledrer account.pdfINSTRuctions- Rost the fellewing jeurnal entries te the ledrer account.pdf
INSTRuctions- Rost the fellewing jeurnal entries te the ledrer account.pdf
ColinjSWDavidsonn
 
Insert a VLOOKUP function in cell C5 to display the ring cos for the f.pdf
Insert a VLOOKUP function in cell C5 to display the ring cos for the f.pdfInsert a VLOOKUP function in cell C5 to display the ring cos for the f.pdf
Insert a VLOOKUP function in cell C5 to display the ring cos for the f.pdf
ColinjSWDavidsonn
 

More from ColinjSWDavidsonn (20)

In a particular hospital- 6 newborn babies were delivered yesterday- H.pdf
In a particular hospital- 6 newborn babies were delivered yesterday- H.pdfIn a particular hospital- 6 newborn babies were delivered yesterday- H.pdf
In a particular hospital- 6 newborn babies were delivered yesterday- H.pdf
 
In Chapter 8 you were introduced to the water-soluble vitamins- includ (1).pdf
In Chapter 8 you were introduced to the water-soluble vitamins- includ (1).pdfIn Chapter 8 you were introduced to the water-soluble vitamins- includ (1).pdf
In Chapter 8 you were introduced to the water-soluble vitamins- includ (1).pdf
 
In Chapter 12- you learned about the distribution and marketing channe.pdf
In Chapter 12- you learned about the distribution and marketing channe.pdfIn Chapter 12- you learned about the distribution and marketing channe.pdf
In Chapter 12- you learned about the distribution and marketing channe.pdf
 
In detail- please discuss the technical structure of the Customs Tarif.pdf
In detail- please discuss the technical structure of the Customs Tarif.pdfIn detail- please discuss the technical structure of the Customs Tarif.pdf
In detail- please discuss the technical structure of the Customs Tarif.pdf
 
In an experiment of rolling a die twce Lel x be random variable to be.pdf
In an experiment of rolling a die twce Lel x be random variable to be.pdfIn an experiment of rolling a die twce Lel x be random variable to be.pdf
In an experiment of rolling a die twce Lel x be random variable to be.pdf
 
In a school- 16- of the students have seen a school counselor about an.pdf
In a school- 16- of the students have seen a school counselor about an.pdfIn a school- 16- of the students have seen a school counselor about an.pdf
In a school- 16- of the students have seen a school counselor about an.pdf
 
In a Poisson distribution- -2-00- (Round your answers to 4 decimal pla.pdf
In a Poisson distribution- -2-00- (Round your answers to 4 decimal pla.pdfIn a Poisson distribution- -2-00- (Round your answers to 4 decimal pla.pdf
In a Poisson distribution- -2-00- (Round your answers to 4 decimal pla.pdf
 
it ingents ford It tacks cell watlls Question 4 Bictaterally symimetri.pdf
it ingents ford It tacks cell watlls Question 4 Bictaterally symimetri.pdfit ingents ford It tacks cell watlls Question 4 Bictaterally symimetri.pdf
it ingents ford It tacks cell watlls Question 4 Bictaterally symimetri.pdf
 
Is this x-lined dominant or recessive inheritance- Write all possible.pdf
Is this x-lined dominant or recessive inheritance- Write all possible.pdfIs this x-lined dominant or recessive inheritance- Write all possible.pdf
Is this x-lined dominant or recessive inheritance- Write all possible.pdf
 
Is the study experimental- observational- or niether- 7) A political p.pdf
Is the study experimental- observational- or niether- 7) A political p.pdfIs the study experimental- observational- or niether- 7) A political p.pdf
Is the study experimental- observational- or niether- 7) A political p.pdf
 
Is Ethnicity a Foreign Concept-.pdf
Is Ethnicity a Foreign Concept-.pdfIs Ethnicity a Foreign Concept-.pdf
Is Ethnicity a Foreign Concept-.pdf
 
is arguably the most important factor currently shaping the world econ.pdf
is arguably the most important factor currently shaping the world econ.pdfis arguably the most important factor currently shaping the world econ.pdf
is arguably the most important factor currently shaping the world econ.pdf
 
Introduction to Parallel Computing Assignment.pdf
Introduction to Parallel Computing  Assignment.pdfIntroduction to Parallel Computing  Assignment.pdf
Introduction to Parallel Computing Assignment.pdf
 
Interrelationships of the financial statements- please in your own wor.pdf
Interrelationships of the financial statements- please in your own wor.pdfInterrelationships of the financial statements- please in your own wor.pdf
Interrelationships of the financial statements- please in your own wor.pdf
 
Internal users of accounting information would not include A- officers.pdf
Internal users of accounting information would not include A- officers.pdfInternal users of accounting information would not include A- officers.pdf
Internal users of accounting information would not include A- officers.pdf
 
int a-0- for {i-0-i-N-i++){ for (j-N-j-i-j){ }a-a+i+j- -} T(n)-.pdf
int a-0- for {i-0-i-N-i++){ for (j-N-j-i-j){ }a-a+i+j- -} T(n)-.pdfint a-0- for {i-0-i-N-i++){ for (j-N-j-i-j){ }a-a+i+j- -} T(n)-.pdf
int a-0- for {i-0-i-N-i++){ for (j-N-j-i-j){ }a-a+i+j- -} T(n)-.pdf
 
Insurance protects and safeguards assets from the financial effects of.pdf
Insurance protects and safeguards assets from the financial effects of.pdfInsurance protects and safeguards assets from the financial effects of.pdf
Insurance protects and safeguards assets from the financial effects of.pdf
 
Insulin (a peptide hormone) stimulates the uptake glucose blood by act.pdf
Insulin (a peptide hormone) stimulates the uptake glucose blood by act.pdfInsulin (a peptide hormone) stimulates the uptake glucose blood by act.pdf
Insulin (a peptide hormone) stimulates the uptake glucose blood by act.pdf
 
INSTRuctions- Rost the fellewing jeurnal entries te the ledrer account.pdf
INSTRuctions- Rost the fellewing jeurnal entries te the ledrer account.pdfINSTRuctions- Rost the fellewing jeurnal entries te the ledrer account.pdf
INSTRuctions- Rost the fellewing jeurnal entries te the ledrer account.pdf
 
Insert a VLOOKUP function in cell C5 to display the ring cos for the f.pdf
Insert a VLOOKUP function in cell C5 to display the ring cos for the f.pdfInsert a VLOOKUP function in cell C5 to display the ring cos for the f.pdf
Insert a VLOOKUP function in cell C5 to display the ring cos for the f.pdf
 

Recently uploaded

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 

Recently uploaded (20)

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 

It is a simple program that that parses a simple expression grammar- T.pdf

  • 1. It is a simple program that that parses a simple expression grammar. The grammar: P ---> E '$' E ---> T { ('+' '-') T } T ---> F { ('/' '*') F } F ---> '(' E ')' | digit | letter or in BNF P ---> E '$' E ---> E + T | E - T | T T ---> T * F | T / F | F F ---> '(' E ')' | digit | letter Your task is to modify the code to add exponentiation and modulus operations To add these functions we will change the Grammar to be the following: P ---> E '$' E ---> E + T | E - T | T T ---> T * F | T / F | F F ---> P ^ F | P P ---> '(' E ')' | digit | letter The grammars are very similar but the new grammar but has a a minor change to TERM for modulus a rewrite of FACTOR to handle exponent operation and a completely new method called PRIMARY that does what the old FACTOR did To add the modulus you will need to add the modulus operator '%' character To add the power (exponentiation) operation you will need to again add a character ('^') and then rewrite the FACTOR NEW method for PRIMARY Comment your code. You should add a comment ALL the line you add or modify (required) You must use the given code and you are to change as little as possible (don't rewrite the whole thing or add any additional functionality)