Hi everyone out there!<br><br>I'm still quite new, to erlang, so please try to not be mad, even if I say or suggest something stupid...<br><br>I thought of creating a sql like language to crawl websites - an example of such a query could be:
<br><br>GET_ME ALL_PAGES FROM <a href="http://en.wikipedia.org">en.wikipedia.org</a> <br>WHERE uri LIKE wiki/.*;<br><br>this would crawl all articles of wikipedia (the like-expression is supposed to be a regular expression)
<br><br>I'm not quite sure of how to approach this... <br><br>One idea would be with macros:<br><br>-define("GET_PAGE", "get_pages(\"" ).<br>-define(";", "\").").<br><br>
such that this query <br><br>?GET_ME ALL_PAGES FROM <a href="http://en.wikipedia.org">en.wikipedia.org</a> <br>
WHERE uri LIKE /wiki/.* ?;<br><br>would be transformed in <br><br>get_pages("ALL_PAGES FROM <a href="http://en.wikipedia.org">en.wikipedia.org</a> <br>
WHERE uri LIKE wiki/.*");<br><br>1. Now, the define syntax isn't perfectly valid - I'm aware of that, so the first question would be, is what I'm thinking of even possible?<br><br>2. Does it make sense do to something like this?
<br><br>3. Are there any better approaches?<br><br>4. Is there any general introduction for meta-programming in erlang?<br><br>5. Anything else you'd like to tell me?<br><br>Thanks!<br>