Re:Can GPT-4 *Actually* Write Code?
by jes on Friday March 17, 2023 @11:22AM
(#35198232)
One of the ways in which I use GPT-4 is to have it help me write requirements before writing code. I also ask it "Help me review these requirements, and let me know of any places where there might be holes or ambiguities."
Yesterday, I was working on a problem of recognizing dates in strings. Rather than going right from "vague idea of what I wanted" -> Common Lisp, I tried going from "vague idea" -> "less vague idea", refining the problem statement.
Also, rather than generating code directly, I asked GPT-4 to generate an EBNF grammar for the thing I was looking to build. It was able to do so, and it was easier for me to see holes in what I wanted by looking at the grammar than it would have been looking at the generated code that purports to implement the grammar implied by the requirements.
Once you have the EBNF grammar, you can ask GPT-4 to evaluate strings against the grammar itself, rather than jumping right to generating code and test cases for the code.
I was also able to ask GPT-4 to generate an ad-hoc, recursive descent parser for the grammar, with S-expressions as the output parse tree.
Yesterday, I was working on a problem of recognizing dates in strings. Rather than going right from "vague idea of what I wanted" -> Common Lisp, I tried going from "vague idea" -> "less vague idea", refining the problem statement.
Also, rather than generating code directly, I asked GPT-4 to generate an EBNF grammar for the thing I was looking to build. It was able to do so, and it was easier for me to see holes in what I wanted by looking at the grammar than it would have been looking at the generated code that purports to implement the grammar implied by the requirements.
Once you have the EBNF grammar, you can ask GPT-4 to evaluate strings against the grammar itself, rather than jumping right to generating code and test cases for the code.
I was also able to ask GPT-4 to generate an ad-hoc, recursive descent parser for the grammar, with S-expressions as the output parse tree.