bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

pic2plot: diagnosing then versus and


From: Ron Burk
Subject: pic2plot: diagnosing then versus and
Date: Sun, 13 Jan 2002 18:28:38 GMT

pic2plot would be much more pleasant to use
if it diagnosed common syntax errors in human-understandable
terms. The lack of explanatory errors is particularly
frustrating because much of the pic grammar is
English-like, leading to dismay when correct English
sentences produce only "syntax error near `x'".

One common problem is that English lets you
use 'then' and 'and' interchangeably to connect
portions of a path you are describing, while
pic does not. I tried to make the grammar diagnose
this error by changing gram.yy.

First, I added this to the grammar:

then_not_and:
    THEN
    | AND
        {
          lex_error("unexpected `and' -- did you mean `then'?");
          YYABORT;
        }

Then, I went to the non-terminal "object_spec" and replaced
    | object_spec THEN
with
    | object_spec then_not_and




reply via email to

[Prev in Thread] Current Thread [Next in Thread]