commit eb2aed91c1b1bc28d2fd7f15c8abd9d4d4d06217 parent c46d371e027a02c4a79db5d919af788cd9c156f3 Author: Georges Dupéron <georges.duperon@gmail.com> Date: Wed, 26 Apr 2017 02:24:00 +0200 Draft of the main graph generation macro. Diffstat:
| A | main-draft.hl.rkt | | | 80 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1 file changed, 80 insertions(+), 0 deletions(-)
diff --git a/main-draft.hl.rkt b/main-draft.hl.rkt @@ -0,0 +1,79 @@ +#lang aful/unhygienic hyper-literate type-expander/lang + +@chunk[<overview> + #;(define-syntax low-graph + (syntax-parser + [<signature> + <metadata> + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + <worklist> + <call-mapping-functions+placeholders> + <extract-placeholders> ;; and put them into the worklist + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + <inline-placeholders-within-node-boundaries> + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + <replace-indices-with-promises> + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + <equality-coalescing> ;; leave off as always-#f-unless-eq? + <invariants+auto-fill> + <inflexible-row-polymorphism> + <flexible-row-polymorphism> + <polymorphic-node-types-and-mappings> + ;<general-purpose-graph-algorithms> + ;<garbage-collection> + ])) + + (define-syntax low-graph + (syntax-parser + [<signature+metadata> + ;; Phase 1: call the mapping functions on the input data + (: phase-1 (∀ (nodes-pvar … mapping-pvar … …) + (→ (List (Listof mapping-arg-type) ddd) + (List (Listof mapping-result-type) ddd)))) + (define (phase-1 roots) + (work + roots + ((λ (mapping-arguments) + (define result + (let* ([mapping-name make-placeholder] + … + [arg convert-inflexible-to-flexible?] + … + [arg invariant-well-scopedness?] + …) + mapping-code)) + ;; returns placeholders + the result: + (extract-placeholders result)) + …) + (mapping-arg-type mapping-result-type) …)) + (begin + ;; Maybe this should be done last, when all phases are available? + (define (phase1-many-roots) 'TODO) + (define (phase1-single-root-for-mapping) 'TODO) + …) + ;; Phase 2: inline placeholders within node boundaries + (generate-worklist + nodes + #'(…?)) + (funcion which for a mapping-result → inserts nodes into worklist) … + (for the root mapping results + call the function to insert nodes and keep the surrounding part) + (for each mapping result + call the function to insert nodes) + ;; Phase 3: Replace indices with promises + ;; Phase 3a: have an empty set of invariant witnesses, and call the + ;; invariants for checking + ;; Phase 3b: have the full set of invariant witnesses. + ;; TODO phase 3: auto-fill. + ])) + + ; high-level graph API: + '(<metadata2> + <extending-existing-graph-types> + <invariants-for-extended-graph-types> + <auto-generate-mappings>)] + +Row polymorphism: make a generic struct->vector and vector->struct? + +@chunk[<*> + (void)] +\ No newline at end of file