|
ABSTRACT
It is possible to translate code written in Emacs Lisp or another Lisp dialect which uses dynamic scoping to a more modern programming language with lexical scoping while largely preserving structure and readability of the code. The biggest obstacle to such an idiomatic translation from Emacs Lisp is the translation of dynamic binding into suitable instances of lexical binding: Many binding constructs in real programs in fact exhibit identical behavior under both dynamic and lexical binding. An idiomatic translation needs to detect as many of these binding constructs as possible and convert them into lexical binding constructs in the target language to achieve readability and efficiency of the target code. The basic prerequisite for such an idiomatic translation is thus a dynamic scope analysis which associates variable occurrences with binding constructs. We present such an analysis. It is an application of the Nielson/Nielson framework for flow analysis to a semantics for dynamic binding akin to Moreau's. Its implementation handles a substantial portion of Emacs Lisp, has been applied to realistic Emacs Lisp code, and is highly accurate and reasonably efficient in practice.
REFERENCES
Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.
| |
1
|
|
 |
2
|
|
| |
3
|
P. Bothner. JEmacs-the java/scheme-based emacs. In Proceedings of the FREENIX Track; 2000 USENIX Annual Technical Conference (FREENIX-00), pages 271-278, Berkeley, CA. June 18-23 2000. USENIX Ass.
|
| |
4
|
P. Bothner. JEmacs --the Java/Scheme-based Erases text editor. http://jemacs.sourceforge.net/. Feb. 2001.
|
| |
5
|
H. B. Curry and R. Feys. Combinatory Logic, volume I. North-Holland, Amsterdam, 1958.
|
| |
6
|
M. Felleisen and D. P. Friedman, Control operators, the SECD-machine, and the A-calculus. In M. Wirsing, editor, Formal Description of Programming Concepts III, pages 193-217. NorthHolland, 1986.
|
| |
7
|
C. Flanagan and M. Felleisen. Set-based analysis for full scheme and its use in soft-typing. Technical Report TR95-254, Rice University, Oct., 1995.
|
 |
8
|
|
| |
9
|
|
| |
10
|
Guile Emacs. http://gemacs.sourceforge.net/, July 2000.
|
| |
11
|
R. Harper and C. Stone. An interpretation of Standard ML in type theory. Technical Report CMU-CS-97- i47, Carnegie Mellon University, Pittsburgh, PA, June 1997. (Also published as Fox Memorandum CMU-CS-FOX-97-01.).
|
 |
12
|
|
| |
13
|
|
 |
14
|
|
| |
15
|
|
| |
16
|
B. Lewis, D. LaLiberte, R. Stallman, and the GNU Manual Group. GNU Emacs Lisp reference manual. http //vww gnu. org/manual/elisp-manual-20-2 .5/ elisp.html, 1785.
|
 |
17
|
Jeffrey R. Lewis , John Launchbury , Erik Meijer , Mark B. Shields, Implicit parameters: dynamic scoping with static types, Proceedings of the 27th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, p.108-118, January 19-21, 2000, Boston, MA, USA
[doi> 10.1145/325694.325708]
|
| |
18
|
|
 |
19
|
|
| |
20
|
|
| |
21
|
M. Neubauer. Dynamic scope analysis for Emacs Lisp. Master's thesis, Ebcrhard-KarlsUniversitt Tuhirigen, Dec. 2000. http: //www. ml ormatik. uni-freiburg. de/Theubauer/diplom.ps.gz.
|
 |
22
|
|
| |
23
|
G. D. Plotkin. A structural approach to operational semantics. Technical Report DAIMI FN19. Computer Science Department, Aarhus University, Aarhus, Denmark. Sept. 1981.
|
| |
24
|
|
| |
25
|
K. Raeburn. Guile-based Emacs. http: //www.mit.edu/raeburn/guilemacs/, July 1999.
|
 |
26
|
|
| |
27
|
|
| |
28
|
R. Stallman. GNU extension language plans. Usenet article. Oct. 1994.
|
| |
29
|
B. Wing. XEmacs Lisp Reference Manual, ftp://ftp.xemacs.org/pub/xemacs/docs!a4/ lispref-a4.pdf.gz, May 1999. Version 3.4.
|
| |
30
|
|
| |
31
|
|
 |
32
|
|
|