WebHome
-
UHC
-
EHC
-
Documentation
-
Features & Status
-
EH examples
-
Feedback
-
News
-
FAQ
Related
-
Ruler
-
Shuffle
-
uulib & uuagc
Old Stuff
-
Previous WebHome
-
AFP2004
Center
Master Program
Center
Home
Courses
People
Projects
Page
Edit Page
Rename Page
Attach File
Printable
Wiki Source
More ...
Web
Recent Changes
Notify Service
News
Page Index
Search
More ...
Wiki
About TWiki
Text Formatting
Registration
Change Password
Reset Password
Users
Groups
Log In
or
Register
AFP2004
Ehc
%TOC% ---+ AG material * [[%ATTACHURL%/AgTutorial.pdf][Slides]] of the preschool AG tutorial. * AG [[%ATTACHURL%/AGman.pdf][manual]]. * [[%ATTACHURL%/afp2004.pdf][Paper]] and [[%ATTACHURL%/afp2004-slides.pdf][slides]] of "Typing Haskell with an Attribute Grammar". The paper will appear in the proceedings in a corrected and adapted form. ---+ EH compilers The set of compilers is described during the [[http://www.cs.ut.ee/afp04/][AFP 2004 summerschool]]. * The set of compiler version which is consistent with the distributed [[%ATTACHURL%/afp2004.pdf][paper]] can be downloaded [[%ATTACHURL%/afp04-20040811-ehc.zip][here]]. Each compiler resides in its own directory with a Makefile. Just type 'make' to create a compiler. * Sources of the EH programs used as an example in the paper: [[%ATTACHURL%/test.tgz][test.tgz]] * For installation on your own machine you need to install the UUST library. Currently no prebuild installations exist but the library can be cvs'd: <verbatim> % cvs -d :pserver:anonymous@cvs.cs.uu.nl:/data/cvs-rep login % cvs -d :pserver:anonymous@cvs.cs.uu.nl:/data/cvs-rep checkout uust </verbatim> * The file INSTALL.html contains the install instructions: <verbatim> % ./configure % make % sudo make install </verbatim> * The configure/build process assumes the presence of Hugs. This has not yet been fixed. ---+ Lab exercises ---++ Exercise 1: Extending the html example from the preschool presentation The AG file [[%ATTACHURL%/Main.ag][Main.ag]] implements the html generation from the [[%ATTACHURL%/AgTutorial.pdf][preschool tutorial]]. It produces (for test nr 5) the output found [[%ATTACHURL%/ostart.html][here]]. 1 Make a mistake in the input file, and notice how the parser combinators that are being used inside AG try to correct your input. 1 Comment out the largest part of the file, and inspect the generated code. Pay especially attention to the automatically generated copy rules. 1 Adapt Main.ag so that it creates a html file with prev/next links, as the example output [[%ATTACHURL%/o.html][here]] shows. 1 Extend the html generation further with an up/down button. The up button leads to a section one level higher, if present. The down button leads to the first subsection of a section, if present. Compile and run the given Main.ag by <verbatim> % uuagc -a Main.ag % ghc -package uust --make -o html Main.hs % ./html 5 </verbatim> The compilation requires the uust library (see EH compilers for installation instructions) which is installed on all Unix lab machines. ---++ Exercise 2: Pretty printing The file [[%ATTACHURL%/Slides.ag][Slides.ag]] is the starting point of this exercise. It was constructed out of the text of the Pretty Printing paper (with a few small corrections with respect to the paper version). 1 Change the attribute grammar so it will never put more than _ribbon_ width data on a line. This is to avoid unpleasingly long lines. 1 Check the functionality by experimenting with the width _w_. 1 Add the possibility to add vertical composition, in which you can place text elements in a stacked way. Compilation and running is similar to the previous exercise. -- Main.AtzeDijkstra - 19 Aug 2004