Compiler Design Practical

Verified

Added on  2019/09/13

|3
|666
|268
Practical Assignment
AI Summary
This document presents a practical assignment in compiler design. It includes several examples demonstrating different aspects of compiler construction, such as lexical analysis, syntax analysis, and GUI design. Each example shows the input file content, the expected output, and a space to fill in the program's output. The examples cover various scenarios, including lexical errors, syntax errors, and the creation of a simple calculator GUI with different layouts (Flow, Grid, Border) and nested panels. There's also an example showing the implementation of radio buttons. The assignment aims to test the student's understanding of compiler design principles and their ability to implement them practically.
Document Page
Example 1: Lexical error
File Contents (file "input1.txt") Actual Output
Window "Calculator" (200, 200) Layout Flow():
Textfield 20;
Panel Layout Grid(4, 3, 5, 5)|
Button "7";
Button "8";
Button "9";
Button "4";
Button "5";
Button "6";
Button "1";
Button "2";
Button "3";
Label "";
Button "0";
End;
End.
Lexical error! (please provide details)
Fill here the output from your program.
Example 2: Syntax error
File Contents (file "input2.txt") Actual Output
Window "Calculator" (200, 200) Layout
Flow(LEFT):
Textfield 20;
Panel Layout Grid(4, 3, 5, 5):
Button "7";
Button "8";
Button "9";
Button "4":
Button "5";
Button "6";
Button "1";
Button "2";
Button "3";
Label "";
Button "0";
End;
End.
Syntax error! (please provide details)
Fill here the output from your program.
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Example 3: Calculator v1
File Contents (file "input3.txt") Actual Output
Window "Calculator" (200, 200) Layout Flow(CENTER):
Textfield 20;
Panel Layout Grid(4, 3):
Button "7";
Button "8";
Button "9";
Button "4";
Button "5";
Button "6";
Button "1";
Button "2";
Button "3";
Label "";
Button "0";
End;
End.
Fill here the output from your program.
Example 4: Calculator v2
File Contents (file "input4.txt") Actual Output
Window "Calculator" (200, 200) Layout Border():
Textfield 20;
Label "-------------------";
Panel Layout Grid(4, 3, 5, 5):
Button "7";
Button "8";
Button "9";
Button "4";
Button "5";
Button "6";
Button "1";
Button "2";
Button "3";
Label "";
Button "0";
Label "-------------------";
End;
End.
Fill here the output from your program.
Document Page
Example 5: Radio buttons
File Contents (file "input5.txt") Actual Output
Window "Radio Button Test" (300, 200) Layout
Grid (5, 1):
Group
Radio "First";
Radio "Second";
Radio "Third";
Radio "Fourth";
Radio "Fifth";
End;
End.
Fill here the output from your program.
Example 6: Nested panels
File Contents (file "input6.txt") Actual Output
Window "Nested Panel Test" (550, 200) Layout
Border(4,5):
Label "Main Panel";
Panel Layout Flow(LEFT):
Panel Layout Flow(CENTER):
Panel Layout Flow(CENTER):
Panel Layout Flow(RIGHT):
Button "Fifth Panel";
End;
Button "Fourth Panel";
End;
Button "Third Panel";
End;
Button "Second Panel";
End;
End.
Fill here the output from your program.
chevron_up_icon
1 out of 3
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]