Continue discussion of regular expressions and parsing tools.
Information about how to use Lex and YACC is available at this compact guide to lex and yacc
Haskell Cheat Sheet by Justin Bailey pdf Haskell cheat sheet by Wincent Colaiuta pdf (rails.wincent.com) Haskell Cheat Sheet by Scott Turner pdf (pkturner.org) Haskell Cheat Sheet by Christopher Maneu pdf (maneu.fr c-maneu.developpez.com). Haskell can usually derive functor instances since they areunique: Only one possibledefinitionof fmapwillwork. Reading the functor axioms left-to-right, they can be seen as optimisation laws. Haskell Cheat Sheet maneu.fr c-maneu.developpez.com λ Christopher MANEU Creative Commons Licence BY-NC-ND BASICS Comments All comments start with two hyphens - This is a comment in the code Data Types Haskell uses various data types, all of them starts by a capital letter: Int: Integer number with fixed precision. Haskell/GHC symbol search cheatsheet. Several features of Haskell/GHC have low googleability. Because some of them are composed of symbols:) This page is a reference collection to support search of them. Haskell Cheat Sheet This cheat sheet lays out the fundamental ele-ments of the Haskell language: syntax, keywords and other elements. It is presented as both an ex-ecutable Haskell file and a printable document. Load the source into your favorite interpreter to play with code samples shown. Basic Syntax Comments.
I will go through the example Lex/YACC program given in /afs/umbc.edu/users/n/i/nicholas/pub/331/lexYacc/calc. You can all make use of this from GL.
Programming Exercise: modify the Lex/YACC calculator example to support any four of the following five operations
(1) exponentiation using the caret (^) operator. Note that the ^ operator in C is not exponentiation. (If you use any C math functions in this project, you may need to add -lm to the gcc command in the makefile. The file in my pub directory has been updated.)
(2) hexadecimal constants of the form 0xff which for example is decimal 255.
(3) add the expr ? true_case : false_case for expressions, where the true_case is returned if the expr is not zero, otherwise the value of the false_case is returned
(4) scientifc notation, i.e. 1e-2 should be 0.01, while 2e3 should be 2000.
(5) a logical comparison operator , which evaluates to 0 or 1
Haskell Cheat Sheet
Submit your Lex and YACC files as attachments to an email. Also attach a typescript file that demonstrates the features of the program. Send that email to Rujuta Palande <palande1@umbc.edu> and cc me. I will demonstrate the script command on GL. Due before 5pm Friday 10/9/2015.