17 Feb 2013 23:53
adding recursion to a DSL
<fritsch <at> joerg.cc>
2013-02-17 22:53:08 GMT
2013-02-17 22:53:08 GMT
I have a tiny DSL that actually works quite well. When I say
import language.CWMWL
main = runCWMWL $ do
out (matrixMult, A, 1, row, matrix-row)
then runCWMWL is a function that is exported by language.CWMWL. This parses the experession and takes some action.
Now, A is the name of the matrix and the third tuple element would represent the numbe of the row. For example 1
to 10000. I want to achieve some sort of "elegant" (means readable code, a good representation) recursion
that would let me do something like
sequence [ out (matrixMult, A, n, row, matrix-row) | n <- [1..1000] ]
but in a nicer manner an without expending this to 10000 lines of code at compile time.
How can I best introduce recursion into my DSL or borrow this from the host language Haskell "effectively"?
--Joerg
RSS Feed