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
Solved

problem with coding BNF

Posted on 2003-10-23
5
180 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Suggested Solutions

Title # Comments Views Activity
web services creation SOAP vs REST 5 56
How to convert String matching to regex in java 4 48
arguments to jar 5 33
Html Table Looping (part 2) 5 27
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
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 how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

808 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