SlideShare ist ein Scribd-Unternehmen logo
1 von 1
Downloaden Sie, um offline zu lesen
CONVERT THIS C CODE TO JAVA ......
/* front.c - a lexical analyzer system for simple arithmeticexpressions/ #include #include /* Global
declarations / / Variables / int charClass; char lexeme [100]; char nextChar; int lexLen; int token;
int nextToken; FILE in_fp, fopen(); /* Function declarations / void addChar(); void getChar(); void
getNonBlank(); int lex(); /* Character classes / #define LETTER 0 #define DIGIT 1 #define
UNKNOWN 99 /* Token codes / #define INT_LIT 10 #define IDENT 11 #define ASSIGN_OP 20
#define ADD_OP 21 #define SUB_OP 22 #define MULT_OP 23 #define DIV_OP 24 #define
LEFT_PAREN 25 #define RIGHT_PAREN 26 // / main driver / main() { / Open the input data file
and process its contents / if ((in fp = fopen("front.in", r " ))= NULL) printf("ERROR - cannot open
front.in n"); else {getChar (); do { lex(); } while (nextToken! = EOF); // /* lookup - a function to
lookup operators and parentheses and return the token / int lookup(char ch) { switch (ch) { case ' (
': addChar(); nextToken = LEFT_PAREN ; break; case ')': addChar () ; nextToken =
RIGHT_PAREN ; break; case '+': addChar (); nextToken = ADD_OP; break; case '-': addChar () ;
nextToken = SUB_OP; break; case ' ': addChar (); nextToken = MULT_OP; break; case ' / ':
addChar(); nextToken = DIV_OP; break; default: addChar(); nextToken = EOF; break; } return
nextToken;} /*******************************************************/ / addChar - a function to add
nextChar to lexeme */ void addChar ( ) { if (lexLen <= 98 ) { lexeme[lexLen++] , nextChar;
lexeme[lexLen] =0; } else printf("Error - lexeme is too long n);
/*****************************************************/ / getChar - a function to get the next character of
input and determine its character class */ void getChar( ) if (( nextChar =getc( in_fp ))= EOF ){ if
(isalpha (nextChar)) charClass = LETTER; else if (isdigit(nextChar)) charClass = DIGIT; else
charClass = UNKNOWN; 3 else charClass =EOF; }
/******************************************************/ / getNonBlank - a function to call getChar until it
returns a non-whitespace character */ void getNonBlank( ) { while (isspace (nextChar)) getChar ( )
} I *******************************************************/ /* lex - a simple lexical analyzer for arithmetic
expressions / int lex(){ lexLen =0; getNonBlank ( ); switch (charClass) { /* Parse identifiers */ case
LETTER: addChar ( ) ;

Weitere ähnliche Inhalte

Ähnlich wie CONVERT THIS C CODE TO JAVA frontc a lexical an.pdf

Embedded JavaScript
Embedded JavaScriptEmbedded JavaScript
Embedded JavaScriptJens Siebert
 
Data structuresUsing java language and develop a prot.pdf
Data structuresUsing java language and develop a prot.pdfData structuresUsing java language and develop a prot.pdf
Data structuresUsing java language and develop a prot.pdfarmyshoes
 
Debugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 VersionDebugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 VersionIan Barber
 
Hacking Parse.y with ujihisa
Hacking Parse.y with ujihisaHacking Parse.y with ujihisa
Hacking Parse.y with ujihisaujihisa
 
Bare metal performance in Elixir
Bare metal performance in ElixirBare metal performance in Elixir
Bare metal performance in ElixirAaron Seigo
 
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 3 of 5 b...
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 3 of 5  b...Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 3 of 5  b...
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 3 of 5 b...ssuserd6b1fd
 
Lab Assignment 4 CSE330 Spring 2014 Skeleton Code for ex.docx
 Lab Assignment 4 CSE330 Spring 2014  Skeleton Code for ex.docx Lab Assignment 4 CSE330 Spring 2014  Skeleton Code for ex.docx
Lab Assignment 4 CSE330 Spring 2014 Skeleton Code for ex.docxMARRY7
 
Unit 4
Unit 4Unit 4
Unit 4siddr
 
Debugging: Rules & Tools
Debugging: Rules & ToolsDebugging: Rules & Tools
Debugging: Rules & ToolsIan Barber
 
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)CODE BLUE
 
__MACOSX._assign3assign3.DS_Store__MACOSXassign3._.D.docx
__MACOSX._assign3assign3.DS_Store__MACOSXassign3._.D.docx__MACOSX._assign3assign3.DS_Store__MACOSXassign3._.D.docx
__MACOSX._assign3assign3.DS_Store__MACOSXassign3._.D.docxodiliagilby
 
Db2 For I Parallel Data Load
Db2 For I Parallel Data LoadDb2 For I Parallel Data Load
Db2 For I Parallel Data LoadThomas Wolfe
 
Write message.cpp and priorityq.cpp. The code in message.cpp and pri.pdf
Write message.cpp and priorityq.cpp. The code in message.cpp and pri.pdfWrite message.cpp and priorityq.cpp. The code in message.cpp and pri.pdf
Write message.cpp and priorityq.cpp. The code in message.cpp and pri.pdfeyeonsecuritysystems
 
Please do Part A, Ill be really gratefulThe main.c is the skeleto.pdf
Please do Part A, Ill be really gratefulThe main.c is the skeleto.pdfPlease do Part A, Ill be really gratefulThe main.c is the skeleto.pdf
Please do Part A, Ill be really gratefulThe main.c is the skeleto.pdfaioils
 

Ähnlich wie CONVERT THIS C CODE TO JAVA frontc a lexical an.pdf (20)

Gps c
Gps cGps c
Gps c
 
Embedded JavaScript
Embedded JavaScriptEmbedded JavaScript
Embedded JavaScript
 
Data structuresUsing java language and develop a prot.pdf
Data structuresUsing java language and develop a prot.pdfData structuresUsing java language and develop a prot.pdf
Data structuresUsing java language and develop a prot.pdf
 
Workshop 10: ECMAScript 6
Workshop 10: ECMAScript 6Workshop 10: ECMAScript 6
Workshop 10: ECMAScript 6
 
Debugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 VersionDebugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 Version
 
Hacking Parse.y with ujihisa
Hacking Parse.y with ujihisaHacking Parse.y with ujihisa
Hacking Parse.y with ujihisa
 
Bare metal performance in Elixir
Bare metal performance in ElixirBare metal performance in Elixir
Bare metal performance in Elixir
 
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 3 of 5 b...
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 3 of 5  b...Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 3 of 5  b...
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 3 of 5 b...
 
Lab Assignment 4 CSE330 Spring 2014 Skeleton Code for ex.docx
 Lab Assignment 4 CSE330 Spring 2014  Skeleton Code for ex.docx Lab Assignment 4 CSE330 Spring 2014  Skeleton Code for ex.docx
Lab Assignment 4 CSE330 Spring 2014 Skeleton Code for ex.docx
 
Unit 4
Unit 4Unit 4
Unit 4
 
Debugging: Rules & Tools
Debugging: Rules & ToolsDebugging: Rules & Tools
Debugging: Rules & Tools
 
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
 
Php 5.6
Php 5.6Php 5.6
Php 5.6
 
System programs in C language.
System programs in C language.System programs in C language.
System programs in C language.
 
__MACOSX._assign3assign3.DS_Store__MACOSXassign3._.D.docx
__MACOSX._assign3assign3.DS_Store__MACOSXassign3._.D.docx__MACOSX._assign3assign3.DS_Store__MACOSXassign3._.D.docx
__MACOSX._assign3assign3.DS_Store__MACOSXassign3._.D.docx
 
Db2 For I Parallel Data Load
Db2 For I Parallel Data LoadDb2 For I Parallel Data Load
Db2 For I Parallel Data Load
 
Write message.cpp and priorityq.cpp. The code in message.cpp and pri.pdf
Write message.cpp and priorityq.cpp. The code in message.cpp and pri.pdfWrite message.cpp and priorityq.cpp. The code in message.cpp and pri.pdf
Write message.cpp and priorityq.cpp. The code in message.cpp and pri.pdf
 
PL-SQL.pdf
PL-SQL.pdfPL-SQL.pdf
PL-SQL.pdf
 
Please do Part A, Ill be really gratefulThe main.c is the skeleto.pdf
Please do Part A, Ill be really gratefulThe main.c is the skeleto.pdfPlease do Part A, Ill be really gratefulThe main.c is the skeleto.pdf
Please do Part A, Ill be really gratefulThe main.c is the skeleto.pdf
 
C tutorial
C tutorialC tutorial
C tutorial
 

Mehr von devangmittal4

Continuous bag of words cbow word2vec word embedding work .pdf
Continuous bag of words cbow word2vec word embedding work .pdfContinuous bag of words cbow word2vec word embedding work .pdf
Continuous bag of words cbow word2vec word embedding work .pdfdevangmittal4
 
Continuous variable X is uniformly distributed the interval .pdf
Continuous variable X is uniformly distributed the interval .pdfContinuous variable X is uniformly distributed the interval .pdf
Continuous variable X is uniformly distributed the interval .pdfdevangmittal4
 
Construct a diversity matrix table and cladogram that compar.pdf
Construct a diversity matrix table and cladogram that compar.pdfConstruct a diversity matrix table and cladogram that compar.pdf
Construct a diversity matrix table and cladogram that compar.pdfdevangmittal4
 
Containerization has revolutionized shipping Use the infor.pdf
Containerization has revolutionized shipping  Use the infor.pdfContainerization has revolutionized shipping  Use the infor.pdf
Containerization has revolutionized shipping Use the infor.pdfdevangmittal4
 
Create a class for a course called hasa This class will hav.pdf
Create a class for a course called hasa This class will hav.pdfCreate a class for a course called hasa This class will hav.pdf
Create a class for a course called hasa This class will hav.pdfdevangmittal4
 
Create a C program which performs the addition of two comple.pdf
Create a C program which performs the addition of two comple.pdfCreate a C program which performs the addition of two comple.pdf
Create a C program which performs the addition of two comple.pdfdevangmittal4
 
Create a 6 to 8slide Microsoft PowerPoint presentation .pdf
Create a 6 to 8slide Microsoft PowerPoint presentation .pdfCreate a 6 to 8slide Microsoft PowerPoint presentation .pdf
Create a 6 to 8slide Microsoft PowerPoint presentation .pdfdevangmittal4
 
Create a 12 to 14slide presentation with detailed speaker .pdf
Create a 12 to 14slide presentation with detailed speaker .pdfCreate a 12 to 14slide presentation with detailed speaker .pdf
Create a 12 to 14slide presentation with detailed speaker .pdfdevangmittal4
 
CRANdan dslabs paketini kurun ardndan library komutuyla .pdf
CRANdan dslabs paketini kurun ardndan library komutuyla .pdfCRANdan dslabs paketini kurun ardndan library komutuyla .pdf
CRANdan dslabs paketini kurun ardndan library komutuyla .pdfdevangmittal4
 
Craft a script in a file named plusQ1 that prompts the us.pdf
Craft a script in a file named plusQ1 that  prompts the us.pdfCraft a script in a file named plusQ1 that  prompts the us.pdf
Craft a script in a file named plusQ1 that prompts the us.pdfdevangmittal4
 
Crane Company had a beginning inventory of 100 units of Prod.pdf
Crane Company had a beginning inventory of 100 units of Prod.pdfCrane Company had a beginning inventory of 100 units of Prod.pdf
Crane Company had a beginning inventory of 100 units of Prod.pdfdevangmittal4
 
Coursera learning python interacting with operating system .pdf
Coursera learning python interacting with operating system .pdfCoursera learning python interacting with operating system .pdf
Coursera learning python interacting with operating system .pdfdevangmittal4
 
Crane Company manufactures pizza sauce through two productio.pdf
Crane Company manufactures pizza sauce through two productio.pdfCrane Company manufactures pizza sauce through two productio.pdf
Crane Company manufactures pizza sauce through two productio.pdfdevangmittal4
 
CPP Introduction types of benefits eligibility of benefit.pdf
CPP Introduction types of benefits eligibility of benefit.pdfCPP Introduction types of benefits eligibility of benefit.pdf
CPP Introduction types of benefits eligibility of benefit.pdfdevangmittal4
 
COVID19 is going to change the way fast food restaurants pr.pdf
COVID19 is going to change the way fast food restaurants pr.pdfCOVID19 is going to change the way fast food restaurants pr.pdf
COVID19 is going to change the way fast food restaurants pr.pdfdevangmittal4
 
Course Organization Modeling for DT 11 The Ecosystem map .pdf
Course Organization Modeling for DT 11 The Ecosystem map .pdfCourse Organization Modeling for DT 11 The Ecosystem map .pdf
Course Organization Modeling for DT 11 The Ecosystem map .pdfdevangmittal4
 
cowan Company currently pays a 300 dividend The Board has.pdf
cowan Company currently pays a 300 dividend The Board has.pdfcowan Company currently pays a 300 dividend The Board has.pdf
cowan Company currently pays a 300 dividend The Board has.pdfdevangmittal4
 
country is Ethiopia Use the UNCTAD STAT Country Profile site.pdf
country is Ethiopia Use the UNCTAD STAT Country Profile site.pdfcountry is Ethiopia Use the UNCTAD STAT Country Profile site.pdf
country is Ethiopia Use the UNCTAD STAT Country Profile site.pdfdevangmittal4
 
Course Participation Strategies to Compete in the Markets .pdf
Course Participation  Strategies to Compete in the Markets .pdfCourse Participation  Strategies to Compete in the Markets .pdf
Course Participation Strategies to Compete in the Markets .pdfdevangmittal4
 
Course ELECTRONIC HEALTH RECORDS Feild of Study INFORMATI.pdf
Course ELECTRONIC HEALTH RECORDS Feild of Study INFORMATI.pdfCourse ELECTRONIC HEALTH RECORDS Feild of Study INFORMATI.pdf
Course ELECTRONIC HEALTH RECORDS Feild of Study INFORMATI.pdfdevangmittal4
 

Mehr von devangmittal4 (20)

Continuous bag of words cbow word2vec word embedding work .pdf
Continuous bag of words cbow word2vec word embedding work .pdfContinuous bag of words cbow word2vec word embedding work .pdf
Continuous bag of words cbow word2vec word embedding work .pdf
 
Continuous variable X is uniformly distributed the interval .pdf
Continuous variable X is uniformly distributed the interval .pdfContinuous variable X is uniformly distributed the interval .pdf
Continuous variable X is uniformly distributed the interval .pdf
 
Construct a diversity matrix table and cladogram that compar.pdf
Construct a diversity matrix table and cladogram that compar.pdfConstruct a diversity matrix table and cladogram that compar.pdf
Construct a diversity matrix table and cladogram that compar.pdf
 
Containerization has revolutionized shipping Use the infor.pdf
Containerization has revolutionized shipping  Use the infor.pdfContainerization has revolutionized shipping  Use the infor.pdf
Containerization has revolutionized shipping Use the infor.pdf
 
Create a class for a course called hasa This class will hav.pdf
Create a class for a course called hasa This class will hav.pdfCreate a class for a course called hasa This class will hav.pdf
Create a class for a course called hasa This class will hav.pdf
 
Create a C program which performs the addition of two comple.pdf
Create a C program which performs the addition of two comple.pdfCreate a C program which performs the addition of two comple.pdf
Create a C program which performs the addition of two comple.pdf
 
Create a 6 to 8slide Microsoft PowerPoint presentation .pdf
Create a 6 to 8slide Microsoft PowerPoint presentation .pdfCreate a 6 to 8slide Microsoft PowerPoint presentation .pdf
Create a 6 to 8slide Microsoft PowerPoint presentation .pdf
 
Create a 12 to 14slide presentation with detailed speaker .pdf
Create a 12 to 14slide presentation with detailed speaker .pdfCreate a 12 to 14slide presentation with detailed speaker .pdf
Create a 12 to 14slide presentation with detailed speaker .pdf
 
CRANdan dslabs paketini kurun ardndan library komutuyla .pdf
CRANdan dslabs paketini kurun ardndan library komutuyla .pdfCRANdan dslabs paketini kurun ardndan library komutuyla .pdf
CRANdan dslabs paketini kurun ardndan library komutuyla .pdf
 
Craft a script in a file named plusQ1 that prompts the us.pdf
Craft a script in a file named plusQ1 that  prompts the us.pdfCraft a script in a file named plusQ1 that  prompts the us.pdf
Craft a script in a file named plusQ1 that prompts the us.pdf
 
Crane Company had a beginning inventory of 100 units of Prod.pdf
Crane Company had a beginning inventory of 100 units of Prod.pdfCrane Company had a beginning inventory of 100 units of Prod.pdf
Crane Company had a beginning inventory of 100 units of Prod.pdf
 
Coursera learning python interacting with operating system .pdf
Coursera learning python interacting with operating system .pdfCoursera learning python interacting with operating system .pdf
Coursera learning python interacting with operating system .pdf
 
Crane Company manufactures pizza sauce through two productio.pdf
Crane Company manufactures pizza sauce through two productio.pdfCrane Company manufactures pizza sauce through two productio.pdf
Crane Company manufactures pizza sauce through two productio.pdf
 
CPP Introduction types of benefits eligibility of benefit.pdf
CPP Introduction types of benefits eligibility of benefit.pdfCPP Introduction types of benefits eligibility of benefit.pdf
CPP Introduction types of benefits eligibility of benefit.pdf
 
COVID19 is going to change the way fast food restaurants pr.pdf
COVID19 is going to change the way fast food restaurants pr.pdfCOVID19 is going to change the way fast food restaurants pr.pdf
COVID19 is going to change the way fast food restaurants pr.pdf
 
Course Organization Modeling for DT 11 The Ecosystem map .pdf
Course Organization Modeling for DT 11 The Ecosystem map .pdfCourse Organization Modeling for DT 11 The Ecosystem map .pdf
Course Organization Modeling for DT 11 The Ecosystem map .pdf
 
cowan Company currently pays a 300 dividend The Board has.pdf
cowan Company currently pays a 300 dividend The Board has.pdfcowan Company currently pays a 300 dividend The Board has.pdf
cowan Company currently pays a 300 dividend The Board has.pdf
 
country is Ethiopia Use the UNCTAD STAT Country Profile site.pdf
country is Ethiopia Use the UNCTAD STAT Country Profile site.pdfcountry is Ethiopia Use the UNCTAD STAT Country Profile site.pdf
country is Ethiopia Use the UNCTAD STAT Country Profile site.pdf
 
Course Participation Strategies to Compete in the Markets .pdf
Course Participation  Strategies to Compete in the Markets .pdfCourse Participation  Strategies to Compete in the Markets .pdf
Course Participation Strategies to Compete in the Markets .pdf
 
Course ELECTRONIC HEALTH RECORDS Feild of Study INFORMATI.pdf
Course ELECTRONIC HEALTH RECORDS Feild of Study INFORMATI.pdfCourse ELECTRONIC HEALTH RECORDS Feild of Study INFORMATI.pdf
Course ELECTRONIC HEALTH RECORDS Feild of Study INFORMATI.pdf
 

Kürzlich hochgeladen

Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)cama23
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxMusic 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxleah joy valeriano
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 

Kürzlich hochgeladen (20)

Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxMusic 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 

CONVERT THIS C CODE TO JAVA frontc a lexical an.pdf

  • 1. CONVERT THIS C CODE TO JAVA ...... /* front.c - a lexical analyzer system for simple arithmeticexpressions/ #include #include /* Global declarations / / Variables / int charClass; char lexeme [100]; char nextChar; int lexLen; int token; int nextToken; FILE in_fp, fopen(); /* Function declarations / void addChar(); void getChar(); void getNonBlank(); int lex(); /* Character classes / #define LETTER 0 #define DIGIT 1 #define UNKNOWN 99 /* Token codes / #define INT_LIT 10 #define IDENT 11 #define ASSIGN_OP 20 #define ADD_OP 21 #define SUB_OP 22 #define MULT_OP 23 #define DIV_OP 24 #define LEFT_PAREN 25 #define RIGHT_PAREN 26 // / main driver / main() { / Open the input data file and process its contents / if ((in fp = fopen("front.in", r " ))= NULL) printf("ERROR - cannot open front.in n"); else {getChar (); do { lex(); } while (nextToken! = EOF); // /* lookup - a function to lookup operators and parentheses and return the token / int lookup(char ch) { switch (ch) { case ' ( ': addChar(); nextToken = LEFT_PAREN ; break; case ')': addChar () ; nextToken = RIGHT_PAREN ; break; case '+': addChar (); nextToken = ADD_OP; break; case '-': addChar () ; nextToken = SUB_OP; break; case ' ': addChar (); nextToken = MULT_OP; break; case ' / ': addChar(); nextToken = DIV_OP; break; default: addChar(); nextToken = EOF; break; } return nextToken;} /*******************************************************/ / addChar - a function to add nextChar to lexeme */ void addChar ( ) { if (lexLen <= 98 ) { lexeme[lexLen++] , nextChar; lexeme[lexLen] =0; } else printf("Error - lexeme is too long n); /*****************************************************/ / getChar - a function to get the next character of input and determine its character class */ void getChar( ) if (( nextChar =getc( in_fp ))= EOF ){ if (isalpha (nextChar)) charClass = LETTER; else if (isdigit(nextChar)) charClass = DIGIT; else charClass = UNKNOWN; 3 else charClass =EOF; } /******************************************************/ / getNonBlank - a function to call getChar until it returns a non-whitespace character */ void getNonBlank( ) { while (isspace (nextChar)) getChar ( ) } I *******************************************************/ /* lex - a simple lexical analyzer for arithmetic expressions / int lex(){ lexLen =0; getNonBlank ( ); switch (charClass) { /* Parse identifiers */ case LETTER: addChar ( ) ;