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