Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 193
  • Last Modified:

problem with coding BNF

hi all,

i have problem with coding BNF, so can any body help me with that
i want just small subprogram that chech the syntax error

example of BNF rule:
<program> -><stmts>
<stmts> -> <stmt>|<stmt>;<stmt>
<stmt> -> <var>=<expr>
<var> -> a | b | c | d
<expr> -> <term>+<term>|<term>-<term>
<term> -> <var> | const

where the symbol between< > represent non-terminal rule and other like +, -, = , ;, a, b, c, and d represent terminal symbols and | means OR option.......

this BNF could give such statement like a=b+const

the program should check whether the statement correct or not?

thank you
0
badr1981
Asked:
badr1981
  • 2
  • 2
1 Solution
 
jimmackCommented:
Post the code you have written so far, then ask for help with the problem area.
0
 
badr1981Author Commented:
i have not solve this quastion, i am working in large project and this subprogram that i face problem with it..... i don't know how to implement a BNF in java
0
 
PaulFranzCommented:
I would use JavaCC it will do this for you.
0
 
badr1981Author Commented:
how can i use JavaCC for this, i don't have any idea about JavaCC....

can you provide me with more informations about that

thank you
0
 
jimmackCommented:
Just in case PaulFranz isn't available at the moment, search for JavaCC on google.  There's a few links there.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now