start : exp EOF
exp: INT | ID | exp PLUS exp | '(' exp ')'
INT : '0' | ('1'..'9') ('0'..'9')*
ID : ( 'a'..'z' | 'A'..'Z' | '_' | '$' ) ( 'a'..'z' | 'A'..'Z' | '_' | '0'..'9' | '$' )*
PLUS : '+'
start : exp EOF
exp: INT | ID | exp PLUS exp | '(' exp ')'
CFG
↓
|-------------|
| Parser |
| Synthesizer |
|-------------|
|
synthesizes
↓
|--------|
program → | Parser | → parse tree
|--------|
Theory: For any context-free grammar
Input
â–¡â–¡â–¡â–¡â–¡â–¡â–¡â–¡
↓
|---------| Stack
| Control | ⇔ |__|
| Unit | |__|
|---------| |__|
NPDA
Which input does
NPDA
Which input does
This does not work. Why?
NPDA -X-> DPDA
Assume
We can have an NPDA that accepts
How about a DPDA that accepts