Re: example of GNU bison parser with lexer implemented in a C++ class
Hans Ã…berg <[email protected]> Mon, 17 Mar 2025 20:34:02 +0100
| Newsgroups | gmane.comp.parsers.bison.general |
|---|---|
| Message-ID | <[email protected]> |
> On 17 Mar 2025, at 18:22, Basile Starynkevitch = <[email protected]> wrote: >=20 > Hello all, >=20 > In the RefPerSys open source inference engine project (the GPL source = code is on > https://github.com/RefPerSys/RefPerSys/ ...) we have a C++ class = implementing > 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). >=20 > 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 nb >=20 > there are many other member functions (some might become obsolete) >=20 > My question is to find (for inspiration) some open source software, = whose parser > is GNU bison 3.8 generated, and whose lexer is implemented by user = provided C++ > classes. >=20 > The lexer could be used for parsing other things than files (e.g. FLTK = widget > containing strings) I am writing on that, for eventual use in a logical program (theorem = prover): https://savannah.gnu.org/git/?group=3Dmetalogic-inference In this thread there is information about that and other C++ lexers: https://www.mail-archive.com/[email protected]/msg12970.html