Timeline for How do I solve this graphing dependency cycle in an AST?
Current License: CC BY-SA 4.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 23 at 21:21 | answer | added | Jörg W Mittag | timeline score: 4 | |
Mar 23 at 20:39 | comment | added | amon |
An AST just describes syntactic structure, not data flows. Typical ASTs just carry the information that a variable called literal exists, but not yet resolve it. That typically happens in later phases, after parsing. Sometimes the AST is enriched with such info, sometimes there is a separate Intermediate Representation (IR). You may find the LLVM IR to be particularly interesting because all its virtual registers are assign-once, making data flow analysis straightforward. There might be different registers for each "version" of the variable. Can still be cyclic though, if you have loops.
|
|
Mar 23 at 20:24 | answer | added | J_H | timeline score: -2 | |
Mar 23 at 20:14 | comment | added | NWoodsman |
I didn't illustrate the cyclic condition, but logically literal = expression(literal) is a self-referential statement, i.e. literal = expression(literal = expression(literal = expression(literal = ...
|
|
Mar 23 at 20:00 | comment | added | Philip Kendall | Where is the cycle in your graph? i.e. how can you start from one node, move to another node, and then later return to the original node. | |
Mar 23 at 19:57 | history | asked | NWoodsman | CC BY-SA 4.0 |