Fix segfault when involing "lex" without specify the output "-o" and …
…make it work as specified in the "lex.1" man page
good job, let me know when you're done and this can be merged.
In several interesting grammars they use <<EOF>> that is a flex extension I saw that you also have add some flex extensions.
Have you thought about adding <<EOF>> ?
I'm basically looking at this project to try to generate Javascript/Typescript lexers to use on a online playground like https://meimporta.eu/TsccYaccLex/playground.html , https://mingodad.github.io/CocoR-Typescript/playground .
The idea is to somehow compile kmyacc and lex to webassembly to do the heavy lifting and then run the resulting lex/parser directly through the browser.
Have you thought about adding
<<EOF>>?
no, but feel free to add support for it.
my personal plan with this project was to completely replace flex[0] in sabotage linux, but it turned out that too many packages use advanced flex features like reentrancy.
[0]: flex is a giant unreadable hairball full of ifdefs and bugs and depends on GNU m4 and several external m4 files
btw, when evaluating parser generators for own lagnuage projects the most interesting candidate i found was http://repo.hu/projects/byaccic/
I have some patched/extended parser generators here too https://github.com/mingodad/lalr-parser-test , I'm looking now on byaccic.
About reentrancy I already have a working reentrant scanner manually modified from the one generated by lex that need to be transferred to the templates/forms, see attached just in case it can be of your interest.
lex-reentrant.zip
see attached just in case it can be of your interest
definitely interesting, i'd happily accept a PR
hello @mingodad, what are the preconditions to experience segfault you describe in ea6229d ? using just lex foo.l without -o parameter works as intended, a file called lex.yy.c is produced.
Just don't specify an output filename and the code generator would try to write to fout that is not initialized.
Just don't specify an output filename
so as i said above, lex foo.l ? works fine in my case, and sub1.c checks whether fout is NULL, else uses lex.yy.c (unlike in your patch yy.lex.c)
It was segfaulting for me with one of several lex files I was testing, but right now I don't remember which one.