lisp - Parsing s-expressions in Go -
here's link lis.py if you're unfamiliar: http://norvig.com/lispy.html
i'm trying implement tiny lisp interpreter in go. i've been inspired peter norvig's lis.py lisp implementation in python.
my problem can't think of single efficient way parse s-expressions. had thought of counter increment 1 when see's "(" , decrement when sees ")". way when counter 0 know you've got complete expression.
but problem means have loop every single expression make interpreter incredibly slow large program.
any alternative ideas great because can't think of better way.
there s-expression parser implemented in go @ rosetta code:
it might give idea of how attack problem.
Comments
Post a Comment