GUI Definition Language Parser
Added on 2019-09-13
3 Pages758 Words389 Views
|
|
|
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
End of preview
Want to access all the pages? Upload your documents or become a member.
Related Documents