Questions tagged [tree-grammars]

17 questions
43
votes
0 answers

Is there a regular tree language in which the average height of a tree of size $n$ is neither $\Theta(n)$ nor $\Theta(\sqrt{n})$?

We define a regular tree language as in the book TATA: It is the set of trees accepted by a non-deterministic finite tree automaton (Chapter 1) or, equivalently, the set of trees generated by a regular tree grammar (Chapter 2). Both formalisms hold…
5
votes
0 answers

Weak equivalent tree grammar for Context-sensitive word grammar?

Consider arbitrary context-sensitive grammar on strings $G_s$. Is any known and described formalism (or type) for tree grammars, using which we can build weak-equivalent tree grammar $G_t$, which yield language will coincide with…
Andrey Lebedev
  • 355
  • 2
  • 18
4
votes
1 answer

Is the ambiguity of a regular tree grammar decidable?

Is there an algorithm which decides whether a regular tree grammar $G$ is ambiguous, i.e. there exists a tree $t\in L(G)$ which can be parsed by the grammar in more than one ways, using only leftmost derivations? Is there a proof available about the…
3
votes
0 answers

Tree Languages are Word Languages on an Infinite Alphabet of Contexts

I have been reading the book Tata (Tree Automata Techniques and Applications), and there is a sentence I have read thousands of times, yet still don't quite understand. In the beginning of Chapter 2, the authors want to show that regular string…
john_leo
  • 1,911
  • 14
  • 26
2
votes
0 answers

Unranked trees grammars?

Ranked alphabet is very often used in Ranked Trees definition, like here for instance. In that example for given set $\Sigma=\{a,b,c\}$ ranks assigned by arity function $ar : \Sigma\rightarrow\mathcal{N}$ as: $ar(a)=2, ar(b)=2, ar(c)=1$. And Ranked…
2
votes
1 answer

Deriving from a terminal word in a context free grammar

Just to make it clear. (since my book doesn't mention anything like this) Suppose we have a context free grammar $G=(V,T,P,S)$. where $T=\{a,b\}$ (The other sets doesn't really matter). Since $\Rightarrow^*$ is the reflexive transitive closure of…
2
votes
1 answer

"Grammar inference" for 2-D images

Others have studied the following question: given a set of words $w_1,w_2,\dots \in \Sigma^*$, find a regular grammar (or a context-free grammar) that generates all of those words, is "natural" in some sense, and is as small as possible. In the…
D.W.
  • 167,959
  • 22
  • 232
  • 500
2
votes
2 answers

I'm lookin for a method to construct a particular grammar?

I'm looking for an algorithm to construct a grammar which, given a set of words which can have multiple identical symbols, represents a compressed version of this set, that is, I can generate only the words of the set but the grammar will take less…
user7060
  • 475
  • 5
  • 12
1
vote
0 answers

Extending minimal top-down tree automata

I'm trying to find an algorithm to update minimal top-down tree automata/hypergraphs. Regular tree grammars can be seen as definitions for recursive data structures: List -> cons(Bool, List) | nil() Bool -> true() | false() By minimal I mean that…
Taren
  • 111
  • 1
1
vote
1 answer

Derive a Context Free Grammar from a language

I am having challenges (in two phases) with creating a CFG. Derive the CFG for the following language Show parse trees for the strings cacab and aacabbb obtained from the grammar designed above. I am getting a bit mixed up by the exercise…
qboomerang
  • 123
  • 4
1
vote
1 answer

How to intuitively come up with an example for an ambiguous grammar and how to make that grammar unambiguous?

I don't get how to intuitively come up with an example for an ambiguous grammar. Let's take as an example this grammar: Declaration ::= Type D ; Type ::= "int" | "char" D ::= "*" D | D "[" number "]" | D…
WindBreeze
  • 271
  • 1
  • 2
  • 10
0
votes
1 answer

Unsure about parse tree of PCFG

I'm new to build parse trees and I'm really unsure if I'm doing this right. So I have this example Grammar (S->Sa, S->aSa, S->a) and the word I'm parsing is simply aaaa. My solution would look like Is this right and is this the only possible parse…
0
votes
0 answers

It shows that CF grammar is ambiguous

Let $G$ be the CF grammar that has the production rules: $S \to aS | aSbS | c$. Show that $G$ is ambiguous. I thought of proving it by representing the string $aacbc$ but I don't know if it is correct as a solution: $aS \to aaSbS \to aacbS \to…
Luca
  • 63
  • 6
0
votes
0 answers

How to count number of parse trees for a specific grammar

The task: You are standing in front of a gigantic forest of syntax trees. One tree looks more fascinating than the other. In front of the forest is a sign: "Every tree in this forest arises from a derivation with exactly two steps and has exactly…
0
votes
1 answer

Adding constraints in grammar for Grammatical Evolution

I'm trying to use Grammatical Evolution for creating trading strategies. Each sentence in the grammar when evaluated gives a weight matrix of size n x p . (n is the length of backtesting period and p is the total number of stocks in portfolio) BNF…
mea43
  • 103
  • 3
1
2