SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1810.02720 · 2018

TRANX: A Transition-based Neural Abstract Syntax Parser for Semantic Parsing and Code Generation

arXiv · PDF · Open in the Atlas

Code that ran

7 of 7 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 3 failures of our instrument; 0 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/1810.02720.json · badge: /api/ran/1810.02720.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
pcyin/tranX canonical (classifier label)
classifier basis: census
5 ran · 0 no recorded run
yuxiang2/CoNaLa reimplementation (classifier label)
classifier basis: classifier_2025
2 ran · 0 no recorded run
FunctionStatusWhere it lives
decode Ran
ran on a synthesized input
pcyin/tranX/evaluation.py
code served (permissive licence) · get_code("07759c7084e98fc4")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from collections import namedtuple

torch.manual_seed(0)

# Define stand-in classes for the tree and hypothesis objects
class ASTNode:
    def __init__(self):
        self.value = "root"
    
    def to_string(self):
        return "ASTNode(root)"

class Hypothesis:
    def __init__(self, tree_obj):
        self.tree = tree_obj
        self.code = None

class Example:
    def __init__(self, idx, src_sent, tgt_code, table=None):
        self.idx = idx
        self.src_sent = src_sent
        self.tgt_code = tgt_code
        self.table = table

class TransitionSystem:
    def ast_to_surface_code(self, tree):
        return "SELECT * FROM table"

# Build a minimal model that satisfies the function's usage
class MinimalModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.transition_system = TransitionSystem()
    
    def parse(self, src_sent, context=None, beam_size=1):
        # Return a list of hypotheses
        hyps = []
        for i in range(2):
            tree = ASTNode()
            hyp = Hypothesis(tree)
            hyps.append(hyp)
        return hyps

# Build stand-in args config
class ArgsConfig:
    def __init__(self):
        self.parser = 'sql_parser'  # not 'wikisql_parser'
        self.beam_size = 3

# Create example objects
examples = [
    Example(
        idx='ex1',
        src_sent=['SELECT', 'FROM', 'table'],
        tgt_code='SELECT * FROM table',
        table=None
    ),
    Example(
        idx='ex2',
        src_sent=['SELECT', 'id', 'FROM', 'users'],
        tgt_code='SELECT id FROM users',
        table=None
    )
]

# Create the model
model = MinimalModel()

# Create args
args = ArgsConfig()

# Define ARGS dict with all parameters
ARGS = {
    'examples': examples,
    'model': model,
    'args': args,
    'verbose': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 2, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
dot_prod_attention Ran
ran; our contract draft was wrong, not the code
pcyin/tranX/model/nn_utils.py
code served (permissive licence) · get_code("8a2b39c05ccc8ca0")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn.functional as F

torch.manual_seed(0)

batch_size = 2
hidden_size = 4
src_sent_len = 3

# h_t: (batch_size, hidden_size)
h_t = torch.randn(batch_size, hidden_size)

# src_encoding: (batch_size, src_sent_len, hidden_size * 2)
src_encoding = torch.randn(batch_size, src_sent_len, hidden_size * 2)

# src_encoding_att_linear: (batch_size, src_sent_len, hidden_size)
src_encoding_att_linear = torch.randn(batch_size, src_sent_len, hidden_size)

# mask: (batch_size, src_sent_len) - boolean mask where True values should be masked out
mask = torch.tensor([[False, True, False], [False, False, True]])

ARGS = {
    'h_t': h_t,
    'src_encoding': src_encoding,
    'src_encoding_att_linear': src_encoding_att_linear,
    'mask': mask
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
evaluate Ran
ran; our contract draft was wrong, not the code
pcyin/tranX/evaluation.py
code served (permissive licence) · get_code("59e007a728de1c57")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from typing import List, Dict, Any

torch.manual_seed(0)

# Stand-in classes for the domain

class TreeNode:
    def __init__(self, value="node"):
        self.value = value
        self.children = []
    
    def to_string(self):
        return f"({self.value})"

class Hypothesis:
    def __init__(self, tree):
        self.tree = tree
        self.code = None

class Example:
    def __init__(self, idx, src_sent, tgt_code, table=None):
        self.idx = idx
        self.src_sent = src_sent
        self.tgt_code = tgt_code
        self.table = table

class TransitionSystem:
    def ast_to_surface_code(self, tree):
        return "SELECT * FROM table"

class SimpleParser(nn.Module):
    def __init__(self, transition_system):
        super().__init__()
        self.transition_system = transition_system
        self.training = False
    
    def parse(self, src_sent, context=None, beam_size=1):
        # Return a list of hypotheses with trees
        hyps = []
        for _ in range(beam_size):
            tree = TreeNode("root")
            hyp = Hypothesis(tree)
            hyps.append(hyp)
        return hyps

class SimpleEvaluator:
    def evaluate_dataset(self, examples, decode_results, fast_mode=False, args=None):
        return {
            "accuracy": 0.85,
            "execution_accuracy": 0.90
        }

class SimpleArgs:
    def __init__(self, parser='seq2seq_parser', beam_size=3):
        self.parser = parser
        self.beam_size = beam_size

# Build minimal instances

transition_system = TransitionSystem()
parser = SimpleParser(transition_system)
evaluator = SimpleEvaluator()

examples = [
    Example(
        idx="ex_0",
        src_sent=["SELECT", "all", "records"],
        tgt_code="SELECT * FROM table",
        table={"columns": ["id", "name"]}
    ),
    Example(
        idx="ex_1",
        src_sent=["FILTER", "by", "age"],
        tgt_code="SELECT * FROM table WHERE age > 18",
        table={"columns": ["id", "age"]}
    ),
]

args = SimpleArgs(parser='seq2seq_parser', beam_size=2)

ARGS = {
    'examples': examples,
    'parser': parser,
    'evaluator': evaluator,
    'args': args,
    'verbose': False,
    'return_decode_result': False,
    'eval_top_pred_only': False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_bleu_all Ran
ran, honoured the contract we drafted
yuxiang2/CoNaLa/seq2seq/evaluate.py
pointer only (licence: NONE) · get_code("274d1bf99b29c786")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, yuxiang2/CoNaLa when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

input_transpose Ran
ran on a synthesized input
pcyin/tranX/model/nn_utils.py
code served (permissive licence) · get_code("4d634e9ce2a4f738")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 2, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from six.moves import xrange

# Define the arguments for input_transpose
# The function expects:
# - sents: List[sequence] of size (batch_size, max_sent_len)
# - pad_token: a token value to use for padding

# Create a small batch of sequences with different lengths
sents = [
    [1, 2, 3],           # sequence of length 3
    [4, 5]               # sequence of length 2
]

pad_token = 0  # Use 0 as the padding token

ARGS = {
    "sents": sents,
    "pad_token": pad_token
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
six, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 2, dtype family int — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
length_array_to_mask_tensor Ran
ran on a synthesized input
pcyin/tranX/model/nn_utils.py
code served (permissive licence) · get_code("4f498904d7930e35")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family int, shape (3, 5) as a later run recorded it. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

ARGS = {
    "length_array": [3, 5, 2],
    "cuda": False,
    "valid_entry_has_mask_one": False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family int, shape (3, 5) — shape (3, 5) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
tokenize_for_bleu_eval Ran
ran; our contract draft was wrong, not the code
yuxiang2/CoNaLa/seq2seq/evaluate.py
pointer only (licence: NONE) · get_code("59002967d7c8c2a8")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, yuxiang2/CoNaLa when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 5 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 5 later) and 2 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
dot_prod_attention 2 other papers
2 later
1905.08205 (2019-05)
Towards Complex Text-to-SQL in Cross-Domain Database with Intermediate Representation
2004.09015 (2020-04)
Incorporating External Knowledge through Pre-training for Natural Language to Code Generation
input_transpose 2 other papers
2 later
2004.09015 (2020-04)
Incorporating External Knowledge through Pre-training for Natural Language to Code Generation
2105.14796 (2021-05)
Improving Tree-Structured Decoder Training for Code Generation via Mutual Learning
length_array_to_mask_tensor 2 other papers
2 later
2004.09015 (2020-04)
Incorporating External Knowledge through Pre-training for Natural Language to Code Generation
2105.14796 (2021-05)
Improving Tree-Structured Decoder Training for Code Generation via Mutual Learning
evaluate 1 other paper
1 later
2004.09015 (2020-04)
Incorporating External Knowledge through Pre-training for Natural Language to Code Generation
tokenize_for_bleu_eval 1 other paper
1 later
2106.08253 (2021-06)
A Syntax-Guided Edit Decoder for Neural Program Repair

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

We present TRANX, a transition-based neural semantic parser that maps natural language (NL) utterances into formal meaning representations (MRs). TRANX uses a transition system based on the abstract syntax description language for the target MR, which gives it two major advantages: (1) it is highly accurate, using information from the syntax of the target MR to constrain the output space and model the information flow, and (2) it is highly generalizable, and can easily be applied to new types of MR by just writing a new abstract syntax description corresponding to the allowable structures in the MR. Experiments on four different semantic parsing and code generation tasks show that our system is generalizable, extensible, and effective, registering strong results compared to existing neural semantic parsers.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("1810.02720")
get_code_for_paper("1810.02720")
have("1810.02720")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/1810.02720.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/1810.02720.svg)](https://syntology.ai/paper/1810.02720)

Connect an agent — have() is free.