title: Building a parser (Part I)
body: <p>I'm making my own javascript-based programming language (yeah, it is crazy, but it's for learn only... <em>maybe?</em>). Well, I'm reading about parsers and the first pass is to convert the code source to tokens, like:</p>
  
  <pre><code>if(x &gt; 5)
    return true;
  </code></pre>
  
  <p>Tokenizer to:</p>
  
  <pre><code>T_IF          "if"
  T_LPAREN      "("
  T_IDENTIFIER  "x"
  T_GT          "&gt;"
  T_NUMBER      "5"
  T_RPAREN      ")"
  T_IDENTIFIER  "return"
  T_TRUE        "true"
  T_TERMINATOR  ";"
  </code></pre>
  
  <p>I don't know if my logic is correct for that for while. On my parser it is even better (<em>or not?</em>) and translate to it (yeah, multidimensional array):</p>
  
  <pre><code>T_IF             "if"
    T_EXPRESSION     ...
      T_IDENTIFIER     "x"
      T_GT             "&gt;"
      T_NUMBER         "5"
    T_CLOSURE        ...
      T_IDENTIFIER     "return"
      T_TRUE           "true"
  </code></pre>
  
  <p>I have some doubts:</p>
  
  <ol>
  <li>Is my way better or worse that the <em>original way</em>? Note that my code will be read and compiled (translated to another language, like PHP), instead of interpreted all the time.</li>
  <li>After I tokenizer, what I need do exactly? I'm really lost on this pass!</li>
  <li>There are some good tutorial to learn how I can do it?</li>
  </ol>
  
  <p>Well, is that. Bye!</p>