Towards Fully Declarative Program Analysis via Source Code Transformation

12/23/2021
by   Rijnard van Tonder, et al.
0

Advances in logic programming and increasing industrial uptake of Datalog-inspired approaches demonstrate the emerging need to express powerful code analyses more easily. Declarative program analysis frameworks (e.g., using logic programming like Datalog) significantly ease defining analyses compared to imperative implementations. However, the declarative benefits of these frameworks only materialize after parsing and translating source code to generate facts. Fact generation remains a non-declarative precursor to analysis where imperative implementations first parse and interpret program structures (e.g., abstract syntax trees and control-flow graphs). The procedure of fact generation thus remains opaque and difficult for non-experts to understand or modify. We present a new perspective on this analysis workflow by proposing declarative fact generation to ease specification and exploration of lightweight declarative analyses. Our approach demonstrates the first venture towards fully declarative analysis specification across multiple languages. The key idea is to translate source code directly to Datalog facts in the analysis domain using declarative syntax transformation. We then reuse existing Datalog analyses over generated facts, yielding an end-to-end declarative pipeline. As a first approximation we pursue a syntax-driven approach and demonstrate the feasibility of generating and using lightweight versions of liveness and call graph reachability properties. We then discuss the workability of extending declarative fact generation to also incorporate semantic information.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
12/08/2020

Learning to Represent Programs with Heterogeneous Graphs

Program source code contains complex structure information, which can be...
research
09/05/2020

TreeCaps: Tree-Based Capsule Networks for Source Code Processing

Recently program learning techniques have been proposed to process sourc...
research
03/09/2019

Program Classification Using Gated Graph Attention Neural Network for Online Programming Service

The online programing services, such as Github,TopCoder, and EduCoder, h...
research
09/14/2017

Extending Coinductive Logic Programming with Co-Facts

We introduce a generalized logic programming paradigm where programs, co...
research
04/19/2019

Learning Programmatic Idioms for Scalable Semantic Parsing

Programmers typically organize executable source code using high-level c...
research
07/13/2021

Mining Idioms in the Wild

Existing code repositories contain numerous instances of code patterns t...
research
12/05/2021

The Linear Arrangement Library. A new tool for research on syntactic dependency structures

The new and growing field of Quantitative Dependency Syntax has emerged ...

Please sign up or login with your details

Forgot password? Click here to reset