www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - [formal grammar] some measures on a first try

reply Manfred Nowak <svv1999 hotmail.com> writes:
Just managed to construct a first(?) possibly erroneus grammar for a 
conflict free LALR(1) parser for the D programming language as 
defined in the current docs, which are outdated.

I have computed some measures according to
http://www.cs.clemson.edu/~malloy/papers/iwpc00/paper.pdf 
and also cite the results from that paper in parentheses for 
(C++/C/Java).

Treeness:                  99.2  [(14.2/34.7/67.3)]
Average RHS:                2.9  (6.9/7.6/4.1)
Relative decision content: 1.28  (2.60/2.33/1.43)
Depth:                      .57  (.86/.59/.22)
Absolute decision content:  440  (368/149/213)
Levels:                     107  (21/21/89)

Notes:
1. Treeness is calculated by `1 - impurity'
2. The results from the paper for treeness are cited in brackets 
because the values in the paper are not in accordance to the 
definition of the measure in the paper
3. Except for treeness the values for the measures are considered 
better if lower.
4. The relative decision content is calculated by
   `Absolute decision content / number of nonterminals'   

-manfred
May 05 2005
next sibling parent "Ben Hinkle" <bhinkle mathworks.com> writes:
"Manfred Nowak" <svv1999 hotmail.com> wrote in message 
news:d5clst$ob2$1 digitaldaemon.com...
 Just managed to construct a first(?) possibly erroneus grammar for a
 conflict free LALR(1) parser for the D programming language as
 defined in the current docs, which are outdated.

 I have computed some measures according to
 http://www.cs.clemson.edu/~malloy/papers/iwpc00/paper.pdf
 and also cite the results from that paper in parentheses for
 (C++/C/Java).

 Treeness:                  99.2  [(14.2/34.7/67.3)]
 Average RHS:                2.9  (6.9/7.6/4.1)
 Relative decision content: 1.28  (2.60/2.33/1.43)
 Depth:                      .57  (.86/.59/.22)
 Absolute decision content:  440  (368/149/213)
 Levels:                     107  (21/21/89)

 Notes:
 1. Treeness is calculated by `1 - impurity'
 2. The results from the paper for treeness are cited in brackets
 because the values in the paper are not in accordance to the
 definition of the measure in the paper
 3. Except for treeness the values for the measures are considered
 better if lower.
 4. The relative decision content is calculated by
   `Absolute decision content / number of nonterminals'

 -manfred

It seems odd that D is best in relative decision content and worst in absolute decision content (assuming lower is better). What does that indicate? What does "the number of nonterminals" mean?
May 05 2005
prev sibling parent Ivan Senji <ivan.senji_REMOVE_ _THIS__gmail.com> writes:
Manfred Nowak wrote:
 Just managed to construct a first(?) possibly erroneus grammar for a 
 conflict free LALR(1) parser for the D programming language as 
 defined in the current docs, which are outdated.
 

Is this grammar going to be available somewhere?
 I have computed some measures according to
 http://www.cs.clemson.edu/~malloy/papers/iwpc00/paper.pdf 
 and also cite the results from that paper in parentheses for 
 (C++/C/Java).
 
 Treeness:                  99.2  [(14.2/34.7/67.3)]
 Average RHS:                2.9  (6.9/7.6/4.1)
 Relative decision content: 1.28  (2.60/2.33/1.43)
 Depth:                      .57  (.86/.59/.22)
 Absolute decision content:  440  (368/149/213)
 Levels:                     107  (21/21/89)
 
 Notes:
 1. Treeness is calculated by `1 - impurity'
 2. The results from the paper for treeness are cited in brackets 
 because the values in the paper are not in accordance to the 
 definition of the measure in the paper
 3. Except for treeness the values for the measures are considered 
 better if lower.
 4. The relative decision content is calculated by
    `Absolute decision content / number of nonterminals'   
 
 -manfred

May 09 2005