Questions tagged [syntax-trees]
37 questions
25
votes
3 answers
Visual programming tools, why don’t they work with the AST directly?
I've found several open source visual programing tools like Blockly and friends, and other projects hosted at Github, but could't find any that work directly with the abstract syntax tree.
Why is that?
I'm asking because once I discovered that every…
ery245gs
- 353
- 3
- 6
10
votes
1 answer
How do I reconstruct the forest of syntax trees from the Earley vector?
Using the Earley vector as a recognizer is quite straightforward: when the end of the string is reached, you just have to check for a completed axiomatic production started at position 0. If you have at least one, then the string is accepted.
Using…
Stefano Sanfilippo
- 203
- 1
- 6
6
votes
1 answer
Is CYK still relevant today?
I've come across the CYK algorithm and was wondering, as it's quite old, if it is still relevant today.
Is it or an extension of it still being used in compilers (for example), or have other algorithms proven to be better?
user23039
5
votes
2 answers
How do I interpret the wording of this passage about abstract binding trees from the book Practical Foundations of Programming Languages
On page 7/8, section 1.2, of Practical Foundations of Programming Languages, 2nd edition, Robert Harper gives this initial definition of abstract binding trees:
The smallest family of sets closed under the conditions
If $x \in \mathcal{X}_s$, then…
afsmi
- 307
- 1
- 6
4
votes
2 answers
What are the modern alternatives to Backus–Naur form and what are their advantages?
I am very new to the whole concept of context-free grammars to represent the syntax tree of formal languages (i.e., programming languages). It seems that the Backus–Naur form (BNF) is the oldest of all possible notations and the most prevalent one.…
Foad
- 211
- 2
- 10
3
votes
1 answer
Simple example for Higher Order Abstract Syntax (λ-tree syntax)
I am reading https://www.cs.cmu.edu/~fp/papers/pldi88.pdf and https://en.wikipedia.org/wiki/Higher-order_abstract_syntax for trying to understand encoding of linear logic using HOAS into Coq. But I still cannot grasp whats going on? Is there simple…
TomR
- 1,411
- 8
- 17
3
votes
1 answer
Where does LL parser belong in the top-down parsers classification
There are four types of top-down parsers according to this answer:
recursive descent backtracking
recursive descent predictive
table-driven with backtracking
table-driven predictive.
Also the author says that:
All top down parsers are…
Max Koretskyi
- 325
- 1
- 4
- 14
3
votes
1 answer
Is there a correspondence between the syntaxes and the type systems of programming languages?
I was reading the first chapter of Robert Harper's Practical Foundations for Programming Languages in which it introduced abstract binding trees, aka abt. It seems pretty like typed lambda calculus.
There are ground sorts, which are similar to…
盛安安
- 944
- 5
- 14
2
votes
1 answer
Converting Regular expression to DFA by building syntax tree
There is a way to convert regular expression to DFA (deterministic finite automata)
which is to build a syntax tree and then compute first pos, last pos, follow pos, and then use a Transition technique to build DFA for that particular regular…
user3127212
- 23
- 3
2
votes
2 answers
Why are syntax trees used in genetic programming?
Reading a course on genetic programming, the first chapter describes the syntax tree as the basic representation of programs in genetic programming.
What are the reasons leading to the choice of a syntax tree in genetic programming? Are there any…
Chirac
- 133
- 6
2
votes
0 answers
What kind of structural features of strings can be described by regular grammars?
Context-free grammars, as well as other types of grammars, can naturally
associate structure with the strings of the defined language, for
example tree structures in the case of context-free language.
What kind of structural features can be thus…
babou
- 19,645
- 43
- 77
2
votes
2 answers
Textbook on formal syntax (and semantics) of programming languages
I'd like to learn about formal syntax of programming languages: how do we describe the syntax of a programming language and how it should be parsed? How do we assign formal semantics to a parsed program?
I've looked at textbooks like this one, but…
user56834
- 4,244
- 5
- 21
- 35
2
votes
1 answer
Code optimization - syntax tree vs. intermediate representation
I'm working on a compiler for my own custom language. As I was reading an article on code optimization, I noticed that it assumed that the intermediate representation of the code had already been formed. Though I haven't yet started writing the…
Daniel Walker
- 115
- 7
2
votes
1 answer
What are the known ambiguities in C language grammar?
I have found this reference for the C syntax Backus-Naur Form (BNF). I was wondering if there are any other ambiguities in this grammar other than the infamous "dangling else"? Also how we can modify the BNF grammar to avoid those ambiguities,…
Foad
- 211
- 2
- 10
2
votes
1 answer
Is there a good way to hash abstract binding trees?
The hash function should be invariant under alpha-renaming. Using de Bruijn notation seems to be possible, but it requires alpha-converting the whole tree when a binding is created, and has the unhappy consequence that a substructure of an abt is…
Trebor
- 230
- 1
- 10