The monkeylib-text-languages Reference Manual

This is the monkeylib-text-languages Reference Manual, version 1.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 07:06:28 2024 GMT+0.

Table of Contents


1 Systems

The main system appears first, followed by any subsystem dependency.


1.1 monkeylib-text-languages

Compiler for text-based languages.

Author

Peter Seibel <>

License

BSD

Version

1.0

Dependencies
  • monkeylib-text-output (system).
  • com.gigamonkeys.macro-utilities (system).
Source

monkeylib-text-languages.asd.

Child Components

2 Files

Files are sorted by type and then listed depth-first from the systems components trees.


2.1 Lisp


2.1.1 monkeylib-text-languages/monkeylib-text-languages.asd

Source

monkeylib-text-languages.asd.

Parent Component

monkeylib-text-languages (system).

ASDF Systems

monkeylib-text-languages.


2.1.2 monkeylib-text-languages/packages.lisp

Source

monkeylib-text-languages.asd.

Parent Component

monkeylib-text-languages (system).

Packages

monkeylib-text-languages.


2.1.3 monkeylib-text-languages/language.lisp

Dependency

packages.lisp (file).

Source

monkeylib-text-languages.asd.

Parent Component

monkeylib-text-languages (system).

Public Interface
Internals

2.1.4 monkeylib-text-languages/file-compiler.lisp

Dependencies
Source

monkeylib-text-languages.asd.

Parent Component

monkeylib-text-languages (system).

Internals

3 Packages

Packages are listed by definition order.


3.1 monkeylib-text-languages

Source

packages.lisp.

Use List
  • com.gigamonkeys.macro-utilities.
  • common-lisp.
  • monkeylib-text-output.
Public Interface
Internals

4 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


4.1 Public Interface


4.1.1 Macros

Macro: define-language (name parent)
Package

monkeylib-text-languages.

Source

language.lisp.

Macro: define-language-macro (name)
Package

monkeylib-text-languages.

Source

language.lisp.

Macro: define-macro (name macro-symbol (&rest parameters) &body body)
Package

monkeylib-text-languages.

Source

language.lisp.

Macro: define-special-operator (name special-operator-symbol (language processor &rest other-parameters) &body body)
Package

monkeylib-text-languages.

Source

language.lisp.


4.1.2 Ordinary functions

Function: case-preserving-readtable ()
Package

monkeylib-text-languages.

Source

language.lisp.

Function: compile-special-op-body (processor body)

Code generator generator.

Package

monkeylib-text-languages.

Source

language.lisp.

Function: emit (language body environment)
Package

monkeylib-text-languages.

Source

language.lisp.

Function: emit-for-language (language-class sexp)
Package

monkeylib-text-languages.

Source

language.lisp.

Function: fully-expand-macro-form (language form environment)
Package

monkeylib-text-languages.

Source

language.lisp.

Function: parse-&environment (parameters)

Parse out an optional &environment parameter and return the parameter list without it and the name of the parameter.

Package

monkeylib-text-languages.

Source

language.lisp.

Function: process (language processor form environment)

Process FORM as an expression in LANGUAGE. The ENVIRONMENT is provided to special forms and to the basic evaluation rule implemented by a method on PROCESS-SEXP.

Package

monkeylib-text-languages.

Source

language.lisp.

Function: self-evaluating-p (form)
Package

monkeylib-text-languages.

Source

language.lisp.

Function: sexp->ops (language body environment)
Package

monkeylib-text-languages.

Source

language.lisp.


4.1.3 Generic functions

Generic Function: comment (language text)

Return text as a comment.

Package

monkeylib-text-languages.

Source

language.lisp.

Generic Function: embeddable-value-form (language form environment)

Return a form that will evaluate to a string that can be embedded in the generated output.

Package

monkeylib-text-languages.

Source

language.lisp.

Methods
Method: embeddable-value-form (language form environment)

Reasonable default. Languages that need to escape certain characters will need their own specializations of this method.

Generic Function: expand-macro-form (language form environment)
Package

monkeylib-text-languages.

Source

language.lisp.

Methods
Method: expand-macro-form (language form environment)
Generic Function: identifier (language form)

Extract a symbol that identifies the form.

Package

monkeylib-text-languages.

Source

language.lisp.

Methods
Method: identifier (language form)
Method: identifier (language (form cons))

Reasonable default for languages with a Lispy syntax.

Generic Reader: input-package (object)
Generic Writer: (setf input-package) (object)
Package

monkeylib-text-languages.

Methods
Reader Method: input-package ((language language))
Writer Method: (setf input-package) ((language language))

package we should use to read the input file.

Source

language.lisp.

Target Slot

input-package.

Generic Reader: input-readtable (object)
Generic Writer: (setf input-readtable) (object)
Package

monkeylib-text-languages.

Methods
Reader Method: input-readtable ((language language))
Writer Method: (setf input-readtable) ((language language))

readtable we should use to read the input files in this language.

Source

language.lisp.

Target Slot

input-readtable.

Generic Function: macro-form-p (language form)

Is the given form a macro form in language. The
default method probably does what you want–it extracts the form’s identifier and looks for a macro-symbol on its plist.

Package

monkeylib-text-languages.

Source

language.lisp.

Methods
Method: macro-form-p (language (form cons))
Method: macro-form-p (language form)
Generic Reader: macro-symbols (object)
Generic Writer: (setf macro-symbols) (object)
Package

monkeylib-text-languages.

Methods
Reader Method: macro-symbols ((language language))
Writer Method: (setf macro-symbols) ((language language))

symbols added to a symbol’s plist to indicate it
has been defined as a macro in LANGUAGE. These will typically be pushed onto this list in an :after method on initialize-instance so they are ordered the same as the class precedence list.

Source

language.lisp.

Target Slot

macro-symbols.

Generic Reader: output-file-type (object)
Generic Writer: (setf output-file-type) (object)
Package

monkeylib-text-languages.

Methods
Reader Method: output-file-type ((language language))
Writer Method: (setf output-file-type) ((language language))

file suffix for generated files.

Source

language.lisp.

Target Slot

output-file-type.

Generic Function: process-sexp (language processor form environment)

The basic evaluation rule for the language,
after special operators and macro forms have been handled.

Package

monkeylib-text-languages.

Source

language.lisp.

Generic Function: process-special-form (language processor form environment)
Package

monkeylib-text-languages.

Source

language.lisp.

Methods
Method: process-special-form (language processor form environment)
Generic Function: sexp-form-p (language form)

Is the given form a meaningful non-special, non-macro form in language.

Package

monkeylib-text-languages.

Source

language.lisp.

Methods
Method: sexp-form-p (language form)

Suitable default for languages in which all forms that are not special or macros have some meaning. Languages that allow embedded code and embedded values will need their own specialization of this method.

Generic Function: special-form-p (language form)

Is the given form a special form in language. The
default method probably does what you want–it extracts the form’s identifier and looks for a special-operator-symbol on its plist.

Package

monkeylib-text-languages.

Source

language.lisp.

Methods
Method: special-form-p (language (form cons))
Method: special-form-p (language form)
Generic Reader: special-operator-symbols (object)
Generic Writer: (setf special-operator-symbols) (object)
Package

monkeylib-text-languages.

Methods
Reader Method: special-operator-symbols ((language language))
Writer Method: (setf special-operator-symbols) ((language language))

symbols added to a symbol’s plist to indicate it
has been defined as a macro in LANGUAGE. These will typically be pushed onto this list in an :after method on initialize-instance so they are ordered the same as the class precedence list.

Source

language.lisp.

Target Slot

special-operator-symbols.

Generic Function: top-level-environment (language)

Environment for evaluating top-level forms.

Package

monkeylib-text-languages.

Source

language.lisp.


4.1.4 Standalone methods

Method: print-object ((c foo-syntax-error) stream)
Source

language.lisp.


4.1.5 Conditions

Condition: foo-syntax-error
Package

monkeylib-text-languages.

Source

language.lisp.

Direct superclasses

condition.

Direct methods
Direct slots
Slot: form
Initargs

:form

Readers

form-of.

Writers

(setf form-of).

Slot: cause
Initform

(quote nil)

Initargs

:cause

Readers

cause-of.

Writers

(setf cause-of).


4.1.6 Classes

Class: language
Package

monkeylib-text-languages.

Source

language.lisp.

Direct methods
Direct slots
Slot: special-operator-symbols

symbols added to a symbol’s plist to indicate it
has been defined as a macro in LANGUAGE. These will typically be pushed onto this list in an :after method on initialize-instance so they are ordered the same as the class precedence list.

Readers

special-operator-symbols.

Writers

(setf special-operator-symbols).

Slot: macro-symbols

symbols added to a symbol’s plist to indicate it
has been defined as a macro in LANGUAGE. These will typically be pushed onto this list in an :after method on initialize-instance so they are ordered the same as the class precedence list.

Readers

macro-symbols.

Writers

(setf macro-symbols).

Slot: input-readtable

readtable we should use to read the input files in this language.

Initargs

:input-readtable

Readers

input-readtable.

Writers

(setf input-readtable).

Slot: input-package

package we should use to read the input file.

Initargs

:input-package

Readers

input-package.

Writers

(setf input-package).

Slot: output-file-type

file suffix for generated files.

Initargs

:output-file-type

Readers

output-file-type.

Writers

(setf output-file-type).


4.2 Internals


4.2.1 Ordinary functions

Function: find-in-plist (identifier symbols)

Find the first value on an identifier’s plist given a list of symbols. This is used to implement inheritance of special forms

Package

monkeylib-text-languages.

Source

language.lisp.

Function: generate (language input &optional output)

Input can be a sexp, a string, or a stream. Output can be an output stream, a string, a pathname, NIL, or T. The latter two are interpreted as they are by CL:FORMAT, NIL generates a string, T send to *STANDARD-OUTPUT*.

Package

monkeylib-text-languages.

Source

file-compiler.lisp.

Function: normalize-macro-lambda-list (parameters namevar)

Create a destructuring-lambda list that can parse a whole macro form, including an optional &whole parameter and a parameter to eat up the macro name.

Package

monkeylib-text-languages.

Source

language.lisp.


4.2.2 Generic functions

Generic Reader: cause-of (condition)
Generic Writer: (setf cause-of) (condition)
Package

monkeylib-text-languages.

Methods
Reader Method: cause-of ((condition foo-syntax-error))
Writer Method: (setf cause-of) ((condition foo-syntax-error))
Source

language.lisp.

Target Slot

cause.

Generic Function: finish (stream)

Close the output stream or return the result as necessary.

Package

monkeylib-text-languages.

Source

file-compiler.lisp.

Methods
Method: finish ((stream string-stream))
Method: finish ((stream file-stream))
Method: finish ((stream stream))
Generic Reader: form-of (condition)
Generic Writer: (setf form-of) (condition)
Package

monkeylib-text-languages.

Methods
Reader Method: form-of ((condition foo-syntax-error))
Writer Method: (setf form-of) ((condition foo-syntax-error))
Source

language.lisp.

Target Slot

form.

Generic Function: input-to-sexp (language input)

Convert input to a sexp.

Package

monkeylib-text-languages.

Source

file-compiler.lisp.

Methods
Method: input-to-sexp (language (input cons))
Method: input-to-sexp (language (input string))
Method: input-to-sexp (language (input pathname))
Method: input-to-sexp (language (input stream))
Generic Function: output-to-stream (output)

Convert output to a stream.

Package

monkeylib-text-languages.

Source

file-compiler.lisp.

Methods
Method: output-to-stream ((output stream))
Method: output-to-stream ((output string))
Method: output-to-stream ((output pathname))
Method: output-to-stream ((output (eql nil)))
Method: output-to-stream ((output (eql t)))

Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   (  
C   D   E   F   G   I   M   N   O   P   S   T  
Index Entry  Section

(
(setf cause-of): Private generic functions
(setf cause-of): Private generic functions
(setf form-of): Private generic functions
(setf form-of): Private generic functions
(setf input-package): Public generic functions
(setf input-package): Public generic functions
(setf input-readtable): Public generic functions
(setf input-readtable): Public generic functions
(setf macro-symbols): Public generic functions
(setf macro-symbols): Public generic functions
(setf output-file-type): Public generic functions
(setf output-file-type): Public generic functions
(setf special-operator-symbols): Public generic functions
(setf special-operator-symbols): Public generic functions

C
case-preserving-readtable: Public ordinary functions
cause-of: Private generic functions
cause-of: Private generic functions
comment: Public generic functions
compile-special-op-body: Public ordinary functions

D
define-language: Public macros
define-language-macro: Public macros
define-macro: Public macros
define-special-operator: Public macros

E
embeddable-value-form: Public generic functions
embeddable-value-form: Public generic functions
emit: Public ordinary functions
emit-for-language: Public ordinary functions
expand-macro-form: Public generic functions
expand-macro-form: Public generic functions

F
find-in-plist: Private ordinary functions
finish: Private generic functions
finish: Private generic functions
finish: Private generic functions
finish: Private generic functions
form-of: Private generic functions
form-of: Private generic functions
fully-expand-macro-form: Public ordinary functions
Function, case-preserving-readtable: Public ordinary functions
Function, compile-special-op-body: Public ordinary functions
Function, emit: Public ordinary functions
Function, emit-for-language: Public ordinary functions
Function, find-in-plist: Private ordinary functions
Function, fully-expand-macro-form: Public ordinary functions
Function, generate: Private ordinary functions
Function, normalize-macro-lambda-list: Private ordinary functions
Function, parse-&environment: Public ordinary functions
Function, process: Public ordinary functions
Function, self-evaluating-p: Public ordinary functions
Function, sexp->ops: Public ordinary functions

G
generate: Private ordinary functions
Generic Function, (setf cause-of): Private generic functions
Generic Function, (setf form-of): Private generic functions
Generic Function, (setf input-package): Public generic functions
Generic Function, (setf input-readtable): Public generic functions
Generic Function, (setf macro-symbols): Public generic functions
Generic Function, (setf output-file-type): Public generic functions
Generic Function, (setf special-operator-symbols): Public generic functions
Generic Function, cause-of: Private generic functions
Generic Function, comment: Public generic functions
Generic Function, embeddable-value-form: Public generic functions
Generic Function, expand-macro-form: Public generic functions
Generic Function, finish: Private generic functions
Generic Function, form-of: Private generic functions
Generic Function, identifier: Public generic functions
Generic Function, input-package: Public generic functions
Generic Function, input-readtable: Public generic functions
Generic Function, input-to-sexp: Private generic functions
Generic Function, macro-form-p: Public generic functions
Generic Function, macro-symbols: Public generic functions
Generic Function, output-file-type: Public generic functions
Generic Function, output-to-stream: Private generic functions
Generic Function, process-sexp: Public generic functions
Generic Function, process-special-form: Public generic functions
Generic Function, sexp-form-p: Public generic functions
Generic Function, special-form-p: Public generic functions
Generic Function, special-operator-symbols: Public generic functions
Generic Function, top-level-environment: Public generic functions

I
identifier: Public generic functions
identifier: Public generic functions
identifier: Public generic functions
input-package: Public generic functions
input-package: Public generic functions
input-readtable: Public generic functions
input-readtable: Public generic functions
input-to-sexp: Private generic functions
input-to-sexp: Private generic functions
input-to-sexp: Private generic functions
input-to-sexp: Private generic functions
input-to-sexp: Private generic functions

M
Macro, define-language: Public macros
Macro, define-language-macro: Public macros
Macro, define-macro: Public macros
Macro, define-special-operator: Public macros
macro-form-p: Public generic functions
macro-form-p: Public generic functions
macro-form-p: Public generic functions
macro-symbols: Public generic functions
macro-symbols: Public generic functions
Method, (setf cause-of): Private generic functions
Method, (setf form-of): Private generic functions
Method, (setf input-package): Public generic functions
Method, (setf input-readtable): Public generic functions
Method, (setf macro-symbols): Public generic functions
Method, (setf output-file-type): Public generic functions
Method, (setf special-operator-symbols): Public generic functions
Method, cause-of: Private generic functions
Method, embeddable-value-form: Public generic functions
Method, expand-macro-form: Public generic functions
Method, finish: Private generic functions
Method, finish: Private generic functions
Method, finish: Private generic functions
Method, form-of: Private generic functions
Method, identifier: Public generic functions
Method, identifier: Public generic functions
Method, input-package: Public generic functions
Method, input-readtable: Public generic functions
Method, input-to-sexp: Private generic functions
Method, input-to-sexp: Private generic functions
Method, input-to-sexp: Private generic functions
Method, input-to-sexp: Private generic functions
Method, macro-form-p: Public generic functions
Method, macro-form-p: Public generic functions
Method, macro-symbols: Public generic functions
Method, output-file-type: Public generic functions
Method, output-to-stream: Private generic functions
Method, output-to-stream: Private generic functions
Method, output-to-stream: Private generic functions
Method, output-to-stream: Private generic functions
Method, output-to-stream: Private generic functions
Method, print-object: Public standalone methods
Method, process-special-form: Public generic functions
Method, sexp-form-p: Public generic functions
Method, special-form-p: Public generic functions
Method, special-form-p: Public generic functions
Method, special-operator-symbols: Public generic functions

N
normalize-macro-lambda-list: Private ordinary functions

O
output-file-type: Public generic functions
output-file-type: Public generic functions
output-to-stream: Private generic functions
output-to-stream: Private generic functions
output-to-stream: Private generic functions
output-to-stream: Private generic functions
output-to-stream: Private generic functions
output-to-stream: Private generic functions

P
parse-&environment: Public ordinary functions
print-object: Public standalone methods
process: Public ordinary functions
process-sexp: Public generic functions
process-special-form: Public generic functions
process-special-form: Public generic functions

S
self-evaluating-p: Public ordinary functions
sexp->ops: Public ordinary functions
sexp-form-p: Public generic functions
sexp-form-p: Public generic functions
special-form-p: Public generic functions
special-form-p: Public generic functions
special-form-p: Public generic functions
special-operator-symbols: Public generic functions
special-operator-symbols: Public generic functions

T
top-level-environment: Public generic functions