~ubuntu-branches/ubuntu/trusty/happy/trusty-proposed

« back to all changes in this revision

Viewing changes to examples/glr/expr-monad/Hugs.lhs

  • Committer: Bazaar Package Importer
  • Author(s): Ian Lynagh (wibble)
  • Date: 2006-10-26 22:52:14 UTC
  • mfrom: (1.2.2 upstream) (3.1.1 dapper)
  • Revision ID: james.westby@ubuntu.com-20061026225214-6jmf0n3ykkc9elyw
Tags: 1.16~rc2-1
* New upstream (release candidate) version.
* Removed happy/ prefixes from various paths in debian/rules and
  debian/docs.
* doc/configure generated by autoconf is in the Debian diff.
* Build using cabal:
  * Various debian/rules changes.
  * Create debian/get_version.hs for extracting the version from the cabal
    file.
  * Requires ghc6 >= 6.4.2.
  * No longer tries to detect platform. Closes: #340325, #332979.
  * Removed autotool-dev build-dep.
* Add 'XSLTPROC_OPTS = --nonet' to doc/config.mk.in.
* Remove src/Parser.ly and src/AttrGrammarParser.ly before cleaning so
  the generated files don't get cleaned.
* Set Standards-Version to 3.7.2 (no changes needed).
* Removed PS and DVI stanzas from debian/doc-base as we don't build
  the documentation those ways.
* Removed content-free postinst and prerm.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
> module Main where
 
2
> import System(getArgs)
 
3
> import Maybe(fromJust)
 
4
> import FiniteMap(fmToList,lookupFM)
 
5
> import Expr
 
6
 
 
7
 
 
8
> main 
 
9
>  = do
 
10
>       [s] <- getArgs
 
11
>       test s
 
12
 
 
13
> test s 
 
14
>  = do
 
15
>       case doParse $ map (:[]) $ lexer s of 
 
16
>         ParseOK r f -> do 
 
17
>                           putStrLn $ "Ok " ++ show r ++ "\n" 
 
18
>                                       ++ unlines (map show $ fmToList f)
 
19
>                           let ms = decode (forest_lookup f) r ::[IO Int]
 
20
>                           mapM_ (\ma -> catch ma (\_ -> return 0) >>= print) ms
 
21
>         ParseEOF f  -> do 
 
22
>                           putStrLn $ "Premature end of input:\n" 
 
23
>                                       ++ unlines (map show $ fmToList f)
 
24
>         ParseError ts f -> do 
 
25
>                           putStrLn $ "Error: " ++ show ts
 
26
 
 
27
> forest_lookup f i 
 
28
>  = fromJust $ lookupFM f i