Skip to main content

Questions tagged [abstract-syntax-tree]

For questions about abstract syntax trees (ASTs), hierarchical representations of the syntactic structure of code, typically used in compilers, interpreters, and static analysis tools. Do not use for questions about syntax design.

Filter by
Sorted by
Tagged with
6 votes
2 answers
440 views

Sometime during the past year I read (possibly on SO/SE) about a topic that sounded interesting. Now I would like to pick it up but I can't find it again. My memory is somewhat vague, I'm afraid. I ...
Mankka's user avatar
  • 163
28 votes
7 answers
13k views

When I started researching parsing and compiling I started with simple mathematical expression parsers. Many of the existing implementations I found have an intermediate step of converting a string ...
CPlus's user avatar
  • 10.5k
-1 votes
1 answer
377 views

If Sandwich's AST generator finds that the first token is an identifier, one of two cases can be true: Function call Variable assignment It stores the identifier and checks if the next token is a = ...
192927376337929292283737373773's user avatar
13 votes
3 answers
2k views

I'm currently working on a protobuf parser and I'm trying to preserve the comments in the AST. However, there many non-trivial cases and I was wondering if there was an already existing algorithm/data ...
Clément Jean's user avatar
16 votes
7 answers
4k views

Are there any languages which allow you to get access to the AST during compile time, to use some part of the AST to generate code, or to possibly rewrite the code/AST to optimize it in a heuristic ...
Lance Pollard's user avatar
8 votes
2 answers
273 views

I'm working on a language that transpiles to Lua, and writing the transpiler in Kotlin. One problem I'm having is that I simply have too many AST types. I have an untyped AST, a typed AST, and a Lua ...
Seggan's user avatar
  • 3,442
8 votes
3 answers
532 views

This language is implemented in Rust using a lot of enums for things like expressions. Some of the planned validation rules involve checking how parenthesis are used -- where they're needed and are ...
0xLogN's user avatar
  • 180
13 votes
2 answers
2k views

Compiling and interpreting programming languages typically involves parsing text into a tree that represents the different groupings of syntactic elements. The hierarchy represents which syntactic ...
CPlus's user avatar
  • 10.5k