• Post Reply Bookmark Topic Watch Topic
  • New Topic

implementing a top-down parser  RSS feed

 
Pepo moussa
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi i got this problem i been trying to fix it but can not get any good results

my code suppose 2 implement

<fun defs> → {<fun def>}+
<fun def> → <header> <body>
<header> → <fun name> "(" <parameter list> ")"
<fun name> → <id>
<parameter list> → ε | <id> {"," <id>}

this is my code so far


so if the input is as given func1( x1, x2, x3, x4, x5, x6, x7, b1 )
{// code
}
the out put should be like that
0 <fun defs>
1 <fun def>
2 <header> <fun name> func1
3 <parameter list> x1 x2 x3 x4 x5 x6 x7 b1
2 <body>

but my output is
0 <funDefs>
1 funDef
2 <Header> <fun name> 4 <Header> 5 <parameterList>
2 <body>

any help please thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!