BSL Code Synthesizer project is a JVM implementation of the Bayesian Sketch Learning synthesizer based on the CaperGroup's paper and Bayou, their reference implementation of a such synthesizer.
BSL Code Synthesizer is implemented as an IntelliJ IDEA plugin capable of synthesizing Java STDlib and Android SDK code from a specification in a custom DSL.
BSL Code Synthesizer consists of two main modules:
- bsl-implementation -- a JVM implementation of a BSL Code Synthesizer. It is highly configurable and currently supports two "metamodels": Java STDlib and Android SDK. Any other metamodel can be defined if all appropriate algorithms are implemented within this library.
- bsl-plugin -- an IntelliJ IDEA plugin which acts as a UI frontend to the bsl-implementation library. It provides a DSL to define synthesizing queries and intention actions to call bsl-implementation.
The plugin could be installed from the Plugins Repository or build from scratch from this Github repository.
On the first synthesis command the plugin will download all needed models into a temporary folder depending on your OS.
To run the synthesis you need to create a Java method where the synthesized code will be placed. Create a multiline comment "/* ... /*" before this method, hit Alt+Enter, select Inject language or reference
and select Bayou language
from the drop-down list.
The DSL language consists of a header and one or more of evidence blocks. The header (the first line of your comment) defines synthesizer type: STDLIB
or ANDROID
. Evidence blocks could be one of the following:
One the next lines you need to add evidences:
API:=<VALUE>
orTYPE:=<VALUE>
for STDLIB synthesizer,API:=<VALUE>
,TYPE:=<VALUE>
orCONTEXT:=<VALUE>
for ANDROID synthesizer.
Syntactic errors are annotated for this DSL, so in case of a error just take a closer look at appearing annotations.
Let's consider a few examples.
Delete file:
Read file:
Clear list: