Access over 20 million homework & study documents

Gui Parser

Content type
User Generated
Subject
Computer Science
Type
Homework
Rating
Showing Page:
1/22

Sign up to view the full document!

lock_open Sign Up
Showing Page:
2/22

Sign up to view the full document!

lock_open Sign Up
Showing Page:
3/22

Sign up to view the full document!

lock_open Sign Up
End of Preview - Want to read all 22 pages?
Access Now
Unformatted Attachment Preview
Source Code import import import import import java.awt.*; java.io.*; java.util.*; javax.swing.*; javax.swing.border.*; public class CMSC330P1 { final boolean debug = false; enum TokenType {NOT_FOUND, SEMICOLON, COMMA, STRING, WIDGET, END, WINDOW, LAYOUT, FLOW, BUTTON, LABEL, PANEL, TEXTFIELD, GRID, GROUP, RADIO, QUOTATION, OPEN_PARENTHESIS, CLOSE_PARENTHESIS, COLON, PERIOD, NUMBER, END_OF_FILE} enum Status {IN_PARENTHESIS, IN_QUOTATION, DEFAULT} Lexer lexer; Parser parser; public static void main(String[] args) { // ---- Setup ---- System.out.println("Alan Johnson, CMSC 330, Project 1\n"); // ---- Action ---- CMSC330P1 test = new CMSC330P1(); test.startOptions(); } // end main() method private void startOptions() { JFileChooser fc = new JFileChooser(); fc.setFileSelectionMode(JFileChooser.FILES_ONLY); int fcOption; do { fcOption = fc.showOpenDialog(null); } while (fcOption != JFileChooser.APPROVE_OPTION && fcOption != JFileChooser.CANCEL_OPTION); if (fcOption == JFileChooser.CANCEL_OPTION) return; File file = fc.getSelectedFile(); lexer = new Lexer(file); lexer.analyzeFile(); lexer.printTokens(); parser = new Parser(); if (parser.parseFile()) System.out.println("\n\nParse Pass!"); return; } // end startOptions() method private class Lexer { private File file; private char character; private int i; private TokenType lastToken; private Status status; private String line = "", currentLexeme; private ArrayList tokens; public Lexer (File _file) { if (_fil ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Anonymous
Just the thing I needed, saved me a lot of time.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4