Click to See Complete Forum and Search --> : how to write a recursive descent parser with backtracking??


magneeto
August 18th, 2006, 05:36 PM
hi,

i need help in writing a general recursive descent parser with backtracking. i know the simple rule that we need a function for each nonterminal and then write each production as recursive functions. how do i include the backtracking facility? just help me with the general form. for example

S-> cAd
A-> ab|a

parseS(){

get_next_token();
parseA();
get_next_token();
}

parseA(){

if(current_token=='a')
get_next_token();
}

in this parser i did not include any error checking. am i correct and plzzzz help me where to define the backtracking.