Ditutup

recursive descent parser(repost)

<elist>-> <e><elist_tail>

<elist_tail>-> , <elist>

<elist_tail>->

<e>-><n><etail>

<etail>-> ^ <e>

<etail>->

<n>-><d><ntail>

<ntail>-> <n>

<ntail>->

<d>-> 0 |1 | 2| 3| 4| 5| 6| 7| 8| 9

by using above grammer implement recursive descent parser

the grammer generates statements of form 2^2^3,15,20^2 for which parser outputs 256 15 400

this is example which explains basic idea of rdp

note:?

1) keep all variables declared globally as they are except ? N_value

2) declare N_value locally to procedure E

3) make N_value a pass by value parameter to procedure ETAIL

4) make N_value pass by reference parameter to both procedure N and NTAIL

## Deliverables

procedure RDPARSER; while NOT EOF do SUCCEEDED = TRUE; GET_INP_LINE; //reads in the next input line GET_NEXT_SYMBOL; //returns the next input symbol ELIST; if SUCCEEDEDthen SUCCESS_MESSAGE;else FAILURE_MESSAGE enifendwhileend RDPARSER

Code:

procedure ELIST;E;if SUCCEEDED then ELIST_TAIL endifend ELIST;

Code:

procedure ELIST_TAIL;if EOLthen print E_Valueelse if next_inp_symbol = ","then print E_Value;GET_NEXT_SYMBOL;ELIST;else SUCCEEDED = FALSE endifendifend ELIST_TAIL;

Code:

procedure E;N_value = 0;N;if SUCCEEDEDthen ETAIL endifend E;

Code:

procedure ETAILif(NOT((next_inp_symbol = ",") OR EOL))then if next_inp_symbol = '^'then GET_NEXT_SYMBOL;E;E_value = N_value ** E_value;else SUCCEEDED = FALSE endifelse E_value = N_value enidfend ETAIL;

Code:

procedure N;D;if SUCCEEDEDthen N_value = N_value * 10 + D_value;NTAIL endifend N;

Code:

procedure NTAIL;if(NOT((next_inp_symbol = '^' | ',') OR EOL))then N endifend NTAIL;

Code:

procedure D;if next_inp_symbol is a digitthen compute D_value;GET_NEXT_SYMBOLelse SUCCEEDED = FALSE endifend D;

Kemahiran: Kejuruteraan, Java, MySQL, PHP, Pengurusan Projek

Tentang Majikan:
( 1 ulasan ) plainview, United States

ID Projek: #10111688

9 pekerja bebas membida secara purata $1613 untuk pekerjaan ini

it2051229

Hi there, I went through the requirements since it caught my interest. I have done recursive back tracking algorithm before for parsing BNF grammars. I would like to do this project if given the opportunity. Let me kno Lagi

$55 USD dalam sehari
(965 Ulasan)
7.4
londonlance

We are a London based Fullstack dev studio, we can deliver a top notch job for you. All our projects are version controlled with GIT (Github or Bitbucket). Following are some of our recent projects; https://postl Lagi

$4750 USD dalam 30 hari
(29 Ulasan)
7.0
shreeyait

Hello Sir, Hope you are fine there. We are having good experience with CorePHP projects and the reason we came across here to give the best output to your project with supreme quality. We have develope Lagi

$1000 USD dalam 20 hari
(55 Ulasan)
6.8
$333 USD dalam 3 hari
(51 Ulasan)
5.4
$2794 USD dalam 3 hari
(5 Ulasan)
4.7
anuragiitk

I am an IITK graduate, 9 year experienced software professional and I have got top notch developers in my team, who have got experience across a span of technologies. The members in my team have worked with top notch t Lagi

$2794 USD dalam 3 hari
(15 Ulasan)
4.5
supersuntech

Wordpress/PHP/Website Proposal Links Our Recent Work: Wordpress Website: [login to view URL]://[login to view URL] [login to view URL]://[login to view URL] [login to view URL]://[login to view URL] 4 [login to view URL] 5 sm Lagi

$2631 USD dalam 15 hari
(7 Ulasan)
4.2
NoumanHumayun

Hi there, I have a lot of experience in Automata theory and Compiler Construction, in fact I made a game using recursive descent algorithm. Let me know if you want my help Regards Nouman

$350 USD dalam 3 hari
(6 Ulasan)
3.4
prince2502

I have written more parsers in my life than I had crushes in my High School. In fact the last project I completed here on freelancer is a parser, should reflect in my history by the time you see it. I have worked on Lagi

$111 USD dalam 2 hari
(0 Ulasan)
0.0
makarovn

Hello. I've implemented many parsers (including recursive descent), and ready to complete your project in 1 day.

$30 USD dalam sehari
(0 Ulasan)
0.0