Ask a question to Desklib · AI bot


Introduction to The First Programming Project

Added on -2019-09-13

| 3 pages
| 758 words

Trusted by 2+ million users,
1000+ happy students everyday

InstructionsThe first programming project involves writing a program that parses, usingrecursive descent, a GUI definition language defined in an input file and generates the GUI that it defines. The grammar for this language is defined below:gui ::= Window STRING '(' NUMBER ',' NUMBER ')' layout widgets End '.'layout ::= Layoutlayout_type ':'layout_type ::=Flow '(' [ align ] ')'| Border '(' [ NUMBER ',' NUMBER ] ')'| Grid '(' NUMBER ',' NUMBER [',' NUMBER ',' NUMBER] ')'align ::= LEFT | RIGHT | CENTER widgets ::= widget widgets | widgetwidget ::=Button STRING ';' |Groupradio_buttonsEnd ';' |Label STRING ';' |Panellayout widgetsEnd ';' |Textfield NUMBER ';'radio_buttons ::= radio_button radio_buttons | radio_buttonradio_button ::= Radio STRING ';'In the above grammar, the red symbols are nonterminals, the blue symbols are tokens and the black punctuation symbols are BNF metasymbols. Among the tokens those in title case are keywords. The character literals are punctuation tokens.Below is an explanation of the meaning of some of the symbols in the above productions that should help you understand the actions that are to be performed when each of the productions is parsed:In thewindowproduction the string is name that is to appear in the top border of the window and the two numbers are the width and height of the windowIn the production forlayout_typethat define the grid layout, the first two numbers represent the number of rows and columns, and the optional next two the horizontal and vertical gaps

Found this document preview useful?

You are reading a preview
Upload your documents to download
Become a Desklib member to get accesss

Students who viewed this