Skip to content

Commit ead6ece

Browse files
authored
Merge pull request #353 from yamacir-kit/let-syntax
Let syntax
2 parents ff9449a + 093f943 commit ead6ece

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+1403
-1300
lines changed

CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,16 @@ endmacro()
173173

174174
check(abandoned)
175175
check(chibi-basic)
176+
check(er-macro-transformer)
177+
check(internal-definition)
178+
check(let-syntax)
176179
check(low-level-macro-facility)
177180
check(numerical-operations)
178181
check(r4rs)
179182
check(r4rs-appendix)
180183
check(r7rs)
181184
check(sicp-1)
185+
check(srfi-8)
182186

183187
file(GLOB ${PROJECT_NAME}_TEST_CXX ${CMAKE_CURRENT_SOURCE_DIR}/test/*.cpp)
184188
foreach(FILEPATH IN LISTS ${PROJECT_NAME}_TEST_CXX)

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ sudo rm -rf /usr/local/share/meevax
100100

101101
| Target Name | Description
102102
|:-------------------|:--
103-
| `all` (default) | Build shared-library `libmeevax.0.3.629.so` and executable `meevax`.
103+
| `all` (default) | Build shared-library `libmeevax.0.3.682.so` and executable `meevax`.
104104
| `test` | Test executable `meevax`.
105-
| `package` | Generate debian package `meevax_0.3.629_amd64.deb`.
105+
| `package` | Generate debian package `meevax_0.3.682_amd64.deb`.
106106
| `install` | Copy files into `/usr/local` __(1)__.
107107
| `install.deb` | `all` + `package` + `sudo apt install <meevax>.deb`
108108
| `safe-install.deb` | `all` + `test` + `package` + `sudo apt install <meevax>.deb`
@@ -117,7 +117,7 @@ __(1)__ Meevax installed by `make install` cannot be uninstalled by the system's
117117
## Usage
118118

119119
```
120-
Meevax Lisp System, version 0.3.629
120+
Meevax Lisp System, version 0.3.682
121121
122122
Usage: meevax [OPTION...] [FILE...]
123123
@@ -126,7 +126,7 @@ Options:
126126
-d, --debug Display detailed informations for developers.
127127
-e, --evaluate=STRING Read and evaluate given STRING at configuration step.
128128
-h, --help Display this help text and exit.
129-
-i, --interactive Take over control of root syntactic-continuation.
129+
-i, --interactive Take over control of root environment.
130130
-l, --load=FILENAME Same as -e '(load FILENAME)'
131131
--prompt=STRING Same as -e '(set-prompt! STRING)'
132132
-t, --trace Display stacks of virtual machine for each steps.

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.3.629
1+
0.3.682

basis/srfi-149.ss

+2-8
Original file line numberDiff line numberDiff line change
@@ -267,13 +267,7 @@
267267
(list (rename 'strip-syntactic-closures) _expr))
268268
#f)))))))))
269269

270-
(define-syntax syntax-rules/aux
271-
(er-macro-transformer syntax-rules-transformer))
272-
273270
(define-syntax syntax-rules
274271
(er-macro-transformer
275-
(lambda (expr rename compare)
276-
(if (identifier? (cadr expr))
277-
(list (rename 'let) (list (list (cadr expr) #t))
278-
(cons (rename 'syntax-rules/aux) (cdr expr)))
279-
(syntax-rules-transformer expr rename compare)))))
272+
(lambda (form rename compare)
273+
(syntax-rules-transformer form rename compare))))

basis/srfi-78.ss

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
((report) 100)
6565
(else (error "unrecognized mode" mode)))))
6666

67-
(check-set-mode! 'report)
67+
(check-set-mode! 'report-failed)
6868

6969
; -- state --
7070

configure/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ Options:
126126
-d, --debug Display detailed informations for developers.
127127
-e, --evaluate=STRING Read and evaluate given STRING at configuration step.
128128
-h, --help Display this help text and exit.
129-
-i, --interactive Take over control of root syntactic-continuation.
129+
-i, --interactive Take over control of root environment.
130130
-l, --load=FILENAME Same as -e '(load FILENAME)'
131131
--prompt=STRING Same as -e '(set-prompt! STRING)'
132132
-t, --trace Display stacks of virtual machine for each steps.

configure/version.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -20,43 +20,43 @@ namespace meevax
2020
{
2121
inline namespace kernel
2222
{
23-
auto gmp_version() -> pair::const_reference
23+
auto gmp_version() -> const_reference
2424
{
2525
let static const version = make<symbol>(::gmp_version);
2626
return version;
2727
}
2828

29-
auto version() -> pair::const_reference
29+
auto version() -> const_reference
3030
{
3131
let static const version = make<symbol>("${PROJECT_VERSION}");
3232
return version;
3333
}
3434

35-
auto major_version() -> pair::const_reference
35+
auto major_version() -> const_reference
3636
{
3737
let static const version = make<exact_integer>("${PROJECT_VERSION_MAJOR}");
3838
return version;
3939
}
4040

41-
auto minor_version() -> pair::const_reference
41+
auto minor_version() -> const_reference
4242
{
4343
let static const version = make<exact_integer>("${PROJECT_VERSION_MINOR}");
4444
return version;
4545
}
4646

47-
auto patch_version() -> pair::const_reference
47+
auto patch_version() -> const_reference
4848
{
4949
let static const version = make<exact_integer>("${PROJECT_VERSION_PATCH}");
5050
return version;
5151
}
5252

53-
auto exact_version() -> pair::const_reference
53+
auto exact_version() -> const_reference
5454
{
5555
let static const version = make<symbol>("${${PROJECT_NAME}_VERSION_EXACT}");
5656
return version;
5757
}
5858

59-
auto features() -> pair::const_reference
59+
auto features() -> const_reference
6060
{
6161
let static const features = list(
6262
// STANDARD FEATURE IDENTIFIERS

example/example.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include <meevax/kernel/syntactic_continuation.hpp>
1+
#include <meevax/library/standard.hpp>
22

33
using namespace meevax; // NOTE: DIRTY HACK
44

include/meevax/kernel/boolean.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ inline namespace kernel
4444
let extern const t;
4545
let extern const f;
4646

47-
auto if_(pair::const_reference x) -> bool;
47+
auto if_(const_reference x) -> bool;
4848
} // namespace kernel
4949
} // namespace meevax
5050

include/meevax/kernel/configurator.hpp

+18-18
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ namespace meevax
2828
{
2929
inline namespace kernel
3030
{
31-
template <typename EnvironmentSpecifier>
31+
template <typename Environment>
3232
class configurator
3333
{
34-
friend EnvironmentSpecifier;
34+
friend Environment;
3535

36-
IMPORT(EnvironmentSpecifier, evaluate, NIL);
37-
IMPORT(EnvironmentSpecifier, load, NIL);
38-
IMPORT(EnvironmentSpecifier, print, const);
39-
IMPORT(EnvironmentSpecifier, read, NIL);
36+
IMPORT(Environment, evaluate, NIL);
37+
IMPORT(Environment, load, NIL);
38+
IMPORT(Environment, print, const);
39+
IMPORT(Environment, read, NIL);
4040

4141
template <typename Key>
4242
using dispatcher = std::unordered_map<Key, procedure::applicable>;
@@ -90,17 +90,17 @@ inline namespace kernel
9090

9191
, short_options_with_arguments
9292
{
93-
std::make_pair('e', [this](pair::const_reference x)
93+
std::make_pair('e', [this](const_reference x)
9494
{
9595
return print(evaluate(x)), unspecified;
9696
}),
9797

98-
std::make_pair('l', [this](pair::const_reference x)
98+
std::make_pair('l', [this](const_reference x)
9999
{
100100
return load(x);
101101
}),
102102

103-
std::make_pair('w', [this](pair::const_reference x)
103+
std::make_pair('w', [this](const_reference x)
104104
{
105105
return print(x), unspecified;
106106
}),
@@ -152,22 +152,22 @@ inline namespace kernel
152152

153153
, long_options_with_arguments
154154
{
155-
std::make_pair("evaluate", [this](pair::const_reference x)
155+
std::make_pair("evaluate", [this](const_reference x)
156156
{
157157
return print(evaluate(x)), unspecified;
158158
}),
159159

160-
std::make_pair("load", [this](pair::const_reference x)
160+
std::make_pair("load", [this](const_reference x)
161161
{
162162
return load(x);
163163
}),
164164

165-
std::make_pair("prompt", [this](pair::const_reference x)
165+
std::make_pair("prompt", [this](const_reference x)
166166
{
167167
return prompt = x;
168168
}),
169169

170-
std::make_pair("write", [this](pair::const_reference x)
170+
std::make_pair("write", [this](const_reference x)
171171
{
172172
return print(x), unspecified;
173173
}),
@@ -223,7 +223,7 @@ inline namespace kernel
223223
}
224224
else if (auto iter = short_options.find(*current_short_option); iter != std::end(short_options))
225225
{
226-
std::get<1>(*iter)(unit);
226+
cdr(*iter)(unit);
227227
}
228228
else
229229
{
@@ -237,11 +237,11 @@ inline namespace kernel
237237
{
238238
if (analysis.length(2)) // argument part
239239
{
240-
return std::get<1>(*iter)(read(analysis.str(3)));
240+
return cdr(*iter)(read(analysis.str(3)));
241241
}
242242
else if (++current_option != std::end(args) and not std::regex_match(*current_option, analysis, pattern))
243243
{
244-
return std::get<1>(*iter)(read(*current_option));
244+
return cdr(*iter)(read(*current_option));
245245
}
246246
else
247247
{
@@ -250,7 +250,7 @@ inline namespace kernel
250250
}
251251
else if (auto iter = long_options.find(current_long_option); iter != std::end(long_options))
252252
{
253-
return std::get<1>(*iter)(unit);
253+
return cdr(*iter)(unit);
254254
}
255255
else
256256
{
@@ -304,7 +304,7 @@ inline namespace kernel
304304
print(" -d, --debug Display detailed informations for developers.");
305305
print(" -e, --evaluate=STRING Read and evaluate given STRING at configuration step.");
306306
print(" -h, --help Display this help text and exit.");
307-
print(" -i, --interactive Take over control of root syntactic-continuation.");
307+
print(" -i, --interactive Take over control of root environment.");
308308
print(" -l, --load=FILENAME Same as -e '(load FILENAME)'");
309309
print(" --prompt=STRING Same as -e '(set-prompt! STRING)'");
310310
print(" -t, --trace Display stacks of virtual machine for each steps.");

include/meevax/kernel/constant.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace meevax
2323
{
2424
inline namespace kernel
2525
{
26-
extern std::unordered_map<std::string, pair::value_type> const constants;
26+
extern std::unordered_map<std::string, object> const constants;
2727
} // namespace kernel
2828
} // namespace meevax
2929

include/meevax/kernel/syntactic_context.hpp include/meevax/kernel/context.hpp

+22-12
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,35 @@
1414
limitations under the License.
1515
*/
1616

17-
#ifndef INCLUDED_MEEVAX_KERNEL_SYNTACTIC_CONTEXT_HPP
18-
#define INCLUDED_MEEVAX_KERNEL_SYNTACTIC_CONTEXT_HPP
19-
20-
#include <meevax/utility/enumeration.hpp>
17+
#ifndef INCLUDED_MEEVAX_KERNEL_CONTEXT_HPP
18+
#define INCLUDED_MEEVAX_KERNEL_CONTEXT_HPP
2119

2220
namespace meevax
2321
{
2422
inline namespace kernel
2523
{
26-
enum class syntactic_context
24+
struct context
2725
{
28-
none,
29-
30-
outermost = (1 << 0),
31-
tail = (1 << 1),
32-
33-
size,
26+
enum value_type
27+
{
28+
none,
29+
outermost = (1 << 0),
30+
tail = (1 << 1),
31+
size,
32+
}
33+
const value;
34+
35+
template <typename T>
36+
constexpr context(T const value) noexcept
37+
: value { static_cast<value_type>(value) }
38+
{}
39+
40+
constexpr operator value_type() const noexcept
41+
{
42+
return value;
43+
}
3444
};
3545
} // namespace kernel
3646
} // namespace meevax
3747

38-
#endif // INCLUDED_MEEVAX_KERNEL_SYNTACTIC_CONTEXT_HPP
48+
#endif // INCLUDED_MEEVAX_KERNEL_CONTEXT_HPP

include/meevax/kernel/de_bruijn_index.hpp

-43
This file was deleted.

0 commit comments

Comments
 (0)