• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

implementing a top-down parser

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic