Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Read macros in Scheme

Tags:

scheme

In Common Lisp, there are "read macros" that can be used to parse syntax to Lisp code.

  1. Is it possible/how to implement it in pure Scheme?
  2. Which and how implementations support this?
like image 474
ThePiercingPrince Avatar asked Nov 15 '13 06:11

ThePiercingPrince


People also ask

Does Scheme have macros?

Scheme supports three types of macro. When it comes to understanding what's going on, the easiest of these three types of macro is Lisp's original type of macro, known as defmacro in Common Lisp, EMACS Lisp, and SCM.

What is a macro in racket?

A macro is a syntactic form with an associated transformer that expands the original form into existing forms. To put it another way, a macro is an extension to the Racket compiler. Most of the syntactic forms of racket/base and racket are actually macros that expand into a small set of core constructs.


1 Answers

The only semi-portable way that comes to mind is via SRFI-10's limited form of reader macros. These have to start with a sharp sign and a comma, and then a list expression which starts with a symbol which identifies the read-time constructor.

CHICKEN also provides support for using arbitrary characters as reader macro hooks.

like image 98
sjamaan Avatar answered Oct 14 '22 10:10

sjamaan