title: How to deal with list return values in ANTLR
body: <p>What is the correct way to solve this problem in ANTLR:</p>
  
  <p>I have a simple grammar rule, say for a list with an arbitrary number of elements.</p>
  
  <pre><code>list
  : '[]' 
  | '[' value (COMMA value)* ']'
  </code></pre>
  
  <p>If I wanted to assign a return value for list, and have that value be the actual list of returned values from the production, what is the proper way to do it?  The alternatives I'm entertaining are:</p>
  
  <ul>
  <li>create my own stack in the global scope to keep track of these lists</li>
  <li>Try to inspect the tree nodes below me and extract information that way</li>
  <li>Access it in some slick and cool way that I'm hoping to find out about in which I can get easy access to such a list from within the action associated with the rule.</li>
  </ul>
  
  <p>I guess the question is: How do the cool kids do it?</p>
  
  <p>(FYI I'm using the python API for ANTLR, but if you hit me with another language, I can handle that)</p>