Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #3384 > unrolled thread

ChatGPT explains compilers

Started bygah4 <gah4@u.washington.edu>
First post2023-02-15 14:06 -0800
Last post2023-02-15 14:06 -0800
Articles 1 — 1 participant

Back to article view | Back to comp.compilers


Contents

  ChatGPT explains compilers gah4 <gah4@u.washington.edu> - 2023-02-15 14:06 -0800

#3384 — ChatGPT explains compilers

Fromgah4 <gah4@u.washington.edu>
Date2023-02-15 14:06 -0800
SubjectChatGPT explains compilers
Message-ID<23-02-044@comp.compilers>
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]

[toc] | [standalone]


Back to top | Article view | comp.compilers


csiph-web