Generate code for declarative language instead of programming language
near.tl
near.tl
In September, I began the development, and about a month ago, I released a new programming language called Plang (short for pseudo language). It embodies what is describe as intent programming. You can find the repository here: https://github.com/plangHQ
It’s remarkable how much less code is required, and there are significant security benefits as well.
Cool idea, how advanced an llm is required to "compile" the language?
The instructions are rather simple, so looking at what lama3 is doing, I think it could easily do it, I just don't have the knowledge and since the problem was solved with gpt4 I didn't want to put time into it. I'm hoping it will come with the community, with time
But fine tuning a model will take this cost down 100x. Soon enough (couple of years) it will be compiling in the avg local machine.
And just to top it off, the way compiler is built, compiling will be invisible so no more compile time
Would getting an llm to use a language like Haskell allow it to make less errors? I've had chat gpt make errors to do with state changes that maybe haskell or caml code can't have.
The question of why AI is used to generate imperative or functional code instead of declarative code … is “So, why do programmers write code like this?”
It is the same issue, with essentially the same pros and cons.
Declarative is the best approach to code - when it works the best. But today declarative languages tend to be more domain specific, so not the best for a large proportion of code.
And also are not really purely declarative. Serious performance improvements still accrue to tuning the “declarative” code to the details of specific implementation models. I.e. to knowledge of specific databases.
—
In a way, AI language models have become the most general, if not the most reliable, declarative tools of all time.
Archiving LLM code generation conversations along with related code is helpful. Easy informal way to document intention.
In a few years a lot of source for casual and non-critical code may be natural language defined entities along side traditional source.
Yes, this might happen. In that case, human language would become the declarative language for building software. However, human language is ambiguous and would lead to unpredictable software. Lojban was created for this purpose—to be unambiguous and facilitate machine understanding. Perhaps, an unambiguous subset of English could be the declarative language of the future.
When the natural language specification "source" is updated, the model takes into account the change, and the current implementation, and makes the change in a low impact way.
Similar to how developers today would respond to a changing spec, while maintaining strong continuity in the implementation. Only change what you need to.
We don't really need a declarative language to be in the same position as asking for high-level description, fewer lines means more places to hide hallucinations. We need an hallucination alarm to show where difficult but legitimate requirements are being squirmed out of without reason.
A more common definition is that imperative code specify a sequence of steps to execute while declarative code specify the desired end state, and the engine have to figure out how to arrive there.
By this definition Excel is declarative because you don’t specify in which order to execute the operations. Excel has to figure out when and in which order to execute the formula, presumably by building a dependency graph.
There's a long way between hand-writing CPU instructions to make sure it does the same thing between runs, and the other extreme of writing a terraform yaml config and letting the engine decide how to get there.
Excel is so far from SQL/YAML that I can't lump them all together as "declarative". "Column from examples" comes to mind as a more declarative Excel feature than formulas in general.
No, the CPU instructions are explicitly sequenced. The fact that the CPU can sometimes execute them out of order doesn't change this basic fact.
Excel is absolutely declarative in its core form. Of course the scripting languages that are embedded can change that, but it's 100% declarative if you don't use that part of it. A = B + C in Excel is not a calculation or assignment operation, it's declaring a relation between those variables that Excel preserves how it sees fit.