-
Notifications
You must be signed in to change notification settings - Fork 1
/
scm-semantics.scm
96 lines (92 loc) · 4.7 KB
/
scm-semantics.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
;; (c) 2020 Michael Neidel
;;
;; Permission is hereby granted, free of charge, to any person obtaining a copy
;; of this software and associated documentation files (the "Software"), to deal
;; in the Software without restriction, including without limitation the rights
;; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
;; copies of the Software, and to permit persons to whom the Software is
;; furnished to do so, subject to the following conditions:
;;
;; The above copyright notice and this permission notice shall be included in
;; all copies or substantial portions of the Software.
;;
;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
;; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
;; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
;; SOFTWARE.
;;; Destructure Chicken Scheme source code into an s-expression representing the
;;; source on a semantic level.
;;;
;;; scm-semantics recognizes the following elements:
;;;
;;; keyword | meaning
;;; ---------------------------|---------------------------------------
;;; `source` | Scheme source code
;;; `+- class-definition` | coops class type definition
;;; ` +- comment` |
;;; ` +- name` |
;;; ` +- superclasses` |
;;; ` +- slots` |
;;; ` +- slot` |
;;; ` +- name` |
;;; ` +- initform` |
;;; ` +- accessor` |
;;; ` +- getter` |
;;; ` +- setter` |
;;; `+- class-method` | specialization of a generic procedure
;;; ` +- name` |
;;; ` +- classes` |
;;; ` +- qualifier` |
;;; ` +- signature` |
;;; `+- comment` | stand-alone comment block
;;; `+- constant-definition` | constant definition using `define-constant`
;;; ` +- comment` | comment describing the constant
;;; ` +- name` | name of the constant
;;; ` +- type-annotation` | type annotation of the constant
;;; ` +- value` | value of the constant
;;; `+- module-declaration` | Chicken module declaration
;;; ` +- body` | body of the module
;;; ` +- exported-symbols` | list of symbols exported by the module
;;; ` +- name` | module identifier
;;; `+- procedure-definition` | procedure definition using `define`
;;; ` +- body` | body of the procedure definition
;;; ` +- comment` | comment describing the procedure
;;; ` +- name` | name of the procedure
;;; ` +- signature` | signature of the procedure
;;; ` +- type-annotation` | type annotation of the procedure
;;; `+- record-definition` | record type definition (chicken/srfi-9/defstruct)
;;; ` +- comment` | comment describing the record type
;;; ` +- constructor` | record constructor procedure
;;; ` +- fields` | all fields of the record type
;;; ` +- field` | a single field of the record type
;;; ` +- comment` | comment describing the field
;;; ` +- default` | default field value (defstruct types only)
;;; ` +- getter` | getter of the field
;;; ` +- name` | field name
;;; ` +- setter` | setter of the field
;;; ` +- type-annotation` | type annotation of the field
;;; ` +- name` | name of the record type
;;; ` +- predicate` | record type predicate
;;; ` +- implementation` | record implementation
;;; `+- syntax-definition` | syntax (macro) definition
;;; ` +- comment` | comment describing the macro
;;; ` +- name` | name of the macro
;;; ` +- signature` | macro signature
;;; ` +- transformer` | transformer expression of the macro
;;; `+- variable-definition` | generic variable definition using `define`
;;; ` +- comment` | comment describing the variable
;;; ` +- name` | name of the variable
;;; ` +- type-annotation` | type annotation of the variable
;;; ` +- value` | value of the variable
;;;
;;; Only comments starting with a specific prefix are considered. By default,
;;; that prefix is `;;;`.
(module scm-semantics
*
(import scheme (chicken base) (chicken module)
(only scm-semantics-impl parse-semantics))
(reexport (only scm-semantics-impl parse-semantics))
) ;; end module scm-semantics