|ChatGPT explains compilers firstname.lastname@example.org (gah4) (2023-02-15)|
|Date:||Wed, 15 Feb 2023 14:06:15 -0800 (PST)|
|Injection-Info:||gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="11548"; mail-complaints-to="email@example.com"|
|Keywords:||design, history, comment|
|Posted-Date:||15 Feb 2023 17:31:13 EST|
Someone in another group asked ChatGPT a computer hardware question.
After a few other tries, I asked about recursive descent or flex/bison.
Here is the answer:
"Both recursive descent and Flex/Bison have their own strengths and weaknesses
when it comes to writing compilers.
Recursive descent is a top-down parsing technique that involves writing
separate procedures for each non-terminal symbol in the grammar. This can be a
good approach for smaller grammars or when you want more control over the
parsing process, since you are essentially writing the parsing logic by hand.
Recursive descent parsers are also generally easier to debug than parsers
generated by tools like Flex/Bison.
On the other hand, Flex/Bison are tools that generate lexer and parser code
based on a grammar specification. This can be a good approach for larger and
more complex grammars, as it can save a lot of time and effort in writing the
parsing logic. Additionally, Flex/Bison-generated parsers are usually more
efficient than recursive descent parsers, as they are often implemented using
a bottom-up parsing technique.
Ultimately, the choice between recursive descent and Flex/Bison (or similar
tools) will depend on the specific needs of your compiler project. If you have
a simple grammar and want more control over the parsing process, recursive
descent might be a good choice. If you have a more complex grammar and want to
save time and effort, Flex/Bison might be a better choice."
I also asked about Fortran vs. PL/I for scientific programming.
Among others, it claims that PL/I has a more complex syntax than
Fortran. I suspect I would have said the other way around.
But what is the actual scale to measure syntax complexity?
[Gee, I wasted all that time writing a flex/bison book by hand. Re Fortran
vs. PL/I, it depends a lot what versions you're talking about, but IBM PL/I
has a very large grammar due to things like the COBOL picture stuff and the
many flavors of I/O. -John]
Return to the
Search the comp.compilers archives again.