7

Is there an existing LISP parser written in C++? I just want the parser, not a full interpreter, but an interpreter to go along with it would be a plus.

3
  • 4
    do you want a parser for s-expressions or for Lisp? Which Lisp? Scheme? Common Lisp? Commented Sep 1, 2009 at 14:16
  • I'm looking for a parser for a LISP-like syntax, so I guess a parser for s-expressions is really what I'm looking for. Commented Sep 2, 2009 at 3:43
  • Right, s-expressions are the syntax for Lisp data. Lisp programs are written using s-expressions. But not every s-expression is a valid Lisp program. So Lisp has more syntax on top of s-expressions. See the syntax definitions in the Common Lisp and Scheme standards. Commented Sep 2, 2009 at 7:23

4 Answers 4

6

Lisp is just a tree structure, any tree parser will parse lisp readily... you can try this one which google gave me.

Sign up to request clarification or add additional context in comments.

4 Comments

In fact, the Common Lisp I write looks almost exactly like the parse trees I built in compilers class.
You can parse a subset of it easily. But the real thing involves more data-structures than just symbols and lists.
He did mention he wanted a parser, not a full interpreter
@DavidThornley Indeed. :) One could say, Lisp is basically an AST processor that has operations to modify itself. Check out the famous 6.001 (SAICP) videos: ocw.mit.edu/courses/electrical-engineering-and-computer-science/…
2

Bigloo might be useful here.

Comments

1

XCL is an implementation of Common Lisp whose runtime is written in C++. The compiler is written in Lisp but it has an interpreter written in C++ which is used for bootstrapping.

Comments

1

Chicken Scheme is written in C, close enough?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.