1 of 7

Abstract Syntax Tree (AST)

An Abstract Syntax Tree for a code snippet C is a tuple ⟨N ,T , X , f, d, l⟩ where

  • N is a set of nonterminal nodes,
  • T is a set of terminal nodes,
  • X is a set of values,
  • f ∈ N is the root node,
  • d : N → (N ∪ T) is a function that maps a nonterminal node to a list of its children,
  • l : T → X is a function that maps a terminal node to an associated value.

Every node except the root appears exactly once in all the lists of children.

2 of 7

Example of representation of Java function which finds object in array as AST

3 of 7

4 of 7

FastAI

FastAI is a deep learning library which provides practitioners with high-level components that can quickly and easily provide state-of-the-art results in standard deep learning domains, and provides researchers with low-level components that can be mixed and matched to build new approaches. It aims to do both things without substantial compromises in ease of use, flexibility, or performance.

https://docs.fast.ai/

5 of 7

Representation of Code snippet as set of triplets

Given a code snippet C and its AST ⟨N,T,X,s, δ, ϕ⟩, we denote by T Pairs the set of all pairs of AST terminal nodes (excluding pairs that contain a node and itself):

That is, C is represented as the set of triplets ⟨xs , p, xt⟩ such that xs and xt are values of AST terminals, and p is the AST path that connects them.

6 of 7

FastAI basics

7 of 7

FastAI text