bison-patches
[Top][All Lists]
Advanced

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

[PATCH 0/6] RFC: examples: demonstrate yyexpected_tokens


From: Akim Demaille
Subject: [PATCH 0/6] RFC: examples: demonstrate yyexpected_tokens
Date: Sun, 1 Mar 2020 12:30:58 +0100

I'm quite happy with these changes: the bistromathic example is now
using GNU readline to provide an interactive REPL with history and
autocompletion.  The autocompletion works on top of yyexpected_tokens.
And I'm more and more convinced that yyexpected_tokens only makes
sense with push parsers.

It shows a number of issues we need to address before rolling an
alpha:
  
- some macros (yyssp, etc.) from push parsers "leak" in user code, we
  need to undefine them

- the context needed by yyexpected_tokens does not need the token,
  yypstate actually suffices.  We need more APIs to deal with that.

- yypstate is not properly setup when first allocated, which results
  in a crash of yyexpected_tokens if fired before a first token was
  read.  We should move initialization from yypush_parse into
  yypstate_new.

- I've never used readline, there's probably something better to do,
  using the autocompletion is not entirely satisfactory.  Color would
  be great too.

- sometimes is terminal is wrecked (you need to run "reset"), I'm
  probably not always quiting GNU readline properly.

- I have not paid attention to portability wrt GNU readline yet: it is
  required, it should not.

- we should get rid of yysyntax_error_arguments as Adrian suggested
  (https://lists.gnu.org/r/bison-patches/2020-02/msg00069.html)

- at some point, we will have to be more cautious about the possible
  endless looping of LAC.

I would really really appreciate feedback, improvements, etc.

I would also appreciate answers to my other message about benchmarks:
https://lists.gnu.org/r/bison-patches/2020-02/msg00067.html.

Cheers!

Akim Demaille (6):
  examples: lexcalc: demonstrate location tracking
  examples: bistromathic: strengthen tests
  examples: bistromathic: don't use Flex
  gnulib: use readline
  examples: use consistently the GFDL header for readmes
  examples: bistromathic: demonstrate use of yyexpected_tokens

 NEWS                                      |  11 +-
 README                                    |  18 +-
 bootstrap.conf                            |   1 +
 examples/c++/README.md                    |   2 +-
 examples/c++/calc++/README.md             |  24 +-
 examples/c/README.md                      |  20 +-
 examples/c/bistromathic/README.md         |  33 +--
 examples/c/bistromathic/bistromathic.test |  46 +++-
 examples/c/bistromathic/local.mk          |  22 +-
 examples/c/bistromathic/parse.y           | 267 ++++++++++++++++++++--
 examples/c/bistromathic/scan.l            |  67 ------
 examples/c/calc/README.md                 |  17 +-
 examples/c/lexcalc/README.md              |  20 +-
 examples/c/lexcalc/lexcalc.test           |   7 +-
 examples/c/lexcalc/parse.y                |  14 +-
 examples/c/lexcalc/scan.l                 |  25 +-
 examples/c/pushcalc/README.md             |  19 +-
 examples/c/reccalc/README.md              |  19 +-
 examples/test                             |   9 +-
 gnulib                                    |   2 +-
 lib/.gitignore                            |   4 +
 m4/.gitignore                             |   3 +
 22 files changed, 426 insertions(+), 224 deletions(-)
 delete mode 100644 examples/c/bistromathic/scan.l

-- 
2.25.1




reply via email to

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