Skip to main content
Back to USENIX
  • Conferences
  • Students
Sign in

USENIX Conference Policies

  • Event Code of Conduct
  • Conference Network Policy
  • Statement on Environmental Responsibility Policy

ASTLOG: A Language for Examining Abstract Syntax Trees

Roger F. Crew, Microsoft Research

We desired a facility for locating/analyzing syntactic artifacts in abstract syntax trees of C/C++ programs, similar to the facility grep or awk provides for locating artifacts at the lexical level. Prolog, with its implicit pattern-matching and backtracking capabilities, is a natural choice for such an application. We have developed a Prolog variant that avoids the overhead of translating the source syntactic structures in to the form of a Prolog database; this is crucial to obtaining acceptable performance on large programs. An interpreter for this language has been implemented and used to find various kinds of syntactic bugs and other questionable constructs in real programs like Microsoft SQL server (450Klines) and Microsoft Word (2Mlines) in time comparable to the runtime of the actual compiler. The model in which terms are matched against an implicit current object, rather than simply proven against a database of facts, leads to a distinct "insideout functional" programming style that is quite unlike typical Prolog, but one that is, in fact, well-suited to the examination of trees. Also, various second-order Prolog set-predicates may be implemented via manipulation of the current object, thus retaining an important feature without entailing that the database be dynamically extensible as the usual implementation does.

Roger F. Crew, Microsoft Research

BibTeX
@inproceedings {260996,
author = {Roger F. Crew},
title = {{ASTLOG}: A Language for Examining Abstract Syntax Trees},
booktitle = {Conference on Domain-Specific Languages (DSL 97)},
year = {1997},
address = {Santa Barbara, CA },
url = {https://www.usenix.org/conference/dsl-97/astlog-language-examining-abstract-syntax-trees},
publisher = {USENIX Association},
month = oct
}
Download

Links

Paper: 
http://usenix.org/publications/library/proceedings/dsl97/full_papers/crew/crew.pdf
  • Log in or register to post comments

© USENIX
EIN 13-3055038

  • Privacy Policy
  • Contact Us