1 author: Julien Moutinho <julm+lol@autogeree.net>
2 -- bug-reports: http://doc.autogeree.net/lol/bugs
9 Demonstration code gathering important ideas from the
10 <http://okmij.org/ftp/tagless-final/ Tagless-Final>
11 approach to Embedded DSL (Domain-Specific Language)
12 developed by Jacques Carette, Oleg Kiselyov and Chung-chieh Shan,
13 and pursuing this work to use it as a non-Embedded DSL.
15 For a few example types (function, 'Bool', 'Int', 'Maybe')
16 a so-called /symantic/ type class defines a /syntax/
17 and each of its instances defines a new /semantic/
18 (computing a Haskell term, serializing, optimizing, …).
20 Combining the methods of those /symantic/ type classes
21 gives rise to a DSL within which one can
22 write /symantic/ expressions at developing time;
23 but in order to handle such expression when entered by an end-user
24 (for instance as a query for a search engine,
25 or a formula in a spreadsheet),
26 one has to be able to construct it at runtime,
27 that is, to be able to:
29 * Parse a /symantic/ expression
30 from an AST (Abstract Syntax Tree).
32 * Remove or add /symantic/ parsers
33 by fully reusing old parsers
34 (i.e. without copying or alterating them).
36 * Interpret a /symantic/ expression
37 multiple times and with different interpreters
38 without reparsing the expression.
40 This is what this code (including its Test.hs files) demonstrates.
41 Your comments, problem reports, or questions are very welcome! :-)
44 -- homepage: http://pad.autogeree.net/informatique/lol/symantic/
47 maintainer: Julien Moutinho <julm+lol@autogeree.net>
49 stability: experimental
50 synopsis: Demo of Typed Tagless-Final Higher-Order Extensible DSL
51 tested-with: GHC==7.10.3
54 Source-Repository head
55 location: git://git.autogeree.net/lol
60 Description: Turn on development settings.
65 Description: Dump some intermediate files.
70 Description: Turn on profiling settings.
75 Description: Enable threads.
80 ghc-options: -Wall -fno-warn-tabs
82 cpp-options: -DDEVELOPMENT
85 -- -fno-warn-unused-do-bind -fno-warn-name-shadowing -fno-warn-missing-signatures
86 -- -fno-warn-type-defaults -fno-warn-orphans
88 ghc-options: -ddump-simpl -ddump-stg -ddump-to-file
90 cpp-options: -DPROFILING
91 ghc-options: -fprof-auto
92 default-language: Haskell2010
95 Language.LOL.Symantic.AST
96 Language.LOL.Symantic.Expr
97 Language.LOL.Symantic.Expr.Bool
98 Language.LOL.Symantic.Expr.Common
99 Language.LOL.Symantic.Expr.Int
100 Language.LOL.Symantic.Expr.Lambda
101 Language.LOL.Symantic.Expr.Maybe
102 Language.LOL.Symantic.Lib.Control.Monad
103 Language.LOL.Symantic.Repr
104 Language.LOL.Symantic.Repr.Dup
105 Language.LOL.Symantic.Repr.Host
106 Language.LOL.Symantic.Repr.String
107 Language.LOL.Symantic.Trans
108 Language.LOL.Symantic.Trans.Bool
109 Language.LOL.Symantic.Trans.Bool.Const
110 Language.LOL.Symantic.Trans.Common
111 Language.LOL.Symantic.Type
112 Language.LOL.Symantic.Type.Bool
113 Language.LOL.Symantic.Type.Common
114 Language.LOL.Symantic.Type.Fun
115 Language.LOL.Symantic.Type.Int
116 Language.LOL.Symantic.Type.Maybe
120 , monad-classes >= 0.3.1.1
125 Test-Suite lol-symantic-test
126 type: exitcode-stdio-1.0
129 default-language: Haskell2010
130 ghc-options: -Wall -fno-warn-tabs
132 hs-source-dirs: Language/LOL/Symantic
144 Trans.Bool.Const.Test
149 ghc-options: -threaded -rtsopts -with-rtsopts=-N
151 cpp-options: -DDEVELOPMENT
154 cpp-options: -DPROFILING
155 ghc-options: -fprof-auto