<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
Hi,<br>
<br>
I'm am interested in creating an external DSL with Erlang and what
are the steps involved. So very basically I want to convert some
English like language into running erlang code. My goal is to build
up a full erlang source file relative to the dsl file I have as
input. I don't necessarily need to print out the source file to the
file system, holding it in memory is sufficient and allowing its
execution.<br>
<br>
Sample DSL syntax; {createhandler, "TestHandler", {handles, [ {x,
{action, printToScreen}}, {y, {action, writeToStorage}} ]} }<br>
<br>
So from above I want to create a gen_event handler with a
handle_event function which pattern matches on 'x' and 'y' and
performs the actions defined. I have used this to just show what I
would like to do, what I'm interested in is the steps and approaches
to doing this.<br>
<br>
The steps I see are as follows:<br>
<ol>
<li>Parse the dsl text file, create different tokens. I presume
that I have to write my own parser as its dependent on the
structure of the dsl language itself?<br>
</li>
<li>Match these tokens to chunks of erlang code, is this correct?
What is best approach here; create a 'fun' for each chunk of
code. How would I then simply put these funs together to
represent the overall module?</li>
<li>Once I have the code combined into one entity(representing a
module), then I can presumably use the compile module.</li>
</ol>
<p>I am only coming back to writing erlang (ten years since I coded
in erlang), so apologies if questions are fairly basic. Any info
appreciated.<br>
</p>
<p>Chris.</p>
</body>
</html>