What is the difference between an Abstract Syntax Tree and a Concrete Syntax Tree?

Posted by Jason Baker on Stack Overflow See other posts from Stack Overflow or by Jason Baker
Published on 2009-12-11T15:33:28Z Indexed on 2010/04/04 7:23 UTC
Read the original article Hit count: 487

I've been reading a bit about how interpreters/compilers work, and one area where I'm getting confused is the difference between an AST and a CST. My understanding is that the parser makes a CST, hands it to the semantic analyzer which turns it into an AST. However, my understanding is that the semantic analyzer simply ensures that rules are followed. I don't really understand why it would actually make any changes to make it abstract rather than concrete.

Is there something that I'm missing about the semantic analyzer, or is the difference between an AST and CST somewhat artificial?

© Stack Overflow or respective owner

Related posts about parsing

Related posts about semantic-analysis