EECS 662

Programming Languages


EECS 662 Blog

Project 4 Test Case

As promised I have posted a factorial function you can use to test Projedct 4. If you download a new version of p4.hs it now has the test case at the bottom of the file. Alternatively, you can download the test cases in a separate file as p4-test.hs.

No Strings

I just fixed a typo in the description of interp in Project 4. In the project description, interp mapped a String to an output value implying that you need to write a parser. I do not want you to write a parser! interp should take an FBAE and produce an FBAEValue. The description has been corrected.

Hopefully you are working from p4.hs which specified the function signature correctly.

Final Exam Topics

I posted a list of topics for the final exam. You can find a link to the post in the section of the homepage.

Project 4 Posted

Project 4 is now available on the website. We will go over it in class next Tuesday, but feel freel to get started if you want to.

Project 3 Test Cases

As promised I have posted a set of test cases for Project 3. If you download a new version of p3.hs it now has test cases at the bottom of the file. Alternatively, you can download the test cases in a separate file as p3-test.hs.

There are two sets of test cases. The first 4 work with the CFAE interpreters. The last two should clearly show the difference between dynamic and static scoping. The second 4 work with the CFBAE interpreter and should give you the same results as the first 4 using static scoping. That makes sense as you’re using the statically scoped CFAE interpreter to evaluate elaborated CFBAE.

I made a small correction to p3.hs that caused problems if you compile the file before implementing your solution. The problem should not have affected anyone, but it annoyed me.

Finally, I replaced “*” with “+” in the project description as discussed in class. The description should now match the template file.

Project 3 Extension

Because my test cases were posted late, I’m extending the Project 3 deadline by 2 days. It is now due on April 26th.

Project 3 Updates Updates

I just pushed up a couple of corrections to Project 3 documentation and the template file. In the documentation, the template file link was named p2.h when it really pointed to p3.h. The link pointed to the right file, but the name was confusing.

In the project template I inadvertantly used Env in a couple of places I should have used Env'. My implementation worked fine because I did not use explicit function signatures and Haskell dutifully performed type inference and figured out the types.

I also had the elabCFAE function returning a Maybe when it didn’t need to. The elaborator will not throw and error on syntactically correct code, so there is no reason for the Maybe. You could use a Maybe type if you want, but it won’t buy you anything.

Hopefully the signature issues didn’t slow anyone down.

Project 3 Updates

I just pushed updates to Project 3. Lots of minor changes and hopefully nothing that would cause anyone distress. First, I added a project template file that provides AST structures and function types. This should make your life substantially simpler. Second, I removed some cruft from the project description about parsers. No more parsers. Finally, I did some editing and removed some language constructs that don’t add anything to the project.

The due date is set for April 24 - 1 week. We’ve done virtually all this code in class, so you should be able to crank through the implementation fairly quickly. New things include adding an if construct and writing the elaborator. We’ll go over the latter in class today, but I suspect you could figure it out if you took a shot at it.

Project 2 Updates

Several people have emailed asking about checking for negative numbers in your Project 2 interpreters. If you start with code from earlier projects it should be simple to implement negative number checks. However, I will not test how your interpreters handle negative values when I do my grading.

Project 2 Fixed

Project 2 is now what Project 2 was supposed to be - writing a pair of interpreters and a type inference function for the language we ended class with today. One interpreter will use subst while the other will use an environment. The type inference function will use a context and be integrated with the interpreter. Note that I did include a template file for you to work with.

No Office Hours 2/20

KU has canceled classes until 1:00 and my neighborhood is an ice sheet. Thus, I’m cancelling office hours today. I should still be able to get to class at 1:00.

DARPA Travel

I will be traveling to Washington DC for a DARPA project kickoff meeting February 21-23 and will miss class on the 22nd.

If you are interested, we are starting a new effort to inegrate semantic remote attestation with static analysis to assure system correctness. Our partners are Rockwell Collins and Data61 of seL4 verification fame. Great opportunity for KU students to work with two of the top formal verification teams in the world. If you want to know more, plese let me know and I will discuss in class or one-on-one.

Project 1 Due Date

You heard correctly in class. I pushed the due date for Project 1 to February 20. You earned the extension by asking great questions in class.

Project 1 Update

Some of you are having difficulties using p1.hs due to library issues. All the loaded libraries are related to Parsec and are thus not necessary. If you are having difficulties with p1.hs, I’ve created a new file, p1a.hs that does not include all the Parsec cruft and loads only the Monad library. Feel free to use it if you prefer or are having Parsec library issues.

Project 1

Project 1 is now available if you want to get started. I provided a template file that sets GHC options, defines the ABE and TABE data types, and defines signatures for each function required for the project.

Please note that the included parser is not required only for any of the exercises. I included it as another example of Parsec and a utility if you feel concrete syntax is easier to read and write than abstract syntax.

Project 0 Update Update

In class yesterday you guys pointed out that while I did update the Project 0 template file to return numbers from our interpreters, I did not update the project description. I just pushed an update that should take care of this. Sorry if this caused any confusion. To be clear, the signatures for the three interpreters should be:

evalAE :: AE -> Int

evalAEMaybe :: AE -> Maybe Int

evalM :: AE -> Maybe Int

interpAE :: String -> Maybe Int

One other quick thing. I have provided dummy imlementations of the interpreters so Haskell will compile the file without complaint. The line below each signature is this dummy interpreter. Do not keep these things in your final interpreter! Delete the dummies as you write your solutions.

Project 0 Update

I just pushed a new version of p0.h to the class website with corrected evaluator signatures. Sorry to those who imlemented the evaluators with the original definitions. Should be very easy to fix.

Num Clarification

You can assume the parser will make sure that (Num n) never contains a negative number. This is what we did in class and it’s fine for the project as well.

For example, in:

(Minus (Num n) (Num m))

n and m will never be negative, but if n=2 and m=3:

(Minus (Num 2) (Num 3))

will result in a negative number and should throw an error.

No Class January 30

There will be no class on January 30. I will be traveling to Boston to work on a language for describing attestation protocols on Monday and I can’t get back in time for class Tuesday.

I will hold an optional make-up lecture later in the semester for those who are interested.

Project 0

Project 0 is now available if you want to get started. I provided a template file that sets GHC options, defines the AE data type, and defines signatures for each function required for the project. Hopefully this will help you get started.

Please note that a parser is required only for Exercise 4 and I provided the parser in the template file for you. Also note that numbers in this parser are natural and should never be negative. The example we did in class today allowed negative numbers.

We’ll talk about testing later, but if you are brave there is a QuickCheck implementation for part of this language in the examples associated with the text. I do not expect you to use QuickCheck, but I will use it for grading.


Welcome to the website for EECS 662 - Programming Languages at the University of Kansas. Contents of this blog are available via an Atom feed that can be viewed using any RSS reader. Use this url. Please check here frequently for breaking news and information about projects and exams.

This site is hosted on GitHub and constructed using GitHub Pages, Jekyll and Liquid Tags.

Language Extension

The language extension to use GADTs in the most recent versions of GHC is:


Include this pragma at the top of your source files and the GADT notation I use in class will be available.

GADT Notation

In my notes and in class I have been using the GADT notation when defining data types. I do this because it closely resembles other languages that I use and we will most likely use GADTs later in the semester.

If you prefer the traditional notation that you learned in 368, you are more than welcome to us it. For early projects, there is no read advantage to using the GADT notation.