{"size": 1452, "ext": "scrbl", "max_stars_repo_path": "pkgs/racket-doc/scribblings/guide/languages.scrbl", "max_stars_repo_name": "lkh01/racket", "max_stars_repo_stars_event_min_datetime": "2018-07-29T04:13:52.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-14T16:11:17.000Z", "max_issues_repo_path": "pkgs/racket-doc/scribblings/guide/languages.scrbl", "max_issues_repo_name": "lkh01/racket", "max_issues_repo_issues_event_min_datetime": "2017-08-25T20:26:37.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-26T17:48:40.000Z", "max_forks_repo_path": "pkgs/racket-doc/scribblings/guide/languages.scrbl", "max_forks_repo_name": "lkh01/racket", "max_forks_repo_forks_event_min_datetime": "2016-04-25T11:47:57.000Z", "max_forks_repo_forks_event_max_datetime": "2017-05-09T14:52:48.000Z"}
{"max_stars_count": 10, "max_issues_count": 15, "max_forks_count": 3, "avg_line_length": 38.2105263158, "max_line_length": 74, "alphanum_fraction": 0.7245179063}
#lang scribble/doc
@(require scribble/manual "guide-utils.rkt")

@title[#:tag "languages" #:style 'toc]{Creating Languages}

The @tech{macro} facilities defined in the preceding chapter let a
programmer define syntactic extensions to a language, but a macro is
limited in two ways:

@itemlist[

 @item{a macro cannot restrict the syntax available in its context or
       change the meaning of surrounding forms; and}

 @item{a macro can extend the syntax of a language only within the
       parameters of the language's lexical conventions, such as using
       parentheses to group the macro name with its subforms and using
       the core syntax of identifiers, keywords, and literals.}

]

@guideother{The distinction between the @tech{reader} and
@tech{expander} layer is introduced in @secref["lists-and-syntax"].}

That is, a macro can only extend a language, and it can do so only at
the @tech{expander} layer. Racket offers additional facilities for
defining a starting point of the @tech{expander} layer, for extending
the @tech{reader} layer, for defining the starting point of the
@tech{reader} layer, and for packaging a @tech{reader} and
@tech{expander} starting point into a conveniently named language.

@local-table-of-contents[]

@;------------------------------------------------------------------------
@include-section["module-languages.scrbl"]
@include-section["reader-extension.scrbl"]
@include-section["hash-languages.scrbl"]
