a. General context of code generators

This is written in the context of neferti.

We examine the problem in a broad sense to set the stage for smart contract generators.

The presence of higher level languages (C, Pascal, C++, Rust, Go) can be said to be a success of generators, as compilers/parsers generate machine code or lower level constructs, freeing us all up from writing in assembler or even lower level code (which would have been impossible at scale). For interpreted languages (Java, Python) Virtual Machines do this generation dynamically. Creating an ecosystem of syntax checkers, pre-compilers, linkers etc. that are used extensively. However, generators are 

I have been involved in the world of generators for many years. What I call generators are not just compilers/parsers. In the early days it was felt that code could be generated to solve any problem, if the problem can be expressed in higher level constructs; especially to reduce dependency on programmers who were in short supply. These generators creates code in higher level languages from a visual representation or a template. Usually the visual representation is a grammar of the language represented by widgets and their connections. These require some form of logical thinking.

Generators have had success in this is by utilizing specific generators like LINC-4GL (which builds code, the database schemas, the network definitions and programs and Job Control or deployment). This concept was carried over into specific ecosystems, in Oracle, IBM, Microsoft etc, the BI revolution introduced these concepts. I have had success in the extremely limited domain for generating html using XSLT, connectors between a database schema and generated html to produce easily consumable risk displays with drilldowns, from larger aggregations to very granular risk.  This allowed transparency into risk displays, for a firm level risk to risk at the instrument level. Tools to build parsers and compilers using yacc and lex for embedded systems etc. Most of the successes were in the realm of domain specific languages or models and addressed specific functionality.

General purpose code generators have been problematic, similar to the challenges faced by General AI.

Hence we should probably use very targeted generators in the context of NFTs. At first generating a smart contract parametrized by certain inputs for the variables, joining them with the pre-generated code available or adapted from samples/OpenZeppelin etc. The inputs can come in the form of JSON files which in turn can be generated by entry into a UI. It will be nice to be able to deploy the smart contract into a specific Blockchain. Another part could also generate some kind of a wallet plug-in for issuing and transferring the NFT.

b. Concrete projects that we are aware of (Oracle generators for ERC-721 variants unifying TTF and yeoman generator)


References

Yeoman

Code generation using xslt - a little out of the way but has a nice explanation about code gen.

  • No labels