Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Putative Assignment: Symbolic Evaluation of Boolean Expressions in Java

Background

Comp 411 presumes familiarity with functional programming in Scheme and mastery of object-oriented design in Java, most notably how to write functional programs (programs only involving immutable objects).  Historically, the courses Comp 210 and 212 (and later Comp 211) covered this material.  Several years ago, the core programming curriculum was revised, de-emphasizing functional programming and object-oriented design.  As a result, some undergraduate students may not be prepared for this course.   This web page presents a functional programming assignment in Java where the behavior of the Java is specified by a purely functional program in Scheme.   Students who enroll in this course should be comfortable tackling assignments like this one taken directly from Comp 211 in 2011.

Overview

Write a Java program boolSimpBoolSimp.java that reduces boolean expressions (represented in the input and output streams in Scheme-like notation) to simplified form. For the purposes of this assignment, boolean expressions are Scheme expressions constructed from:

...

  • a Scheme program in the file boolsimp.ss equivalent to the Java program that you are required to write;
  • a Java "stub" file BoolSimp.java for your program that defines a composite hierarchy of "abstract syntax" tree classes rooted in the class Form representing boolean expressions;
  • a Java library file Parser.java containing a class Parser with
    • a read() method that reads a boolean expression represented in "Scheme form" and returns the corresponsing Java Form abstract syntax tree and
    • a reduce() method that composes the visitors you must write in boolSimp.dj in  to reduce whatever formula the Parser instance contains to simplified form.
  • a Java "stub" test file BoolSimpTest.java that includes some rudimentary tests of the code in the BoolSimp.java stub file.

...