<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>RedBrain @ $HOME : ~ $ &#187; BLUG</title>
	<atom:link href="http://redbrain.co.uk/index.php/tag/blug/feed/" rel="self" type="application/rss+xml" />
	<link>http://redbrain.co.uk</link>
	<description>Frustrated Software Developer</description>
	<lastBuildDate>Sat, 19 May 2012 00:58:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Update &#8211; Interpreter CRULES &amp; Jamedo</title>
		<link>http://redbrain.co.uk/index.php/update/update-interpreter-crules-jamedo/</link>
		<comments>http://redbrain.co.uk/index.php/update/update-interpreter-crules-jamedo/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 23:51:42 +0000</pubDate>
		<dc:creator>redbrain</dc:creator>
				<category><![CDATA[Crules]]></category>
		<category><![CDATA[Update!]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[BLUG]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://redbrain.co.uk/?p=400</guid>
		<description><![CDATA[<p></p>
<p style="margin-bottom: 0cm;" align="justify">So hey, its been a little longer than i intended to update my blog! But i&#8217;ve been busy, so i have got rid of my personal work being on repositories all over the show. So I have made:</p>

http://code.redbrain.co.uk

<p style="margin-bottom: 0cm;" align="justify">There will be public git access soon, but you can download the [...]]]></description>
			<content:encoded><![CDATA[<p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } 		A:link { so-language: zxx } --></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">So hey, its been a little longer than i intended to update my blog! But i&#8217;ve been busy, so i have got rid of my personal work being on repositories all over the show. So I have made:</span></p>
<ul>
<li><span style="font-family: Arial,sans-serif;"><a href="http://code.redbrain.co.uk/">http://code.redbrain.co.uk</a></span></li>
</ul>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">There will be public git access soon, but you can download the snapshot tarballs of the branches. And I have a wiki too there isn&#8217;t anything on there yet but it will give me room to stop putting long tutorial article&#8217;s as pages on my blog to proper wiki article&#8217;s:</span></p>
<ul>
<li><span style="font-family: Arial,sans-serif;"><a href="http://wiki.redbrain.co.uk/">http://wiki.redbrain.co.uk</a></span></li>
</ul>
<p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } 		A:link { so-language: zxx } --></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">So Compilers, Interpreters and programming languages are my interests&#8230; *yawn! So let me show you my interpreter pipeline for my interpreted language &#8216;CRULES&#8217;: </span></p>
<div id="attachment_401" class="wp-caption alignleft" style="width: 310px"><a rel="attachment wp-att-401" href="http://redbrain.co.uk/?attachment_id=401"><img class="size-medium wp-image-401" title="Crules-arch-diagram" src="http://redbrain.co.uk/wp-content/uploads/2009/07/Crules-arch-diagram-300x253.png" alt="Crules" width="300" height="253" /></a><p class="wp-caption-text">Crules</p></div>
<p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } --></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">So I have to admit that&#8217;s the most impressive art I ever done (I know I&#8217;m lame <img src='http://redbrain.co.uk/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> ). Its my pipeline for my programming language, but I guess a lot of programming languages would follow this kind of model/architecture. So it got me thinking this is nearly the basics for any semi-serious interpreter or &#8216;a&#8217; language so lets talk though it. </span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;"><br />
</span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">I am still not going to talk about the details of my language because its not ready yet. Other than I am doing fun things like, so far the only data-structure I let the developer have is lists, so if you do something like:</span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;"><br />
</span></p>
<blockquote>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">% foo := { 2,3,4,5,6,67,7}</span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">#is a list and strings are lists!</span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">% str := “bla”</span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">#is the same as</span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">% str := { &#8216;b&#8217;, &#8216;l&#8217;, &#8216;a&#8217; }</span></p>
<p style="margin-bottom: 0cm;" align="justify">
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">It works a lot around the shell so you can also do:</span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">% foo := `ls`</span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">#it produces a delimited list of strings with the delimited as carriage return or new line etc.</span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;"><br />
</span></p></blockquote>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">Though note I am going to implement an api for arrays. But not yet, because lists are going to cause problems unless I implemented a table/array of accessors to the elements in the list so you can do fast access to the elements because it doesn&#8217;t scale no matter what anyone says when say you are doing image processing on a 1024&#215;1024 list&#8230; accessing the elements isn&#8217;t going to scale.</span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;"><br />
</span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">Anyway so lets get back to looking into the pipeline of it: So first a user creates a program lets look at the helloworld.crl:</span></p>
<p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } --></p>
<blockquote>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">rule main()</span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">{</span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;"> echo “Hello World!”</span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;"> foo := 5 + 2 &#8211; 7</span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">}</span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">all := main;</span></p>
</blockquote>
<p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } --></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">So first my interpreter will start lexing this using LEX, into tokens like: rule, main &#8216;(&#8216; &#8216;)&#8217;&#8230;. and then the parser starts applying the grammar implemented using YACC. So I start producing symbols to build a symbol table the data-structure looks like this its basicly a more high-level 3 address code:</span></p>
<p style="margin-bottom: 0cm;" align="justify">
<p style="margin-bottom: 0cm;" align="justify">
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw4">struct</span> symtab <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw4">const</span> <span class="kw4">char</span> *identifier;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; uint8_t symType;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; uint8_t op_a_t;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; uint8_t op_b_t;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw4">union</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; _SYM_LIST_ *list;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw4">float</span> flt;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; int32_t integer;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; <span class="kw4">char</span> ch;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1">//sym link to function call</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw4">struct</span> symtab *syms;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span> op_a;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw4">union</span> <span class="br0">&#123;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; _SYM_LIST_ *list;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw4">float</span> flt;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; int32_t integer;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1">//params to a func_call</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw4">struct</span> symstack *syms;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; <span class="kw4">struct</span> symtab *sy;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span> op_b;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw4">struct</span> symtab *next;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span> __attribute__<span class="br0">&#40;</span><span class="br0">&#40;</span>aligned<span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p style="margin-bottom: 0cm;" align="justify">
<p style="margin-bottom: 0cm;" align="justify">
<p style="margin-bottom: 0cm;" align="justify">
<p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } --></p>
<p style="margin-bottom: 0cm;" align="justify">
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">So first it creates the rule definition! For now just think as rules as entry points to a program so you can add more identifiers to that &#8216;all&#8217; list not just main. It has a deeper meaning but I don&#8217;t want to talk or show this until I have the interpreter and language definitions more concrete!</span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;"><br />
</span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">So the the rule &#8216;main&#8217; creates a new symbol like this:</span></p>
<p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } --></p>
<blockquote>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">//the symbol takes the identifer of the rule identifier</span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">symbol-&gt;identifer = &#8216;main&#8217;</span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">//its a rule symbol</span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">symbol-&gt;symType= _SYM _RULE _</span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">symbol union_a is the link to the first symbol in that block of statements and union_b is NULL because I don&#8217;t need it until I have rule dependencies it needs to list.</span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">symbol-&gt;next= NULL, because it is just a definition</span></p>
</blockquote>
<p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } --></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">Then each expression like &#8216; echo “Hello World” &#8216;, creates a symbol and its next = the next expression like the &#8216; foo := 5 + 2 – 7 &#8216;. This creates an interesting one, because this can&#8217;t be reduced to a 3-address code until you split it up, for now I just assume the developer wants it to run as 5+2=7 then 7-7=0; But I am going to add precedence later. So you can be more expressive to have nested expressions in brackets to be executed first etc..</span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;"><br />
</span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">But yeah this expression is split up into 3 symbols for now, its an over all variable Assignment but it depends an expression of 5+2 as a temporary symbol then this temporary symbol – 7 then foo = this new temporary symbol and I can push these dead symbols to the garbage collector. </span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;"><br />
</span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">When a symbol is allocated, it is allocated memory of a preallocated memory heap of default 32MB, it can be extended or shortened if needs be, but it allows me to control and see how much memory is being occupied at anyone time in the runtime of the interpreter. Any symbols to be kept such as rule definitions, function definitions or variables are kept on one massive stack. So ok, that&#8217;s a problem if you need to search for them, the answer I found was having 3 other tables that link to the symbols in the stack. When any link is broke it becomes garbage, so when I have a new variable re-assignment I can break that link and remove the entry in the variable table it still exists in the symbol stack but the <a href="http://en.wikipedia.org/wiki/Garbage_collection_(computer_science)">Garbage collector</a> is always called on EXIT and the exit of any block statements like loops functions etc, so when you pop your way out of the stack you can have local variables instead of everything global and you have conflicts which will cause a lot of problems. Also the garbage collector is implemented as a <a href="http://en.wikipedia.org/wiki/POSIX_Threads">pthread</a> so you have have to pause for several seconds waiting for it to free the garbage. I haven&#8217;t done this yet because its going to be very awkward to keep the concurrency, the pthread mutex api should handle a lot for me but its still going to be complicated. I have thought I might like to try implementing a lot of different internal using OPEN/MP to make it even speedier, but that won&#8217;t be for a while.</span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;"><br />
</span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">And then I have been playing with<a href="http://llvm.org/"> LLVM</a> to create a <a href="http://llvm.org/docs/tutorial/index.html">JIT execution system</a>, you can see my posts on &#8216;Managing the JIT&#8217; on comp.compilers, I have posted there quite a few times before, its a great list of basically all programming language, compiler and interpreter experts in the world!</span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;"><br />
</span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">So I have a variable table that links to the variables in the symbol stack and the same for the rules and functions. This speed up searching for specific identifiers.</span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;"><br />
</span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">So that&#8217;s the basics of parsing into symbols I guess, it pains me to say but many people thing a programming language is mainly a parser is so wrong the parser just lets you build your symbols the execution and management of these symbols is much, much more complicated. That&#8217;s not to say implementing a simple programming language is difficult, the problem I see a lot is people are scared of doing it because the vocabulary is huge! I mean if you start working at an interpreter from first principle&#8217;s I&#8217;ll guarantee if you have half a brain you&#8217;ll come to a similar architecture as this. </span></p>
<p style="margin-bottom: 0cm;" align="justify">
<p style="margin-bottom: 0cm;" align="justify">
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">I found it difficult at the start when I knew anything in a programming language can always be brought to 3 things and I got really confused when people talked about symbol tables, 3 address code, IR (intermediate representation) and parse trees or syntax tree&#8217;s. I think a lot of developers have their own prefered meanings to them, but it is mainly a barrier of academics trying to make the subject more complicated than needs be, although when you go at this from first principle&#8217;s you&#8217;ll will soon learn <img src='http://redbrain.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</span></p>
<p style="margin-bottom: 0cm;" align="justify">
<p style="margin-bottom: 0cm;" align="justify">
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">So thats the main focus of my personal work but I am now also soon to be an approved <a href="http://gcc.gnu.org/">GNU/gcc</a> and <a href="http://www.gnu.org/software/automake/">GNU/automake</a> developer! Can&#8217;t wait, got my FSF paper work signed and sent back it may arrive in Boston soon I guess but yeah I am excited. I am updating the automake documentation to show the best way to handle multiple <a href="http://en.wikipedia.org/wiki/Lex_programming_tool">LEX</a> and <a href="http://en.wikipedia.org/wiki/Yacc">YACC</a> in one program. Its something only one of two people do but its a problem none the less and to make it portable is the actual problem. But I have the solutions to it now <img src='http://redbrain.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;"><br />
</span></p>
<p style="margin-bottom: 0cm;" align="justify">
<div class="wp-caption alignright" style="width: 262px"><a href="http://icanhascheezburger.files.wordpress.com/2009/07/funny-pictures-cat-has-pushed-in-face.jpg"><img title="Got your attention" src="http://icanhascheezburger.files.wordpress.com/2009/07/funny-pictures-cat-has-pushed-in-face.jpg" alt="Got your attention" width="252" height="188" /></a><p class="wp-caption-text">Got your attention</p></div>
<p style="margin-bottom: 0cm;" align="justify">
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">Thing is I would really love it if I had an AIX/FreeBSD/Solaris machine to do more testing on because now that I am doing work on GCC it would be so helpful to have more machines to do testing. But i&#8217;m ok for now, so far in GCC I am doing regression testing to find a regression I can tackle, its extremely difficult some are defunct on the <a href="http://gcc.gnu.org/bugzilla/">bugzilla</a> some are ancient and not perused. And the rest is very active but for MIPS or SPARC, and I don&#8217;t have a <a href="http://www.scratchbox.org/">scratchbox</a> setup to even test that yet. Would just be great to get my hands on even an old ibook for a power-pc cpu or an old IBM p-server. If anyone knows of any available I would be really grateful!<br />
</span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;"><br />
</span></p>
<p style="margin-bottom: 0cm;" align="justify">
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;">Ok this has become a very long post so I&#8217;ll shut up! <img src='http://redbrain.co.uk/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> . See you guys from <a href="http://www.belfastlinux.org/wiki/Main_Page">Beflast LUG</a> on Wednesday!</span><span style="font-family: Arial,sans-serif;"> One last thing i want to link you to 5 of my favourite bands and they are all off <a href="http://www.jamendo.com/en/">Jamendo</a>:</span></p>
<p style="margin-bottom: 0cm;" align="justify"><span style="font-family: Arial,sans-serif;"><br />
</span></p>
<ul>
<li><a href="http://www.jamendo.com/en/album/26656">http://www.jamendo.com/en/album/26656</a></li>
<li><a href="http://www.jamendo.com/en/album/34523">http://www.jamendo.com/en/album/34523</a></li>
<li><a href="http://www.jamendo.com/en/album/42122">http://www.jamendo.com/en/album/42122</a></li>
<li><a href="http://www.jamendo.com/en/album/34714">http://www.jamendo.com/en/album/34714</a></li>
<li><a href="http://www.jamendo.com/en/album/3661">http://www.jamendo.com/en/album/3661</a></li>
</ul>
<pre><span><span> </span></span></pre>
]]></content:encoded>
			<wfw:commentRss>http://redbrain.co.uk/index.php/update/update-interpreter-crules-jamedo/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Identi.ca -&gt; Curl -&gt; Update</title>
		<link>http://redbrain.co.uk/index.php/about-me/identica-curl-update/</link>
		<comments>http://redbrain.co.uk/index.php/about-me/identica-curl-update/#comments</comments>
		<pubDate>Mon, 25 May 2009 23:34:14 +0000</pubDate>
		<dc:creator>redbrain</dc:creator>
				<category><![CDATA[About Me]]></category>
		<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Update!]]></category>
		<category><![CDATA[BLUG]]></category>
		<category><![CDATA[c/c++]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://redbrain.co.uk/?p=358</guid>
		<description><![CDATA[<p>So yeah, i told you guys in my last post i would be doing a tutorial on compiler work, i am still working at this, tbh there is so much writing i am thinking i might make like a sub-domain for it like a latex-html type thing, i have been writing a long .odt in [...]]]></description>
			<content:encoded><![CDATA[<p>So yeah, i told you guys in my last post i would be doing a tutorial on compiler work, i am still working at this, tbh there is so much writing i am thinking i might make like a sub-domain for it like a latex-html type thing, i have been writing a long .odt in openOffice, but i think if i want to put it on this blog it will be far too big. But anyways well see i updated some of my stuff here on the blog feeling much happier i think i have found a theme i can settle on!</p>
<p>Oh and i added the link for my hello-world gcc-frontend</p>
<blockquote><p>$ git clone git://github.com/redbrain/gcc-sbsh.git</p>
<p>$ ./configure</p>
<p>$ make (..sleep for 2 hours&#8230;)</p></blockquote>
<p>//what your interested in is gcc/sbsh/ * all the files in there is all the stuff you have to do to make a hello world front-end you need all those definitions etc.. i think i have broke my Make-lang.in but i&#8217;ll fix it asap. If your on a mac i posted the fix for mpfr on the gcc-help mailing list.</p>
<p>To compile on a mac:</p>
<blockquote><p>$ wget -c ftp://ftp.gmplib.org/pub/gmp-4.3.1/gmp-4.3.1.tar.gz</p>
<p>$ tar xvf gmp-4.3.1.tar.gz</p>
<p>$ ./configure</p>
<p>$ make</p>
<p>$ sudo make install</p>
<p>$ sudo port install mpfr</p>
<p>$ cd gcc-sbsh</p>
<p>$ ./configure &#8211;prefix=&lt;maby put a prefix for install here instead of sys-wide install&gt; &#8211;with-mpfr-lib=/opt/local/lib &#8211;with-mpfr-include=/opt/local/include</p></blockquote>
<p>Now it should configure properly! <img src='http://redbrain.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   <a href="http://www.nabble.com/Configuration-problem:-not-recognizing-MPFR-td23556792.html">http://www.nabble.com/Configuration-problem:-not-recognizing-MPFR-td23556792.html</a>. You may find my on gcc-help pretty often now and automake bison and autoconf. I use these apps alot now and the mailing lists are really intereasting. Linux-kernel list sucks its far far too fast to follow unless you a full time-developer drizzle i dont have enough time for either KVM i think they are all over the place</p>
<p>And here is the git-repos of my work for the hello-world interpreter its still a work in progress but i think its ok for one evenings work <img src='http://redbrain.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<blockquote><p>$ git clone git://github.com/redbrain/simple-programming-language.git</p>
<p>$ apt-get install build-essential autoconf automake libtool</p>
<p>$ sh autorun.sh</p>
<p>$ ./configure</p>
<p>$ make</p>
<p>$ ./src/simple &#8211;help</p>
<p>$ ./src/simple tests/helloworld.sim</p></blockquote>
<p>Oh and i have done some massive updates to the Belfast LUG wiki in general: <a href="http://www.belfastlinux.org/wiki/Main_Page">http://www.belfastlinux.org/wiki/Main_Page</a></p>
<p><a href="http://www.belfastlinux.org/wiki/2009-04-06_mobile-monday">http://www.belfastlinux.org/wiki/2009-04-06_mobile-monday</a></p>
<p><a href="http://www.belfastlinux.org/wiki/Meetings">http://www.belfastlinux.org/wiki/Meetings</a></p>
<p>I will aim to keep the Meetings page updated with my email after the meeting with what happened at the Meet like in: <a href="http://www.belfastlinux.org/wiki/2009-03-25_pubbage">http://www.belfastlinux.org/wiki/2009-03-25_pubbage</a>. I will maby start a page in the future about going to LugRadio live 2009 but thats a good few months off yet.. <img src='http://redbrain.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>So yeah This last week and a few days i have spent my evenings doing some writing on compilers etc&#8230; for the tutorial and playing with haskell.. I am trying to learn the curl api to make an identi.ca client written in haskell and it cant be hard because the code to do it in C is well tiny look i knocked this up in a few mins:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="co2">#include &quot;stdio.h&quot;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">#include &quot;curl/curl.h&quot;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co2">#define IDENTICA &nbsp; &nbsp; &quot;http://identi.ca/api/statuses/update.xml&quot;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">int</span> main<span class="br0">&#40;</span> <span class="kw4">int</span> argc, <span class="kw4">char</span> *argv<span class="br0">&#91;</span><span class="br0">&#93;</span> <span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; CURL *curl;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; CURLcode res;</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; curl = curl_easy_init<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span> curl <span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw4">char</span> *data=<span class="st0">&quot;status=hello world identi.ca libcurl &#8211; c&quot;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; curl_easy_setopt<span class="br0">&#40;</span>curl, CURLOPT_POSTFIELDS, data<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1">//username:password&#8230; male sure to keep the &#8216;:&#8217;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; curl_easy_setopt<span class="br0">&#40;</span>curl, CURLOPT_USERPWD, <span class="st0">&quot;username:password&quot;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; curl_easy_setopt<span class="br0">&#40;</span>curl, CURLOPT_URL, IDENTICA<span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; res = curl_easy_perform<span class="br0">&#40;</span>curl<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span class="kw3">printf</span></a><span class="br0">&#40;</span><span class="st0">&quot;result -&gt; %i<span class="es0">\n</span>&quot;</span>, res<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="coMULTI">/* always cleanup */</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; curl_easy_cleanup<span class="br0">&#40;</span>curl<span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">return</span> <span class="nu0">0</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>You can compile with:</p>
<blockquote><p>$ gcc -o identica main.c `curl-config &#8211;libs &#8211;cflags`</p></blockquote>
<p>So as you can see posting to identi.ca or twitter is a simple task. But haskell&#8230; well it isnt simple I do love haskell in some ways its very much the way you think of things if your doing a very long definition in Pure Math or a proof in Applied Math. Yeah i do a Math degree&#8230; i hate it <img src='http://redbrain.co.uk/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  a i love it just i prefer doing programming mostly.</p>
<p>Anyways the problem i have with the language is its becoming EXTREMLY messy in my opinion, instead of people concentrating on making haskell useful to actually make apps and wrappers to useful libraries they seem to keep adding features to the language. Like the way things work in it take a long time to get your head around but to manipulate data is why i LOVE it. So its like look at this tutorial it just explains why i love haskell <a href="http://www.haskell.org/~pairwise/intro/section1.html#part4">http://www.haskell.org/~pairwise/intro/section1.html#part4</a></p>
<div class="wp-caption alignleft" style="width: 382px"><a href="http://icanhascheezburger.files.wordpress.com/2009/05/funny-pictures-cat-does-not-believe-you.jpg"><img title="lolcats" src="http://icanhascheezburger.files.wordpress.com/2009/05/funny-pictures-cat-does-not-believe-you.jpg" alt="lolcat" width="372" height="209" /></a><p class="wp-caption-text">lolcat</p></div>
<p>Thats just an awesome idea lazy evaluation, i am getting to grips with it but i think it would be better if i get a book on it rather than reading a sticking bits of what i see around the interenet together.Its just its all very well being able to make a list and do silly evaluations on them etc.. But you need to have some good networking apis or some decent file-read-write apis there are some but its just very centric around read or getch type functions. Then GHC dam its a huge and the main implemenation of haskell, but its sooo bloated. I was toying with my own idea to make a gcc-haskell front-end but i don&#8217;t know if i like the language enough to do it, i would probably prefer to make my own version of it. But then it would take a long time to persude people to move over. etc&#8230;</p>
<p>Anyways its nearly 1AM and i have work in the morning <img src='http://redbrain.co.uk/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  Remember to post comments guys! <img src='http://redbrain.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://redbrain.co.uk/index.php/about-me/identica-curl-update/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

