Solved

problem with coding BNF

Posted on 2003-10-23
5
177 Views
Last Modified: 2010-05-18
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
Comment
Question by:badr1981
  • 2
  • 2
5 Comments
 
LVL 15

Accepted Solution

by:
jimmack earned 50 total points
ID: 9606637
Post the code you have written so far, then ask for help with the problem area.
0
 

Author Comment

by:badr1981
ID: 9606684
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
 

Expert Comment

by:PaulFranz
ID: 9608199
I would use JavaCC it will do this for you.
0
 

Author Comment

by:badr1981
ID: 9610847
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
 
LVL 15

Expert Comment

by:jimmack
ID: 9610868
Just in case PaulFranz isn't available at the moment, search for JavaCC on google.  There's a few links there.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Understanding websocket example in spring 1 54
groupSum5 challenge 5 68
Unable to start eclipse ? 17 128
Responding to Java JComponent extended classes's resize event 4 50
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now