title: Parsing s-expressions in Go
body: <p>Here's a link to lis.py if you're unfamiliar: <a href="http://norvig.com/lispy.html" rel="nofollow">http://norvig.com/lispy.html</a></p>
  
  <p>I'm trying to implement a tiny lisp interpreter in Go. I've been inspired by Peter Norvig's Lis.py lisp implementation in Python.</p>
  
  <p>My problem is I can't think of a single somewhat efficient way to parse the s-expressions. I had thought of a counter that would increment by 1 when it see's a "(" and that would decrement when it sees a ")". This way when the counter is 0 you know you've got a complete expression.</p>
  
  <p>But the problem with that is that it means you have to loop for every single expression which would make the interpreter incredibly slow for any large program.</p>
  
  <p>Any alternative ideas would be great because I can't think of any better way.</p>