Skip to content

Commit b3fb4b5

Browse files
authored
Merge pull request #432 from yamacir-kit/values
Values
2 parents c2932cd + 7a84903 commit b3fb4b5

29 files changed

+865
-569
lines changed

.github/workflows/build.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
matrix:
1515
compiler: [ g++, clang++ ]
1616
configuration: [ Debug, Release ]
17-
system: [ ubuntu-18.04, ubuntu-20.04, ubuntu-22.04 ]
17+
system: [ ubuntu-20.04, ubuntu-22.04 ]
1818
steps:
1919
- uses: actions/checkout@v3
2020
- run: ./script/setup.sh --all

CMakeLists.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10.2) # Ubuntu 18.04 LTS Default
1+
cmake_minimum_required(VERSION 3.16.3) # Ubuntu 20.04 LTS default
22

33
execute_process(
44
COMMAND cat ${CMAKE_CURRENT_SOURCE_DIR}/VERSION
@@ -19,7 +19,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
1919
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
2020
set(CMAKE_VERBOSE_MAKEFILE OFF)
2121

22-
string(CONCAT UNSTABLE_OPTIMIZATION_OPTIONS # JOIN available if VERSION > 3.12
22+
string(JOIN " " UNSTABLE_OPTIMIZATION_OPTIONS
2323
# "-flto " # This optimization causes a SEGV when compiling with Clang 10.
2424
# "-fmerge-all-constants " # This optimization is very effective in reducing binary size, but non-standard to the C++ standard.
2525
# "-march=native " # This optimization causes "Illegal instruction" error (is Valgrind's bug) on CI.
@@ -187,6 +187,7 @@ check(r5rs)
187187
check(r7rs)
188188
check(sicp-1)
189189
check(srfi-8)
190+
check(tail-call)
190191
check(transformer)
191192
check(with-exception-handler)
192193

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Latest release is [here](https://github.com/yamacir-kit/meevax/releases).
3232

3333
### Features
3434

35-
- Architecture - TR-SECD virtual machine.
35+
- Architecture - SECD machine.
3636
- Modern C++ compatible dynamic typing - Meevax provides RTTI-based language runtime library.
3737

3838
### Standards
@@ -64,8 +64,8 @@ Subset of R7RS-small.
6464

6565
### Software
6666

67-
- [GCC](https://gcc.gnu.org/) (>= 7.5.0) or [Clang](https://clang.llvm.org/) (>= 9.0.0)
68-
- [CMake](https://cmake.org/) (>= 3.10.2)
67+
- [GCC](https://gcc.gnu.org/) (>= 9.4.0) or [Clang](https://clang.llvm.org/) (>= 11.0.0)
68+
- [CMake](https://cmake.org/) (>= 3.16.3)
6969
- [GNU Make](http://savannah.gnu.org/projects/make)
7070
- [GNU Binutils](https://www.gnu.org/software/binutils/)
7171
- [GNU Multiple Precision Arithmetic Library (GMP)](https://gmplib.org/)
@@ -105,9 +105,9 @@ sudo rm -rf /usr/local/share/meevax
105105

106106
| Target Name | Description
107107
|:-------------------|:--
108-
| `all` (default) | Build shared-library `libmeevax.0.4.439.so` and executable `meevax`.
108+
| `all` (default) | Build shared-library `libmeevax.0.4.465.so` and executable `meevax`.
109109
| `test` | Test executable `meevax`.
110-
| `package` | Generate debian package `meevax_0.4.439_amd64.deb`.
110+
| `package` | Generate debian package `meevax_0.4.465_amd64.deb`.
111111
| `install` | Copy files into `/usr/local` __(1)__.
112112
| `install.deb` | `all` + `package` + `sudo apt install <meevax>.deb`
113113
| `safe-install.deb` | `all` + `test` + `package` + `sudo apt install <meevax>.deb`
@@ -122,7 +122,7 @@ __(1)__ Meevax installed by `make install` cannot be uninstalled by the system's
122122
## Usage
123123

124124
```
125-
Meevax Lisp System, version 0.4.439
125+
Meevax Lisp System, version 0.4.465
126126
127127
Usage: meevax [OPTION...] [FILE...]
128128

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.4.439
1+
0.4.465

configure/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Latest release is [here](https://github.com/yamacir-kit/meevax/releases).
3232

3333
### Features
3434

35-
- Architecture - TR-SECD virtual machine.
35+
- Architecture - SECD machine.
3636
- Modern C++ compatible dynamic typing - Meevax provides RTTI-based language runtime library.
3737

3838
### Standards
@@ -64,7 +64,7 @@ Subset of R7RS-small.
6464

6565
### Software
6666

67-
- [GCC](https://gcc.gnu.org/) (>= 7.5.0) or [Clang](https://clang.llvm.org/) (>= 9.0.0)
67+
- [GCC](https://gcc.gnu.org/) (>= 9.4.0) or [Clang](https://clang.llvm.org/) (>= 11.0.0)
6868
- [CMake](https://cmake.org/) (>= ${CMAKE_MINIMUM_REQUIRED_VERSION})
6969
- [GNU Make](http://savannah.gnu.org/projects/make)
7070
- [GNU Binutils](https://www.gnu.org/software/binutils/)

example/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10.2) # Ubuntu 18.04 LTS Default
1+
cmake_minimum_required(VERSION 3.16.3) # Ubuntu 20.04 LTS default
22

33
project(example VERSION 0.0.0 LANGUAGES CXX)
44

include/meevax/kernel/disassemble.hpp

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
Copyright 2018-2022 Tatsuya Yamasaki.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
#ifndef INCLUDED_MEEVAX_KERNEL_DISASSEMBLE_HPP
18+
#define INCLUDED_MEEVAX_KERNEL_DISASSEMBLE_HPP
19+
20+
#include <meevax/kernel/pair.hpp>
21+
22+
namespace meevax
23+
{
24+
inline namespace kernel
25+
{
26+
auto disassemble(std::ostream &, object const&, std::size_t = 1) -> void;
27+
} // namespace kernel
28+
} // namespace meevax
29+
30+
#endif // INCLUDED_MEEVAX_KERNEL_DISASSEMBLE_HPP

include/meevax/kernel/heterogeneous.hpp

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include <meevax/functional/compose.hpp>
2222
#include <meevax/iostream/escape_sequence.hpp>
2323
#include <meevax/iostream/lexical_cast.hpp>
24-
#include <meevax/kernel/mnemonic.hpp>
2524
#include <meevax/kernel/profiler.hpp>
2625
#include <meevax/kernel/type_index.hpp>
2726
#include <meevax/memory/gc_pointer.hpp>

include/meevax/kernel/identity.hpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ inline namespace kernel
3535

3636
virtual auto load(object const&) const -> object const& = 0;
3737

38-
virtual auto make_load_mnemonic() const -> object = 0;
38+
virtual auto make_load_instruction() const -> object = 0;
3939

40-
virtual auto make_store_mnemonic() const -> object = 0;
40+
virtual auto make_store_instruction() const -> object = 0;
4141

4242
virtual auto symbol() const -> object const&;
4343
};
@@ -56,9 +56,9 @@ inline namespace kernel
5656

5757
auto load(object const& = unit) const -> object const& override;
5858

59-
auto make_load_mnemonic() const -> object override;
59+
auto make_load_instruction() const -> object override;
6060

61-
auto make_store_mnemonic() const -> object override;
61+
auto make_store_instruction() const -> object override;
6262
};
6363

6464
struct keyword : public absolute
@@ -76,9 +76,9 @@ inline namespace kernel
7676

7777
auto load(object const&) const -> object const& override;
7878

79-
auto make_load_mnemonic() const -> object override;
79+
auto make_load_instruction() const -> object override;
8080

81-
auto make_store_mnemonic() const -> object override;
81+
auto make_store_instruction() const -> object override;
8282
};
8383

8484
auto operator ==(relative const&, relative const&) -> bool;
@@ -89,9 +89,9 @@ inline namespace kernel
8989

9090
auto load(object const& e) const -> object const& override;
9191

92-
auto make_load_mnemonic() const -> object override;
92+
auto make_load_instruction() const -> object override;
9393

94-
auto make_store_mnemonic() const -> object override;
94+
auto make_store_instruction() const -> object override;
9595
};
9696
} // namespace kernel
9797
} // namespace meevax

include/meevax/kernel/instruction.hpp

+35-2
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,46 @@
1717
#ifndef INCLUDED_MEEVAX_KERNEL_INSTRUCTION_HPP
1818
#define INCLUDED_MEEVAX_KERNEL_INSTRUCTION_HPP
1919

20-
#include <meevax/kernel/pair.hpp>
20+
#include <iostream>
2121

2222
namespace meevax
2323
{
2424
inline namespace kernel
2525
{
26-
auto disassemble(std::ostream &, object const&, std::size_t = 1) -> void;
26+
enum class instruction : std::uint8_t
27+
{
28+
call, // a.k.a APP
29+
cons, //
30+
define, //
31+
define_syntax, //
32+
drop, //
33+
dummy, // a.k.a DUM
34+
join, //
35+
let_syntax, //
36+
letrec, // a.k.a RAP
37+
letrec_syntax, //
38+
load_absolute, // a.k.a LDG
39+
load_auxiliary, //
40+
load_closure, // a.k.a LDF
41+
load_constant, // a.k.a LDC
42+
load_continuation, //
43+
load_relative, // a.k.a LDL
44+
load_variadic, //
45+
return_, // a.k.a RTN
46+
select, // a.k.a SEL
47+
stop, //
48+
store_absolute, //
49+
store_auxiliary, //
50+
store_relative, //
51+
store_variadic, //
52+
tail_call, //
53+
tail_letrec, //
54+
tail_select, //
55+
};
56+
57+
auto operator <<(std::ostream &, instruction const&) -> std::ostream &;
58+
59+
auto instruction_length(instruction const&) -> std::size_t;
2760
} // namespace kernel
2861
} // namespace meevax
2962

include/meevax/kernel/list.hpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ inline namespace kernel
2828
template <auto N, typename T>
2929
auto get(T&& x) -> decltype(auto)
3030
{
31-
if constexpr (std::is_same_v<std::decay_t<decltype(x)>, iterator>)
31+
if constexpr (std::is_same_v<std::decay_t<T>, iterator>)
3232
{
3333
return std::get<N>(*x.get());
3434
}
35-
else if constexpr (std::is_same_v<std::decay_t<decltype(x)>, object>)
35+
else if constexpr (std::is_same_v<std::decay_t<T>, object>)
3636
{
3737
return x.template is_also<pair>() ? std::get<N>(*x) : unit;
3838
}
@@ -164,9 +164,9 @@ inline namespace kernel
164164
};
165165

166166
template <typename T, typename K, REQUIRES(std::is_integral<K>)>
167-
auto list_tail(T&& x, K const k) -> object const&
167+
auto tail(T&& x, K const k) -> object const&
168168
{
169-
return 0 < k ? list_tail(cdr(x), k - 1) : x;
169+
return 0 < k ? tail(cdr(x), k - 1) : x;
170170
}
171171

172172
auto take(object const&, std::size_t) -> object;

0 commit comments

Comments
 (0)