Goal: Introduce the project, motivate and explain the approach, outline possibilities.
Wednesday, 23rd of March 2016 – Relevant discussion
<kenanb> KMP mentions he wrote a lisp program to parse the tex sources to generate Hyperspec automatically, so it must be possible, but surely hard, considering it is Tex <kenanb> I only wish they released the program <kenanb> I also remember seeing a program that translate the draft into emacs info files.
Sunday, 28th of May 2017 – First mention of Well-Specified Common Lisp
<beach> Speaking of which, I decided to write down my ideas for improved Common Lisp standard a bit more concretely: https://github.com/robert-strandh/Well-Specified-Common-Lisp
Wednesday, 28th of April 2021 – Start of this project
<scymtym> beach: is there more information on this idea of reformatting the dpANS sources anywhere? like previous attempts, necessary steps, expected outcome, etc?
\begincom{lambda}\ftype{Symbol} \issue{DECLS-AND-DOC} \label Syntax:: \Defspec lambda {lambda-list {\DeclsAndDoc} \starparam{form}} \label Arguments:: \param{lambda-list}---an \term{ordinary lambda list}. \param{declaration}---a \misc{declare} \term{expression}; \noeval. \param{documentation}---a \term{string}; \noeval. \param{form}---a \term{form}. \label Description:: A \term{lambda expression} is a \term{list} that can be used in place of a \term{function name} in certain contexts to denote a \term{function} by directly describing its behavior rather than indirectly by referring to the name of an \term{established} \term{function}. \param{Documentation} is attached to the denoted \param{function} (if any is actually created) as a \term{documentation string}. \label See Also:: \specref{function}, \funref{documentation}, {\secref\LambdaExpressions}, {\secref\LambdaForms}, {\secref\DocVsDecls} \label Notes:: The \term{lambda form} \code ((lambda \param{lambda-list} . \param{body}) . \param{arguments}) \endcode is semantically equivalent to the \term{function form} \code (funcall #'(lambda \param{lambda-list} . \param{body}) . \param{arguments}) \endcode \endissue{DECLS-AND-DOC} \endcom%{lambda}
Status: Proposal FIRST passed, Nov 89 X3J13 Forum: Cleanup Issue: &ENVIRONMENT-BINDING-ORDER References: CLtL p. 145-146, 63 Issue DEFMACRO-LAMBDA-LIST Category: CLARIFICATION Edit History: V1, 24 Oct 1989, Sandra Loosemore V3, 02 Nov 1989, Sandra Loosemore (comments from Moon) Problem Description: Issue DEFMACRO-LAMBDA-LIST states that &ENVIRONMENT can appear once anywhere at top level of a macro lambda list, but doesn't say anything about the order in which the &ENVIRONMENT variable is bound relative to the other lambda-list variables. … Proposal (&ENVIRONMENT-BINDING-ORDER:FIRST): Clarify that the &ENVIRONMENT parameter is bound along with &WHOLE before any of other variables in the lambda list, regardless of where &ENVIRONMENT appears in the lambda list. Rationale: This proposal provides a convenient explanation for the special treatment of &WHOLE and &ENVIRONMENT at top-level in a DEFMACRO-style lambda list. … Proposal (&ENVIRONMENT-BINDING-ORDER:LEFT-TO-RIGHT): Clarify that the all lambda variables in a DEFMACRO-style lambda list are bound left-to-right, including the &WHOLE and &ENVIRONMENT parameters. Rationale: This is more consistent with the order in which variables in ordinary lambda lists are bound. Current Practice: Lucid CL, Utah CL, and KCL implement proposal FIRST. CMU CL implements proposal LEFT-TO-RIGHT. …
Why did this happen?
\beginsubsubsection{Abstract Classifications of Streams} [hundreds of lines] \beginsubsubsubsection{Interactive Streams} \DefineSection{InteractiveStreams} [hundreds of lines] \endsubsubsubsection%{Interactive Streams} \beginsubsubsubsection{File Streams} [hundreds of lines] \endsubsubsubsection%{File Streams} \endsubsubsection%{Abstract Classifications of Streams}
(flet ((test (x) (let ((*print-pretty* t)) (print x) (format t "~%~S " x) (terpri) (princ x) (princ " ") (format t "~%~A " x)))) (test '#'(lambda () (list "a" #\b 'c #'d)))) \OUT #'(LAMBDA () \OUT (LIST "a" #\b 'C #'D)) \OUT #'(LAMBDA () \OUT (LIST "a" #\b 'C #'D))
\funref{most-positive-fixnum}
)\macref{destruct})
prog2
error)Meta-meta-model based on architecture.builder-protocol system
Built around nodes, initargs and relations:
(defrule argument (environment) (and (has-syntax? '#\# :argument environment) (bounds (start end) (seq (+ (<<- level #\#)) (<- number (:transform (guard digit digit-char-p) (digit-char-p digit)))))) (bp:node* (:argument :level (length level) :number number :bounds (cons start end)))) (defrule editor-note (environment) (bounds (start end) (seq/ws "\\editornote{" (<- editor (person)) #\: (<- content (balanced-content)) #\})) (bp:node* (:editor-note :editor editor :content content :bounds (cons start end))))
\DefsetfMulti {bit-array {\rest} subscripts} {new-bit} {\entry{bit} \entry{sbit}}
(let* ((input (format nil "\\DefsetfMulti~@ {bit-array {\\rest} subscripts}~@ {new-bit}~@ {\\entry{bit} \\entry{sbit}}")) (tree (dpans-conversion.parser::parse-tex-string 'list input "file.tex"))) (render-to-file tree "images/bit-array-document-object-tree.png"))
(defun expand (builder environment macro arguments) (typecase macro (function ; built-in macro (apply macro builder environment arguments)) (t ; user-level macro defined in TeX source (let* ((body (bp:node-relation* '(:body . *) macro)) (first (first (bp:node-relation* '(:argument . *) macro))) (level (if (null first-parameter) 1 (getf (bp:node-initargs* first-parameter) :level)))) (mapcar (lambda (element) (substitute-arguments builder element level arguments)) body)))))
(defparameter *env* (dpans-conversion::make-environment)) (defparameter *tree* (let ((input (format nil "\\def\\foo#1#2{\\it#1 and #2}~ \\foo{a}{b}"))) (dpans-conversion.parser::parse-tex-string 'list (coerce input '(simple-array character 1)) "file.tex"))) (render-to-file *tree* "images/macro-example-original.png")
(let ((expanded (dpans-conversion.transform::apply-transform (make-instance 'dpans-conversion.transform::expand-macros :builder 'list :environment *env*) *tree*))) (render-to-file expanded "images/macro-example-expanded.png"))
→
(defrule issue (filename process) (bounds (start end) (seq (? (<- preamble (preamble))) (+ (or (<- name (section-name)) (<- related-issues (section-related-issues)) (<- required-issues (section-required-issues)) (<- forum (section-forum)) (<- category (section-category)) (<<- sections (section)) (seq (whitespace*) #\Newline))))) (unless (find :proposal sections :key #'bp:node-kind*) (cerror "Use the issue anyway" "No Proposal")) (bp:node* (:issue :filename filename :process process :bounds (cons start end)) (1 (:name . 1) name) (* (:required-issue . *) required-issues) (* (:related-issue . *) related-issues) (1 (:forum . 1) forum) (1 (:category . 1) category) (* (:section . *) (nreverse sections)) (bp:? (:preamble . bp:?) preamble)))
Uses previously mentioned (meta-)meta-model:
Transformation | HTML | CLIM browser |
---|---|---|
Drop unused nodes | ✅ | ✅ |
Parse listings | ✅ | ✅ |
Expand macros | ✅ | ✅ |
Massage {tables,math,comp.,issues} | ✅ | ✅ |
Attach labels | ✅ | ✅ |
Add dictionary sections | ✅ | ❌ |
Split into files | ✅ | ❌ |
{symbol,table,issue,note} index | ✅ | ❌ |
Note output files | ✅ | ❌ |
Note parents | ❌ | ✅ |
Build references | ✅ | ✅ |
Render | HTML | CLIM |
\def\alfa{$\alpha$} \code (alpha-char-p #\\a) \EV \term{true} (alpha-char-p #\\5) \EV \term{false} (alpha-char-p #\\Newline) \EV \term{false} ;; This next example presupposes ;; an implementation in which ;; #\\\alfa is a defined character. (alpha-char-p #\\\alfa) \EV \term{implementation-dependent} \endcode
↓
(define-render (:part) (let ((name (transform::node-name node))) (flet ((do-it () (cxml:with-element "dl" (cxml:with-element "dt" (class-attribute "label") (recurse '(:name . 1))) (cxml:with-element "dd" (recurse '(:element . *)))))) (maybe-removable-text transform name #'do-it :removable '("Note" "Example" "Pronunciation" "See Also")))))
\term{evaluates}
, \term{evaluated}
must refer to the "evaluate" entry\term{satisfying the test}
,
\term{satisfies the test}
must refer to "satisfy
the test" entryHow did Kent Pitman do it for the Common Lisp HyperSpec back in the day?
For DEFSTRUCT-COPIER, the above archive has the versions
V1, 10 May 90, Sandra Loosemore V2, 13 May 90, Sandra Loosemore (update discussion) V3, 29 May 90, Sandra Loosemore (more comments)
but not 07-Jul-93, Version 1 by Pitman
If you have access to more recent versions of the X3J13 issues, please contact us!
Part II will cover
#dpans
on the libera IRC network for dpANS parsing
and conversion#commonlisp
on the libera IRC network for discussions about
new issues, specification changes and Well-Specified Common Lisp