How is Lisp parsed?
How is lisp parsed? i am trying to figure out what the standard compilation of lisp is like what the output format is that it spits out.
First of all, I'm not quite certain what you're asking or what you mean by "the output format," but Lisp is very easy to parse. Here's a very basic Lisp grammar, which may help:
It's complicated a bit by the fact that I need to escape several of the characters, but it's not too bad. Note: That is a fully featured Lisp grammar.
Again, I'm not entirely sure what you're asking. Could you please clarify?
atom ::= <identifier> | <number> | <number>/<number> | \" .* \" | #\\\. | #\\f | #\\tsexp ::= <atom> | \(<sexp> \. <sexp>\) | \(<sexp>*\) | \'<sexp>
It's complicated a bit by the fact that I need to escape several of the characters, but it's not too bad. Note: That is a fully featured Lisp grammar.
Again, I'm not entirely sure what you're asking. Could you please clarify?
GameMasterXL:
Are you interested in compiled or interpreted lisp?
A lisp compiler will commonly output to some lower level language (such as C or Java) or to a VM bytecode. A simple lisp interpreter would build up the program as a tree of objects (of the various types that exist in lisp: Cons, Number, etc..) and then "walk" this tree to run the program. There are more advanced ways to make an interpreter, but I don't know how much detail you're interested in.
-Alex
Are you interested in compiled or interpreted lisp?
A lisp compiler will commonly output to some lower level language (such as C or Java) or to a VM bytecode. A simple lisp interpreter would build up the program as a tree of objects (of the various types that exist in lisp: Cons, Number, etc..) and then "walk" this tree to run the program. There are more advanced ways to make an interpreter, but I don't know how much detail you're interested in.
-Alex
Quote:Original post by Roboguy
First of all, I'm not quite certain what you're asking or what you mean by "the output format," but Lisp is very easy to parse. Here's a very basic Lisp grammar, which may help:atom ::= <identifier> | <number> | <number>/<number> | \" .* \" | #\\\. | #\\f | #\\tsexp ::= <atom> | \(<sexp> \. <sexp>\) | \(<sexp>*\) | \'<sexp>
It's complicated a bit by the fact that I need to escape several of the characters, but it's not too bad. Note: That is a fully featured Lisp grammar.
Again, I'm not entirely sure what you're asking. Could you please clarify?
That's not enough to parse lisp. You've left number and identifier undefined.
Common Lisp is a lot more fun than that to compile: the tokenizer can be customized via reader macros, and the parser can be customized via regular macros =-)
Quote:Original post by Troll
That's not enough to parse lisp. You've left number and identifier undefined.
Literals/identifiers are usually handled by the tokenizer, not the parser. In most grammars, things like number and identifiers are terminals.
Thanx for replys is what it is is halo CE uses lisp for its script language well its own intepretation of it so i am just wondering what it would spit out since inside of the game editor it says compile scripts which compiles it into a .scenario file which is a level file but if i open that file up i can read some of the script but some parts i can't. So is this just output in text format or some type of bytecode? i would like to know detail cypherex thnx :). I hope that helps your answering.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement