Commit | Line | Data |
---|---|---|
62f43d66 CY |
1 | ;;; scheme.by -- Scheme BNF language specification |
2 | ||
ab422c4d | 3 | ;; Copyright (C) 2001-2013 Free Software Foundation, Inc. |
62f43d66 CY |
4 | |
5 | ;; This file is part of GNU Emacs. | |
6 | ||
7 | ;; GNU Emacs is free software: you can redistribute it and/or modify | |
469d2149 | 8 | ;; it under the terms of the GNU General Public License as published by |
62f43d66 CY |
9 | ;; the Free Software Foundation, either version 3 of the License, or |
10 | ;; (at your option) any later version. | |
11 | ||
12 | ;; GNU Emacs is distributed in the hope that it will be useful, | |
469d2149 CY |
13 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | ;; GNU General Public License for more details. | |
62f43d66 | 16 | |
469d2149 | 17 | ;; You should have received a copy of the GNU General Public License |
62f43d66 | 18 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
469d2149 | 19 | |
f79fbbc7 | 20 | %package semantic-scm-by |
62a81506 | 21 | %provide semantic/bovine/scm-by |
469d2149 CY |
22 | |
23 | %languagemode scheme-mode | |
24 | %start scheme | |
25 | ||
26 | %token DEFINE "define" | |
27 | %token DEFINE-MODULE "define-module" | |
28 | %token LOAD "load" | |
29 | ||
30 | %put DEFINE summary "Function: (define symbol expression)" | |
31 | %put DEFINE-MODULE summary "Function: (define-module (name arg1 ...)) " | |
32 | %put LOAD summary "Function: (load \"filename\")" | |
33 | ||
34 | %token <open-paren> OPENPAREN "(" | |
35 | %token <close-paren> CLOSEPAREN ")" | |
36 | ||
37 | %% | |
38 | ||
39 | scheme : semantic-list | |
40 | (EXPAND $1 scheme-list) | |
41 | ; | |
42 | ||
43 | scheme-list : OPENPAREN scheme-in-list CLOSEPAREN | |
44 | ( ,$2 ) | |
45 | ; | |
46 | ||
47 | scheme-in-list: DEFINE symbol expression | |
48 | (VARIABLE-TAG $2 nil $3 ) | |
49 | | DEFINE name-args opt-doc sequence | |
50 | (FUNCTION-TAG (car ,$2) nil (cdr ,$2) ) | |
51 | | DEFINE-MODULE name-args | |
52 | (PACKAGE-TAG (nth (length $2) $2 ) nil) | |
53 | | LOAD string | |
54 | (INCLUDE-TAG (file-name-nondirectory (read $2)) (read $2) ) | |
55 | | symbol | |
56 | (CODE-TAG $1 nil) | |
57 | ; | |
58 | ||
59 | name-args: semantic-list | |
60 | (EXPAND $1 name-arg-expand) | |
61 | ; | |
62 | ||
63 | name-arg-expand : open-paren name-arg-expand | |
64 | ( ,$2 ) | |
65 | | symbol name-arg-expand | |
66 | ( ,(cons $1 ,$2) ) | |
67 | | ;; EMPTY | |
68 | ( ) | |
69 | ; | |
70 | ||
71 | opt-doc : string | |
72 | | ;; EMPTY | |
73 | ; | |
74 | ||
75 | sequence : expression sequence | |
76 | | expression | |
77 | ; | |
78 | ||
79 | expression : symbol | |
80 | | semantic-list | |
81 | | string | |
82 | | number | |
83 | ; | |
84 | ||
62f43d66 | 85 | ;;; scheme.by ends here |