<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Mar 6, 2015 at 3:15 PM, Kostas Michalopoulos <span dir="ltr"><<a href="mailto:badsectoracula@gmail.com" target="_blank">badsectoracula@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>This is a classic series of articles that show how to write a very simple compiler in Turbo Pascal. The fundamentals when it comes to scanning are the same:<br><br><a href="http://compilers.iecc.com/crenshaw/" target="_blank">http://compilers.iecc.com/crenshaw/</a><br><br></div>I've also written a BASIC implementation for Free Pascal and Lazarus. The scanner should be straightforward to understand:<br><br><a href="http://runtimelegend.com/rep/rbasic/artifact/2350e85c36a77e4d2d76adde23fd7d45731b5b22" target="_blank">http://runtimelegend.com/rep/rbasic/artifact/2350e85c36a77e4d2d76adde23fd7d45731b5b22</a><br><br></div><div>The compiler code shows how it can be used:<br><a href="http://runtimelegend.com/rep/rbasic/artifact/93859f52fd424edfc1e0d5dfd16a92ed8ac04855" target="_blank">http://runtimelegend.com/rep/rbasic/artifact/93859f52fd424edfc1e0d5dfd16a92ed8ac04855</a><br><br></div><div>But you may also find the formatter code simpler. Although it is a bit too simple:<br><a href="http://runtimelegend.com/rep/rbasic/artifact/f3e9fb2d1ed8e60d36b50754c2d9a7d7c109fc40" target="_blank">http://runtimelegend.com/rep/rbasic/artifact/f3e9fb2d1ed8e60d36b50754c2d9a7d7c109fc40</a><br></div><div><br></div>For general theory you can look on recursive descent parsers (they're the simplest to implement and AFAIK most compilers use them, either to build the token list or directly).</div></blockquote><div><br></div><div>I downloaded the PDF with all articles.</div><div><br></div><div>Thank you very much!</div></div><div><br></div>-- <br><div>Silvio Clécio<br>My public projects - <a href="http://github.com/silvioprog" target="_blank">github.com/silvioprog</a></div>
</div></div>