This tool provides an automatic way to extract semantic information from JVM libraries. This information is represented by .lsl files written in LibSL (library specification language).
Analyzing stages are atomic steps of specification extracting. To implement new one, you should:
- Create new gradle submodule in module
stages
(via the IDE or manually) - Implement the interface
AnalysisStage
:class MyStage : AnalysisStage { override val name: String = "My Awesome Stage" override fun run(analysisContext: GlobalAnalysisContext) { // analysis logic } }
- Add your analysis stage to the integration tests pipeline. You can do it in file
TestPlatform, in
PipelineConfig {}
lambdas.
The testdata (files to be compiled and used in tests) are located here. You can add new packages like existing ones. Also, you can add any dependencies to gradle (see build.gradle.kts) and use it as a testdata.
After the new testdata was added, you should add a corresponding test-function to Tests.kt. You can use this file for examples.
The main APIs are kfg and LibSL Parser API. The first one provides API to work with JVM bytecode. The second one provides API to work with LibSL code: get info from it and update its structure. For examples and docs of LibSL parser visit its readme.
You can find an example of stage in stages:lsl-class-reader
module. This module builds the framework of the processing
library. This framework represents by LibSL parser's Tree. This module shows how to create new nodes such
as types, automata, functions, contexts, etc.
Module stages:assign-analysis
demonstrates how to use information from ASG: how to map entities from kfg to LibSL
nodes, how to resolve functions and automata and other.