Given the following grammar for a subset of Ada:
Prog -> procedure idt Args is
DeclarativePart
Procedures
begin
SeqOfStatements
end idt;
DeclarativePart -> IdentifierList : TypeMark ; DeclarativePart | e
IdentifierList -> idt |
IdentifierList , idt
TypeMark -> integert | realt | chart | const assignop Value
Value -> NumericalLiteral
Procedures -> Prog Procedures | e
Args -> ( ArgList ) | e
ArgList -> Mode IdentifierList : TypeMark MoreArgs
MoreArgs -> ; ArgList | e
Mode -> in | out | inout | e
SeqOfStatments -> e
Draw the parse trees for the following programs (PLEASE UNDERLINE ALL TOKENS):
begin
end two;
end six;
begin
end three;
Hint: You will probably want to use your paper sideways. Save this grammar, as it will be used in the next assignment.
Reviews
There are no reviews yet.