Nothing Special   »   [go: up one dir, main page]

skip to main content
10.1145/1069774.1069784acmconferencesArticle/Chapter ViewAbstractPublication PagesppdpConference Proceedingsconference-collections
Article

Automatic type inference via partial evaluation

Published: 11 July 2005 Publication History

Abstract

Type checking and type inference are fundamentally similar problems. However, the algorithms for performing the two operations, on the same type system, often differ significantly. The type checker is typically a straightforward encoding of the original type rules. For many systems, type inference is performed using a two-phase, constraint-based algorithm.We present an approach that, given the original type rules written as clauses in a logic programming language, automatically generates an efficient, two-phase, constraint-based type inference algorithm. Our approach works by partially evaluating the type checking rules with respect to the target program to yield a set of constraints suitable for input to an external constraint solver. This approach avoids the need to manually develop and verify a separate type inference algorithm, and is ideal for experimentation with and rapid prototyping of novel type systems.

References

[1]
A. Aiken, M. Fähndrich, J. S. Foster, and Z. Su. A toolkit for constructing type- and constraint-based program analyses. In Proceedings of the 2nd Annual Workshop on Types in Compilation,TIC'98, July 1998.]]
[2]
S.-J. Craig and M. Leuschel. LIX: an effective self-applicable partial evaluator for prolog. In Proceedings of the 7th International Symposium on Functional and Logic Programming, FLOPS'04, Apr. 2004.]]
[3]
R. F. Crew. ASTLOG: A language for examining abstract syntax trees. In Proceedings of the USENIX Conference on Domain-Specific Languages, Oct. 1997.]]
[4]
C. Flanagan and S. N. Freund. Type-based race detection for Java. In Proceedings of the 2000 ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI'00, June 2000.]]
[5]
C. Flanagan and S. N. Freund. Type inference against races. In Proceedings of the 2004 Static Analysis Symposium, SAS'04, Aug. 2004.]]
[6]
C. Flanagan, K. R. M. Leino, M. Lillibridge, G. Nelson, J. B. Saxe, and R. Stata. Extended static checking for Java. In Proceedings of the 2002 ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI'02, May 2002.]]
[7]
C. Flanagan and S. Qadeer. A type and effect system for atomicity. In Proceedings of the 2003 ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI'03, June 2003.]]
[8]
T. Frühwirth, E. Shapiro, M. Vardi, and E. Yardeni. Logic programs as types for logic programs. In Proceedings of the 6th Annual IEEE Symposium on Logic in Computer Science (LICS), pages 300--309, 1991.]]
[9]
T. W. Frühwirth. Type inference by program transformation and partial evaluation. In Proceedings of the Workshop on Meta-Programming in Logic (META'88), pages 263--282, 1988.]]
[10]
Y. Futamura. Partial evaluation of computation process---an approach to a compiler-compiler. Systems, Computers, Controls, 2(5):45--50, 1971.]]
[11]
S. Horowitz, T. Reps, and M. Sagiv. Demand interprocedural dataflow analysis. In Proceedings of the Third ACM SIGSOFT Symposium on Foundations of Software Engineering, pages 104--115, 1995.]]
[12]
B. Joy, G. Steele, J. Gosling, and G. Bracha. The Java™ Language Specification, Second Edition. Addison-Wesley, 2000.]]
[13]
J. Kodumal. Banshee, a toolkit for building constraint-based analyses. PhD thesis, University of California at Berkeley, 2002.]]
[14]
A. Lakhotia and L. Sterling. ProMiX: a Prolog partial evaluation system. pages 137--179.]]
[15]
M. Leuschel. The ECCE partial deduction system. In Proceedings of the ILPS'97 Workshop on Tools and Environments for (Constraint) Logic Programming, 1997.]]
[16]
L. Lu and A. King. Backward type inference generalises type checking. In Proceedings of the 9th International Symposium on Static Analysis, SAS'02, Aug. 2002.]]
[17]
M. W. Moskewicz, C. F. Madigan, Y. Zhao, L. Zhang, and S. Malik. Chaff: Engineering an efficient SAT solver. In Proceedings of the 38th Annual Design Automation Conference, DAC'01, June 2001.]]
[18]
F. Pfenning and C. Schürmann. System description: Twelf --- a meta-logical framework for deductive systems. In Proceedings of the 16th International Conference on Automated Deduction, CADE-16, July 1999.]]
[19]
C. Schürmann. Towards practical functional programming with logical frameworks, July 2003.]]
[20]
J. P. Secher and M. H. Sørensen. From checking to inference via driving and DAG grammars. In Proceedings of the 2002 ACM SIGPLAN Workshop on Partial Evaluation and Semantics-based Program Manipulation, PEPM'02, pages 41--51. ACM Press, Jan. 2002.]]
[21]
D. Shalin. Mixtus: an automatic partial evaluator for full Prolog. New Generation Computing, 12(1):7--51, 1994.]]
[22]
Z. Somogyi, F. Henderson, and T. Conway. Mercury: an efficient purely declarative logic programming language. In Proceedings of the Australian Computer Science Conference, Feb. 1995.]]
[23]
G. A. Venkatesh and C. N. Fischer. SPARE: A development environment for program analysis algorithms. IEEE Transactions on Software Engineering, 18(4), Apr. 1992.]]
[24]
J. Whaley and M. S. Lam. Cloning-based context-sensitive pointer alias analysis using binary decision diagrams. In Proceedings of the 2004 ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI'04, June 2004.]]

Cited By

View all
  • (2024)Type Inference LogicsProceedings of the ACM on Programming Languages10.1145/36897868:OOPSLA2(2125-2155)Online publication date: 8-Oct-2024
  • (2007)Interactive, scalable, declarative program analysisProceedings of the 9th ACM SIGPLAN international conference on Principles and practice of declarative programming10.1145/1273920.1273923(13-24)Online publication date: 14-Jul-2007

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image ACM Conferences
PPDP '05: Proceedings of the 7th ACM SIGPLAN international conference on Principles and practice of declarative programming
July 2005
260 pages
ISBN:1595930906
DOI:10.1145/1069774
  • General Chair:
  • Pedro Barahona,
  • Program Chair:
  • Amy Felty
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 11 July 2005

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. applications of declarative programming
  2. logic programming
  3. program analysis
  4. type systems

Qualifiers

  • Article

Conference

PPDP05
Sponsor:

Acceptance Rates

Overall Acceptance Rate 230 of 486 submissions, 47%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)1
  • Downloads (Last 6 weeks)1
Reflects downloads up to 13 Nov 2024

Other Metrics

Citations

Cited By

View all
  • (2024)Type Inference LogicsProceedings of the ACM on Programming Languages10.1145/36897868:OOPSLA2(2125-2155)Online publication date: 8-Oct-2024
  • (2007)Interactive, scalable, declarative program analysisProceedings of the 9th ACM SIGPLAN international conference on Principles and practice of declarative programming10.1145/1273920.1273923(13-24)Online publication date: 14-Jul-2007

View Options

Get Access

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media