title: Parsing function arguments without arguments delimiters
body: <p>I'm working on a project where I need to translate NetLogo to another programming language. I'm using Boost Spirit and I've already implemented some of the project grammars that store simple code syntax into an AST.</p>
  
  <p>The problem I'm facing is that right now I can't tell if an identifier is a variable name or a function name. Also, I don't know if a specific function call needs one, two, or multiple arguments, so I don't know when to stop looking for more arguments.</p>
  
  <p>For example, a function call can look like  </p>
  
  <pre><code>id1 id2 id3 id4
  </code></pre>
  
  <p>That could be:  </p>
  
  <ul>
  <li><code>id3</code> is a function that has <code>id4</code> as argument (let's say the return value of that is <code>id5</code>), and <code>id1</code> is a function that has <code>id2</code> and <code>id5</code> as arguments </li>
  </ul>
  
  <p>But it could also be:  </p>
  
  <ul>
  <li><code>id1</code> has <code>id2</code> <code>id3</code> <code>id4</code> as arguments (all but <code>id1</code> are variable names)</li>
  </ul>
  
  <p>I've thought about using Symbols and adding new items each time a variable or function is declared, this would help to differentiate variable names and function names, but...  </p>
  
  <ul>
  <li>How can/should I store the number of arguments a function requires using Boost Spirit? Maybe using another Symbol table with Semantic Actions while parsing the function definition?</li>
  <li>Once I know how to get the number of arguments needed, how can I get that value once I find a function identifier while parsing an expression?</li>
  <li>It's a good solution to use Symbols to differentiate variable names from function names?</li>
  </ul>