example of GNU bison parser with lexer implemented in a C++ class

Basile Starynkevitch <[email protected]> Mon, 17 Mar 2025 18:22:40 +0100
Newsgroups gmane.comp.parsers.bison.general
Message-ID <[email protected]>
Hello all,

In the RefPerSys open source inference engine project (the GPL source code =
is on
https://github.com/RefPerSys/RefPerSys/ ...) we have a C++ class implementi=
ng
lexing. More precisely there is a C++ common super class in=20
https://github.com/RefPerSys/RefPerSys/blob/master/refpersys.hh
(in commit f13a31b91f0fad it is near line 2840 of refpersys.hh)=20
which has the following relevant member functions (our textual data is UTF-=
8).

   const char*curcptr(void) const; // give the current byte pointer
   const std::string current_line(void) const; /// give the current line
   void advance_cursor_bytes(unsigned nb); // advance the byte pointer by n=
b

there are many other member functions (some might become obsolete)

My question is to find (for inspiration) some open source software, whose p=
arser
is GNU bison 3.8 generated, and whose lexer is implemented by user provided=
 C++
classes.

The lexer could be used for parsing other things than files (e.g. FLTK widg=
et
containing strings)

thanks for your help.

regards from France.
--=20
Basile STARYNKEVITCH           <[email protected]>
8 rue de la Fa=C3=AFencerie
92340 Bourg-la-Reine,          France
http://starynkevitch.net/Basile & https://github.com/bstarynk=20