From 535281f0ff79d1064961d394a04bfb5066068b09 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sat, 29 Feb 2020 12:04:01 +0100 Subject: [PATCH] examples: bistromathic: don't use Flex This example will soon use GNU readline, so its scanner should be easy to use (concurrently) on strings, not streams. This is not a place where Flex shines, and anyway, these are examples of Bison, not Flex. There's already lexcalc and reccalc that demonstrate the use of Flex. * examples/c/bistromathic/scan.l: Remove. * examples/c/bistromathic/parse.y (yylex): New. Adjust dependencies. --- examples/c/README.md | 7 ++- examples/c/bistromathic/README.md | 7 ++- examples/c/bistromathic/local.mk | 22 ++++---- examples/c/bistromathic/parse.y | 88 +++++++++++++++++++++++++++++-- examples/c/bistromathic/scan.l | 67 ----------------------- 5 files changed, 100 insertions(+), 91 deletions(-) delete mode 100644 examples/c/bistromathic/scan.l diff --git a/examples/c/README.md b/examples/c/README.md index 1a98d462..95e2bb2a 100644 --- a/examples/c/README.md +++ b/examples/c/README.md @@ -52,13 +52,12 @@ push-parser model. ## bistromathic - all the bells and whistles This example demonstrates the best practices when using Bison. - Its interface is pure. -- It uses a custom syntax error with location tracking, lookahead correction - and token internationalization. +- Its hand-written scanner tracks locations. +- It uses a custom syntax error with location, lookahead correction and + token internationalization. - It supports debug traces with semantic values. - It uses named references instead of the traditional $1, $2, etc. -It also uses Flex to generate the scanner. -