Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

problem with coding BNF

Posted on 2003-10-23
5
Medium Priority
?
189 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 15

Accepted Solution

by:
jimmack earned 100 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

597 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