Documente Academic
Documente Profesional
Documente Cultură
appengine-generated
appengine-web.xml
conf
jsp
lib
messages
web.xml
Thank you for your bid. Looking forward to working with one of you.
Skills required:
Education & Tutoring, Java, Software Development
Project# 2
Creation of parsor, bid price 25 USD, in 3 days
Bid will end on 26 feb
Write a parser (using java programming language ) that can parse the language
generated by the following EBNF descriptions. Your parser should detect whether or
not the input program has any syntax errors. It does not have to specify what and
where the error is.
<program> begin <stmt_list> end
<stmt_list> <stmt> {;<stmt_list>}
<stmt> <assign_stmt> | <if_stmt> | <while_stmt>
<assign_stmt> <var> = <expr>
<var> identifier (An identifier is a string that begins with a letter followed by 0 or
more letters and digits)
<expr> <term> {(+ | -) <term> }
<term> <factor> {(* | /) <factor> }
<factor> identifier | int_constant | (<expr>)
<if_stmt> if (<logic_expr>) then <stmt>
<while_stmt> while (<logic_expr>) <stmt>
<logic_expr> <var> (> | <) <expr> (Assume that logic expressions have only
greater than or less than operators)
begin
You can use the following examples to test your parser.
An input program without syntax errors:
var3 = 140;
if (sum1 < sum2) then
var4 = sum2 - sum1
end
end
begin
var3 = var1 + var2;
if (sum1 < sum2) then
var4 = sum2 - sum1;
end
begin
The keyword begin is missing
var2 = var1
end
end
begin
total = var1 + var2;
fi (var1 < var2) then
if ( var3 > var4) then
var2 = var2 - var1
end