Fighting copy-pasting in PEG

3 views
Skip to first unread message

Gleki Arxokuna

unread,
Mar 25, 2015, 10:13:57 AM3/25/15
to bpfk...@googlegroups.com
I notice that a lot of combinations are "hardcoded" in PEG.
E.g. a lot of constructs are followed by "free*" several times in the grammar where the first part of the construct remains the same.

Here is an experimental grammar:

And here are the stats:
http://pastebin.com/raw.php?i=ADTJ0KdT

Here, "KE_clause free*" is used 11 times in PEG and even when "free*" doesn't follow KE_clause it could.
Why not move "free*" into KE_clause itself ? This would make the grammar easier.

"free*" is used ~200 times in the grammar. I'm sure this number can be lowered significantly.

Anyone is interested in joining such constructs into new variables?

Jorge Llambías

unread,
Mar 25, 2015, 6:28:26 PM3/25/15
to bpfk...@googlegroups.com
On Wed, Mar 25, 2015 at 11:13 AM, Gleki Arxokuna <gleki.is...@gmail.com> wrote:

Here, "KE_clause free*" is used 11 times in PEG and even when "free*" doesn't follow KE_clause it could.
Why not move "free*" into KE_clause itself ? This would make the grammar easier.

"free" could be in "post-clause" together with "indicators", and then you would need to create a special post-clause-light for the few selma'o that can't take free as modifier (PA, BY, tenses and connectives, I think). Most occurences of "free" are after a selma'o clause.
 
"free*" is used ~200 times in the grammar. I'm sure this number can be lowered significantly.

To just one if "free*" was allowed wherever "indicators" are. The rationale for the restrictions on "free" was never very clear to me.
 
mu'o mi'e xorxes

Bob LeChevalier

unread,
Mar 26, 2015, 8:56:43 PM3/26/15
to bpfk...@googlegroups.com
On 3/25/2015 6:28 PM, Jorge Llambías wrote:
> "free*" is used ~200 times in the grammar. I'm sure this number can
> be lowered significantly.
>
>
> To just one if "free*" was allowed wherever "indicators" are. The
> rationale for the restrictions on "free" was never very clear to me.

In the original YACC grammar, it was simple. I tried adding "free
modifiers" after every construct, one at a time, and excluded it where
the YACC program found an ambiguity problem.

lojbab


Reply all
Reply to author
Forward
0 new messages