home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / compiler / 1453 < prev    next >
Encoding:
Internet Message Format  |  1992-08-25  |  5.4 KB

  1. Path: sparky!uunet!cs.utexas.edu!uwm.edu!psuvax1!rutgers!faatcrl!iecc!compilers-sender
  2. From: eifrig@beanworld.cs.jhu.edu (Jonathan Eifrig)
  3. Newsgroups: comp.compilers
  4. Subject: Semantics Tools
  5. Keywords: parse, optimize
  6. Message-ID: <92-08-153@comp.compilers>
  7. Date: 25 Aug 92 23:37:29 GMT
  8. References: <92-08-114@comp.compilers> <92-08-147@comp.compilers>
  9. Sender: compilers-sender@iecc.cambridge.ma.us
  10. Reply-To: eifrig@beanworld.cs.jhu.edu (Jonathan Eifrig)
  11. Organization: The Johns Hopkins University CS Department
  12. Lines: 93
  13. Approved: compilers@iecc.cambridge.ma.us
  14.  
  15. Our Moderator asks:
  16. >[Are there specification languages that would allow you do define your
  17. >language precisely enough to tell you mechanically whether a proposed
  18. >optimization was valid? -John]
  19.  
  20.     In general, of course not: any such tool could, among other such
  21. miraculous feats, decide the halting problem.  I think that the best one
  22. could hope for is a mechanical proof checker/proof development tool, sort
  23. of like Nuprl for code transformations.
  24.  
  25.     Curiously, I was wondering something related: How many people are
  26. using formal semantic methods to either (1) generate a compiler or (2)
  27. prove a compiler correct in "real life?"  My gut feeling was "not many,"
  28. but then I started thinking about some of the transformational and
  29. continuations-based compilation approaches that have been published in the
  30. last few years, and started wondering.
  31.  
  32.     In principle, it is possible to write an operational semantics for
  33. a language in, say, natural deduction style, and mechanically translate
  34. this into CPS-style interpreter for the language, using the proof-rules as
  35. primitive operations of the interpreter, if the semantics for the language
  36. has certain reasonable properties (basically, the proof rules have to be
  37. "deterministic": no two proof rules should have unifying conclusions.)
  38. Partially evaluating this interpreter then yields _some_ sort of compiler,
  39. albeit an inefficient one.  I don't know of any example of such a
  40. compiler, however.  More likely, the proof rules are used to verify that
  41. the initial translation of the source language into some standard
  42. intermediate language is faithful, and then the intermediate language
  43. compiled.  (See kelsey89a.)
  44.  
  45.     As long as we're on the subject of semantics tools, I have to give
  46. a plug to the folks from INRIA and their Centaur system.  It's a package
  47. of integrated tools, allowing one to (1) define an abstract syntax for a
  48. language and its concrete representation, automatically constructing a
  49. parser and lexer for the language, (2) define various "pretty-printers"
  50. for the abstract syntax, yielding printers and syntax-directed editors of
  51. various sorts, (3) give a natural-deduction style operational semantics of
  52. the language, similar to the Harper-Honsell-Plotkin LF system,
  53. automatically constructing an interpreter for the language, and (4) create
  54. an integrated environment for playing around with your new language, via
  55. X.  It's a great tool for playing around with little languages with novel
  56. features.  It's not free, but not real expensive, either; only a few
  57. hundred bucks.  Contact "centaur-request@mirsa.inria.fr" for more info.
  58.  
  59. Ref's:
  60. ------
  61.  
  62. @inproceedings{harper87,
  63. author = "Robert Harper and Furio Honsell and Gordon Plotkin",
  64. title = "A Framework for Defining Logics",
  65. booktitle = lics2,
  66. year = 1987,
  67. pages = "194--204",
  68. abstract = "The Logical Framework (LF) is a sytem for defining a wide
  69. class of logics.  It is based on a general treatment of syntax, rules, and
  70. proofs in terms of a typed lambda-calculus with dependent types.  Syntax
  71. is treated in a style similar to, but more general than, Martin-Lof's
  72. system of arities.  The treatment of rules and proofs focuses on the
  73. notion of a {\em judgement}.  Logics are encoded in the LF via a new
  74. principle, the {\em judgements as types} principle, whereby each judgement
  75. is identified with the type of its proofs.  This allows for a smooth
  76. treatment of discharge and variable occurence conditions and leads to a
  77. uniform treatment of rules and proofs whereby rules are viewed as proofs
  78. of higher-order judgements and proof checking is reduced to type checking.
  79. An important benefit of our treatment of formal systems is that
  80. logic-independent tools such as proof editors and proof-checkers can be
  81. constructed."
  82. }
  83.  
  84. @inproceedings{kelsey89a,
  85. author = "Richard Kelsey and Paul Hudak",
  86. title = " Realistic Compilation by Program Transformation",
  87. booktitle = popl16,
  88. year = 1989,
  89. pages = "281--292",
  90. abstract = "Using concepts from denotational semantics, we have produced a
  91. very simple compiler that can be used to compile standard programming
  92. languages and produces object code as efficient as that of production
  93. compilers.  The compiler is based entirely on source-to-source
  94. transformations performed on programs that have been translated into an
  95. intermediate language resembling the lambda calculus.  The output of the
  96. compiler, while still in the intermediate language, can be trivially
  97. translated into machine code for the target machine.  The compilation by
  98. transformation strategy is simple: the goal is to remove any dependencies
  99. on the intermediate language semantics that the target machine cannot
  100. implement directly.  Front-ends have been written for Pascal, BASIC, and
  101. Scheme and the compiler produces code for the MC68020 microprocessor."
  102. }
  103. --
  104. Jack Eifrig (eifrig@cs.jhu.edu)       The Johns Hopkins University, C.S. Dept.
  105. -- 
  106. Send compilers articles to compilers@iecc.cambridge.ma.us or
  107. {ima | spdcc | world}!iecc!compilers.  Meta-mail to compilers-request.
  108.