Skip to content

Commit 0a079aa

Browse files
authored
Merge pull request #461 from yamacir-kit/release-candidate
Release candidate
2 parents 0818cfa + 4a196dc commit 0a079aa

Some content is hidden

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

61 files changed

+37662
-2481
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
build
2-
src/kernel/basis.cpp
2+
include/meevax/basis
3+
include/meevax/unicode
34
src/kernel/version.cpp

CMakeLists.txt

+44-27
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@ project(meevax DESCRIPTION "A programmable programming language"
1010
LANGUAGES CXX
1111
VERSION ${CURRENT_VERSION})
1212

13-
set(CMAKE_CXX_EXTENSIONS OFF)
14-
set(CMAKE_CXX_STANDARD 17)
15-
set(CMAKE_CXX_STANDARD_REQUIRED ON)
16-
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
17-
set(CMAKE_VERBOSE_MAKEFILE OFF)
13+
include(GNUInstallDirs)
1814

1915
string(JOIN " " AGGRESSIVE_OPTIMIZATION_OPTIONS
2016
# "-flto" # This optimization causes a SEGV when compiling with Clang 10.
@@ -23,17 +19,18 @@ string(JOIN " " AGGRESSIVE_OPTIMIZATION_OPTIONS
2319
# "-mtune=native"
2420
)
2521

26-
# NOTE: The `-gdwarf-4` option is set due to the following issues with Clang 14 and Valgrind versions below 3.20: https://bugzilla.mozilla.org/show_bug.cgi?id=1758782
27-
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wpedantic -pipe")
28-
set(CMAKE_CXX_FLAGS_DEBUG "-Og -gdwarf-4")
22+
set(CMAKE_CXX_EXTENSIONS OFF)
23+
set(CMAKE_CXX_FLAGS_DEBUG "-Og -gdwarf-4") # NOTE: The `-gdwarf-4` option is set due to the following issues with Clang 14 and Valgrind versions below 3.20: https://bugzilla.mozilla.org/show_bug.cgi?id=1758782
2924
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG")
30-
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -gdwarf-4 -DNDEBUG")
3125
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG ${AGGRESSIVE_OPTIMIZATION_OPTIONS}")
32-
33-
include(GNUInstallDirs)
34-
26+
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -gdwarf-4 -DNDEBUG")
27+
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wpedantic -pipe")
28+
set(CMAKE_CXX_STANDARD 17)
29+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
3530
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
31+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
3632
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR})
33+
set(CMAKE_VERBOSE_MAKEFILE OFF)
3734

3835
# ---- Configure ---------------------------------------------------------------
3936

@@ -47,27 +44,28 @@ else()
4744
set(${PROJECT_NAME}_BYTE_ORDER "little-endian")
4845
endif()
4946

50-
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/configure/help.txt ${PROJECT_NAME}_HELP_UNCONFIGURED)
47+
execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/script/unicode.sh --digit-value OUTPUT_VARIABLE ${PROJECT_NAME}_UNICODE_DIGIT_VALUE)
48+
execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/script/unicode.sh --downcase OUTPUT_VARIABLE ${PROJECT_NAME}_UNICODE_DOWNCASE)
49+
execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/script/unicode.sh --property OUTPUT_VARIABLE ${PROJECT_NAME}_UNICODE_PROPERTY)
50+
execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/script/unicode.sh --upcase OUTPUT_VARIABLE ${PROJECT_NAME}_UNICODE_UPCASE)
51+
52+
execute_process(
53+
COMMAND head -c -1 ${CMAKE_CURRENT_SOURCE_DIR}/configure/help.txt
54+
OUTPUT_VARIABLE ${PROJECT_NAME}_HELP)
5155

52-
string(CONFIGURE ${${PROJECT_NAME}_HELP_UNCONFIGURED} ${PROJECT_NAME}_HELP)
56+
file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/include/${PROJECT_NAME}/unicode/digit_value.hpp "${${PROJECT_NAME}_UNICODE_DIGIT_VALUE}")
57+
file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/include/${PROJECT_NAME}/unicode/downcase.hpp "${${PROJECT_NAME}_UNICODE_DOWNCASE}")
58+
file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/include/${PROJECT_NAME}/unicode/property.hpp "${${PROJECT_NAME}_UNICODE_PROPERTY}")
59+
file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/include/${PROJECT_NAME}/unicode/upcase.hpp "${${PROJECT_NAME}_UNICODE_UPCASE}")
5360

5461
string(TOLOWER ${CMAKE_SYSTEM_NAME} ${PROJECT_NAME}_SYSTEM_NAME)
5562

56-
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure/version.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/kernel/version.cpp)
5763
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure/README.md ${CMAKE_CURRENT_SOURCE_DIR}/README.md)
58-
59-
file(GLOB ${PROJECT_NAME}_BASIS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/basis/*.ss)
60-
61-
foreach(EACH IN LISTS ${PROJECT_NAME}_BASIS_SOURCES)
62-
get_filename_component(FILENAME ${EACH} NAME)
63-
file(READ ${EACH} ${PROJECT_NAME}_BASIS_${FILENAME})
64-
endforeach()
65-
66-
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure/basis.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/kernel/basis.cpp)
64+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure/version.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/kernel/version.cpp)
6765

6866
# ---- Target kernel -----------------------------------------------------------
6967

70-
add_library(kernel SHARED "")
68+
add_library(kernel SHARED)
7169

7270
add_library(${PROJECT_NAME}::kernel ALIAS kernel)
7371

@@ -87,9 +85,27 @@ set_target_properties(kernel PROPERTIES OUTPUT_NAME ${PROJECT_NAME} # Rename lib
8785
SOVERSION ${PROJECT_VERSION_MAJOR}
8886
LINK_FLAGS_RELEASE -s)
8987

88+
# ---- Target format -----------------------------------------------------------
89+
90+
add_executable(format)
91+
92+
target_sources(format PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/format.cpp)
93+
94+
target_link_libraries(format PRIVATE kernel)
95+
96+
# ---- Target basis ------------------------------------------------------------
97+
98+
add_custom_target(basis
99+
DEPENDS format
100+
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/basis/configure.cmake)
101+
90102
# ---- Target shell ------------------------------------------------------------
91103

92-
add_executable(shell ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp)
104+
add_executable(shell)
105+
106+
add_dependencies(shell basis)
107+
108+
target_sources(shell PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp)
93109

94110
target_link_libraries(shell PRIVATE kernel)
95111

@@ -169,6 +185,7 @@ file(GLOB ${PROJECT_NAME}_TEST_CPP ${CMAKE_CURRENT_SOURCE_DIR}/test/*.cpp)
169185
foreach(EACH IN LISTS ${PROJECT_NAME}_TEST_CPP)
170186
get_filename_component(FILENAME ${EACH} NAME_WE)
171187
add_executable(assert-${FILENAME} ${EACH})
188+
add_dependencies(assert-${FILENAME} basis)
172189
target_link_libraries(assert-${FILENAME} PRIVATE kernel)
173190
add_test(NAME assert-${FILENAME}
174191
COMMAND ${${PROJECT_NAME}_MEMORY_CHECK_COMMAND}
@@ -184,4 +201,4 @@ add_custom_target(develop
184201
COMMAND ${CMAKE_MAKE_PROGRAM} -j${${PROJECT_NAME}_NPROC}
185202
COMMAND ${CMAKE_MAKE_PROGRAM} test ARGS=-j${${PROJECT_NAME}_NPROC}
186203
COMMAND ${CMAKE_MAKE_PROGRAM} package
187-
COMMAND sudo apt install ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_${PROJECT_VERSION}_amd64.deb)
204+
COMMAND sudo dpkg -i ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_${PROJECT_VERSION}_amd64.deb)

README.md

+71-41
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,60 @@
1-
<p align="center">
2-
<img src="https://github.com/yamacir-kit/meevax/wiki/svg/meevax-logo.v9.png" alt="Meevax Lisp System"/>
3-
<br/>
4-
<img src="https://github.com/yamacir-kit/meevax/wiki/svg/description.png" alt="A programmable programming lanugage."/>
5-
</p>
6-
71
## Overview
82

93
> Programming languages should be designed not by piling feature on top of
104
> feature, but by removing the weaknesses and restrictions that make additional
115
> features appear necessary.
12-
> <div align="right">
13-
> Revised<sup>7</sup> Report on the Algorithmic Language Scheme [1]
14-
> </div>
15-
16-
Meevax is an implementation of Lisp-1 programming language, supporting subset
17-
of the [Scheme](http://www.scheme-reports.org/) (R7RS) and
18-
[SRFI](https://srfi.schemers.org/)s.
6+
> <div align="right">Revised<sup>7</sup> Report on the Algorithmic Language Scheme</div>
7+
8+
Meevax is an implementation of Lisp-1 programming language, supporting the
9+
latest [Scheme](http://www.scheme-reports.org/) language standard and some
10+
[SRFI](https://srfi.schemers.org/)s (SRFI; Scheme requests for implementation).
11+
This implementation is focused on integration with modern C++ and practicality:
12+
it not only works as an interpreter with support for the latest Scheme
13+
standard, but also provides a flexible Lisp-1 kernel as a C++ library. The
14+
library is installed as a CMake package for [easy
15+
linking](./example/CMakeLists.txt), and [any C++ classes can be used from
16+
Lisp-1 scripts](./example/example.ss) [via simple stubs](example/example.cpp).
17+
18+
However, as the major version indicates, this implementation is still in its
19+
infancy. Its performance is significantly inferior to that of common Scheme
20+
implementations. For example, in a microbenchmark comparison with Chibi Scheme,
21+
which can be embedded into C, Meevax takes more than 40x longer to compute than
22+
Chibi Scheme. We will try to improve the performance in future development, but
23+
we do not recommend using Meevax for anything other than toy programs, at least
24+
at this time.
1925

2026
### Releases
2127

2228
Latest release is [here](https://github.com/yamacir-kit/meevax/releases).
2329

2430
### Features
2531

26-
- Architecture - SECD machine.
27-
- Modern C++ compatible dynamic typing - Meevax provides RTTI-based language
28-
runtime library.
32+
- Traditional SECD machine [[Landin 1964](#Landin-1964)].
33+
- Low-level hygienic macro system, known as *syntactic closures* [[Bawden and
34+
Rees 1988](#Bawden-and-Rees-1988); [Hanson 1991](#Hanson-1991)] and *explicit
35+
renaming* [[Clinger 1991](#Clinger-1991)]. For these, the well-known macro
36+
transformers `sc-macro-transformer`, `rsc-macro-transformer`, and
37+
`er-macro-transformer` from the library [`(meevax
38+
macro-transformer)`](./basis/meevax.ss) are provided. Note that these are
39+
non-Scheme standards.
40+
- C++ friendly precise garbage collection [[Kempf 2001a](#Kempf-2001a); [Kempf
41+
2001b](#Kempf-2001b)]
2942

3043
### Standards
3144

32-
Subset of R7RS-small.
45+
Meevax can be used as an interpreter that supports the Scheme standard specified by the following report:
46+
47+
- Revised<sup>4</sup> Report on the Algorithmic Language Scheme (R4RS) [[Clinger and Rees 1991a](#Clinger-and-Rees-1991a)]
48+
- Revised<sup>5</sup> Report on the Algorithmic Language Scheme (R5RS) [[Kelsey, Clinger and Rees 1998](#Kelsey-Clinger-and-Rees-1998)]
49+
- Revised<sup>7</sup> Report on the Algorithmic Language Scheme (R7RS) [[Shinn, Cowan and Glecker 2013](#Shinn-Cowan-and-Glecker-2013)]
50+
51+
Procedures for each standard are provided by the following R7RS-style libraries:
52+
53+
| Language | Library name |
54+
|:--------:|--------------|
55+
| R4RS | [`(scheme r4rs)`](./basis/r4rs.ss)
56+
| R5RS | [`(scheme r5rs)`](./basis/r5rs.ss)
57+
| R7RS | [`(scheme base)`](./basis/r7rs.ss) [`(scheme case-lambda)`](./basis/r7rs.ss) [`(scheme char)`](./basis/r7rs.ss) [`(scheme complex)`](./basis/r7rs.ss) [`(scheme cxr)`](./basis/r7rs.ss) [`(scheme eval)`](./basis/r7rs.ss) [`(scheme file)`](./basis/r7rs.ss) [`(scheme inexact)`](./basis/r7rs.ss) [`(scheme lazy)`](./basis/r7rs.ss) [`(scheme load)`](./basis/r7rs.ss) [`(scheme process-context)`](./basis/r7rs.ss) [`(scheme read)`](./basis/r7rs.ss) [`(scheme repl)`](./basis/r7rs.ss) [`(scheme time)`](./basis/r7rs.ss) [`(scheme write)`](./basis/r7rs.ss) [`(scheme r5rs)`](./basis/r5rs.ss)
3358

3459
### SRFIs
3560

@@ -74,7 +99,7 @@ Subset of R7RS-small.
7499
cmake -B build -DCMAKE_BUILD_TYPE=Release
75100
cd build
76101
make package
77-
sudo apt install build/meevax_0.4.779_amd64.deb
102+
sudo apt install build/meevax_0.5.0_amd64.deb
78103
```
79104

80105
or
@@ -104,29 +129,26 @@ sudo rm -rf /usr/local/share/meevax
104129

105130
### CMake targets
106131

107-
| Target Name | Description
108-
|-----------------|-------------
109-
| `all` (default) | Build shared-library `libmeevax.0.4.779.so` and executable `meevax`
110-
| `test` | Test executable `meevax`
111-
| `package` | Generate debian package `meevax_0.4.779_amd64.deb`
112-
| `install` | Copy files into `/usr/local` directly
132+
| Target Name | Description
133+
|-------------|-------------
134+
| `all` | Build shared-library `libmeevax.0.5.0.so` and executable `meevax`
135+
| `test` | Test executable `meevax`
136+
| `package` | Generate debian package `meevax_0.5.0_amd64.deb`
137+
| `install` | Copy files into `/usr/local` directly
113138

114139
## Usage
115140

116141
```
117-
Meevax Lisp 0.4.779
118-
119142
Usage:
120-
meevax [option...] [file...]
143+
meevax [OPTION...] [FILE...]
121144
122145
Options:
123-
-e, --evaluate=<string> read and evaluate <string> on interaction-environment
124-
-h, --help display this help and exit
125-
-i, --interactive enter an interactive session
126-
-l, --load=<file> load <file> into interaction-environment
127-
-v, --version display version information and exit
128-
-w, --write=<string> same as `(write (read <string>))`
129-
146+
-e, --evaluate=STRING read and evaluate STRING on interaction-environment
147+
-h, --help display this help and exit
148+
-i, --interactive enter an interactive session
149+
-l, --load=FILE load FILE into interaction-environment
150+
-v, --version display version information and exit
151+
-w, --write=STRING same as `(write (read STRING))`
130152
```
131153

132154
## License
@@ -135,10 +157,18 @@ See [LICENSE](./LICENSE).
135157

136158
## References
137159

138-
- [1] A.shinn, J.Cowan, A. A. Greckler, editors, "[Revised<sup>7</sup> Report on the Algorithmic Language Scheme](https://bitbucket.org/cowan/r7rs/raw/tip/rnrs/r7rs.pdf)", Technical report, 2013.
139-
140-
### Resources
141-
142-
* [Chibi-Scheme](https://github.com/ashinn/chibi-scheme)
143-
* [SECDR-Scheme](http://www.maroon.dti.ne.jp/nagar17/mulasame/)
144-
* [TinyScheme](http://tinyscheme.sourceforge.net/)
160+
| Authors | Year | Title | Journal Title / Publisher | Pages |
161+
|-------------------------------------------------------------------------------------------------------|:----:|-------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|----------------|
162+
| <a id="McCarthy-1960" ></a> John McCarthy | 1960 | [Recursive functions of symbolic expressions and their computation by machine, Part I](https://dl.acm.org/doi/10.1145/367177.367199) | [Communications of the ACM, Volume 3, Issue 4](https://dl.acm.org/toc/cacm/1960/3/4) | 184&#x2011;195 |
163+
| <a id="Landin-1964" ></a> P. J. Landin | 1964 | [The Mechanical Evaluation of Expressions](https://academic.oup.com/comjnl/article/6/4/308/375725) | [The Computor Journal, Volume 6, Issue 4](https://academic.oup.com/comjnl/issue/6/4) | 308&#x2011;320 |
164+
| <a id="Henderson-1980" ></a> Peter Henderson | 1980 | [Functional Programming: Application and Implementation](https://archive.org/details/functionalprogra0000hend/mode/2up) | Prentice Hall | |
165+
| <a id="Bawden-and-Rees-1988" ></a> Alan Bawden and Jonathan Rees | 1988 | [Syntactic Closures](https://dl.acm.org/doi/10.1145/62678.62687) | [LFP '88: Proceedings of the 1988 ACM Conference on LISP and Functional Programming](https://dl.acm.org/doi/proceedings/10.1145/62678) | 86&#x2011;95 |
166+
| <a id="Clinger-and-Rees-1991a" ></a> William Clinger and Jonathan Rees (Editors) | 1991 | [Revised<sup>4</sup> Report on the Algorithmic Language Scheme](https://dl.acm.org/doi/10.1145/382130.382133) | [ACM SIGPLAN LISP Pointers, Volume IV, Issue 3](https://dl.acm.org/toc/sigplan-lisppointers/1991/IV/3) | 1&#x2011;55 |
167+
| <a id="Hanson-1991" ></a> Chris Hanson | 1991 | [A Syntactic Closures Macro Facility](https://dl.acm.org/doi/10.1145/1317265.1317267) | [ACM SIGPLAN LISP Pointers, Volume IV, Issue 4](https://dl.acm.org/toc/sigplan-lisppointers/1991/IV/4) | 9&#x2011;16 |
168+
| <a id="Clinger-1991" ></a> William Clinger | 1991 | [Hygienic Macros Through Explicit Renaming](https://dl.acm.org/doi/10.1145/1317265.1317269) | [ACM SIGPLAN LISP Pointers, Volume IV, Issue 4](https://dl.acm.org/toc/sigplan-lisppointers/1991/IV/4) | 25&#x2011;28 |
169+
| <a id="Clinger-and-Rees-1991b" ></a> William Clinger and Jonathan Rees | 1991 | [Macros That Work](https://dl.acm.org/doi/10.1145/99583.99607) | [POPL '91: Proceedings of the 18th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages](https://dl.acm.org/doi/proceedings/10.1145/99583) | 155&#x2011;162 |
170+
| <a id="Kelsey-Clinger-and-Rees-1998"></a> Rechard Kelsey, William Clinger and Jonathan Rees (Editors) | 1998 | [Revised<sup>5</sup> Report on the Algorithmic Language Scheme](https://dl.acm.org/doi/10.1145/290229.290234) | [ACM SIGPLAN Notices, Volume 33, Issue 9](https://dl.acm.org/toc/sigplan/1998/33/9) | 26&#x2011;76 |
171+
| <a id="Kempf-2001a" ></a> William E. Kempf | 2001 | [A garbage collection framework for C++](https://www.codeproject.com/Articles/912/A-garbage-collection-framework-for-C) | https://www.codeproject.com/Articles/912/A-garbage-collection-framework-for-C | |
172+
| <a id="Kempf-2001b" ></a> William E. Kempf | 2001 | [A garbage collection framework for C++ - Part II](https://www.codeproject.com/Articles/938/A-garbage-collection-framework-for-C-Part-II) | https://www.codeproject.com/Articles/938/A-garbage-collection-framework-for-C-Part-II | |
173+
| <a id="Adams-and-Dybvig-2008" ></a> Michael D. Adams and R. Kent Dybvig | 2008 | [Efficient Nondestructive Equality Checking for Trees and Graphs](https://dl.acm.org/doi/10.1145/1411204.1411230) | [ICFP '08: Proceedings of the 13th ACM SIGPLAN International Conference on Functional Programming](https://dl.acm.org/doi/proceedings/10.1145/1411204) | 179&#x2011;188 |
174+
| <a id="Shinn-Cowan-and-Glecker-2013"></a> Alex Shinn, John Cowan and Arthur A. Gleckler (Editors) | 2013 | [Revised<sup>7</sup> Report on the Algorithmic Language Scheme](https://standards.scheme.org/official/r7rs.pdf) | http://www.scheme-reports.org/ | |

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.4.779
1+
0.5.0

basis/configure.cmake

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
execute_process(
2+
COMMAND git rev-parse --show-toplevel
3+
COMMAND tr -d "\n"
4+
OUTPUT_VARIABLE TOPLEVEL)
5+
6+
file(GLOB ${PROJECT_NAME}_BASIS_SOURCES ${TOPLEVEL}/basis/*.ss)
7+
8+
foreach(EACH IN LISTS ${PROJECT_NAME}_BASIS_SOURCES)
9+
get_filename_component(FILENAME ${EACH} NAME)
10+
execute_process(
11+
COMMAND ${TOPLEVEL}/build/bin/format ${EACH}
12+
OUTPUT_VARIABLE CONFIGURED_${FILENAME})
13+
endforeach()
14+
15+
configure_file(
16+
${TOPLEVEL}/configure/basis.hpp
17+
${TOPLEVEL}/include/meevax/basis/scheme.hpp)

0 commit comments

Comments
 (0)