Skip to content

Commit

Permalink
Merge pull request #480 from yamacir-kit/syntactic-environment
Browse files Browse the repository at this point in the history
Syntactic environment
  • Loading branch information
yamacir-kit authored Aug 28, 2024
2 parents ad67df5 + f20d106 commit bb24f9d
Show file tree
Hide file tree
Showing 54 changed files with 2,302 additions and 1,728 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
basis/src
build
document
include/meevax/unicode
src/kernel/version.cpp
13 changes: 13 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/include/${PROJECT_NAME}/unicode/upcase.hp

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

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure/Doxyfile ${CMAKE_CURRENT_SOURCE_DIR}/document/Doxyfile)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure/README.md ${CMAKE_CURRENT_SOURCE_DIR}/README.md)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure/version.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/kernel/version.cpp)

Expand Down Expand Up @@ -208,6 +209,18 @@ foreach(EACH IN LISTS ${PROJECT_NAME}_TEST_CPP)
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_${FILENAME})
endforeach()

file(GLOB ${PROJECT_NAME}_TEST_SH ${CMAKE_CURRENT_SOURCE_DIR}/test/*.sh)

foreach(EACH IN LISTS ${PROJECT_NAME}_TEST_SH)
get_filename_component(FILENAME ${EACH} NAME_WE)
add_test(
NAME ${FILENAME}
COMMAND ${${PROJECT_NAME}_MEMORY_CHECK_COMMAND}
${${PROJECT_NAME}_MEMORY_CHECK_OPTIONS}
${EACH}
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/meevax)
endforeach()

# ---- Additional Targets ------------------------------------------------------

execute_process(COMMAND nproc OUTPUT_VARIABLE ${PROJECT_NAME}_NPROC)
Expand Down
95 changes: 64 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,23 @@ Latest release is [here](https://github.com/yamacir-kit/meevax/releases).

### Features

- Traditional SECD machine [[Landin 1964](#Landin-1964)].
- Low-level hygienic macro system, known as *syntactic closures* [[Bawden and
Rees 1988](#Bawden-and-Rees-1988); [Hanson 1991](#Hanson-1991)] and *explicit
renaming* [[Clinger 1991](#Clinger-1991)]. For these, the well-known macro
transformers `sc-macro-transformer`, `rsc-macro-transformer` and
`er-macro-transformer` from the library [`(meevax
macro-transformer)`](./basis/meevax.ss) are provided. Note that these are
non-Scheme standards.
- C++ friendly precise garbage collection [[Kempf 2001a](#Kempf-2001a); [Kempf
2001b](#Kempf-2001b)]
- Traditional SECD machine [[2](#Landin-1964)].
- Low-level hygienic macro system, known as *syntactic closures*
[[4](#Bawden-and-Rees-1988), [6](#Hanson-1991)] and *explicit renaming*
[[5](#Clinger-1991)]. For these, the well-known macro transformers
`sc-macro-transformer`, `rsc-macro-transformer` and `er-macro-transformer`
from the library [`(meevax macro-transformer)`](./basis/meevax.ss) are
provided. Note that these are non-Scheme standards.
- C++ friendly precise garbage collection [[10](#Kempf-2001a),
[11](#Kempf-2001b)]

### Standards

Meevax can be used as an interpreter that supports the Scheme standard specified by the following report:

- Revised<sup>4</sup> Report on the Algorithmic Language Scheme (R4RS) [[Clinger and Rees 1991a](#Clinger-and-Rees-1991a)]
- Revised<sup>5</sup> Report on the Algorithmic Language Scheme (R5RS) [[Kelsey, Clinger and Rees 1998](#Kelsey-Clinger-and-Rees-1998)]
- Revised<sup>7</sup> Report on the Algorithmic Language Scheme (R7RS) [[Shinn, Cowan and Gleckler 2013](#Shinn-Cowan-and-Gleckler-2013)]
- Revised<sup>4</sup> Report on the Algorithmic Language Scheme (R4RS) [[5](#Clinger-and-Rees-1991a)]
- Revised<sup>5</sup> Report on the Algorithmic Language Scheme (R5RS) [[9](#Kelsey-Clinger-and-Rees-1998)]
- Revised<sup>7</sup> Report on the Algorithmic Language Scheme (R7RS) [[13](#Shinn-Cowan-and-Gleckler-2013)]

Procedures for each standard are provided by the following R7RS-style libraries:

Expand Down Expand Up @@ -91,7 +90,7 @@ Procedures for each standard are provided by the following R7RS-style libraries:
cmake -B build -DCMAKE_BUILD_TYPE=Release
cd build
make package
sudo apt install build/meevax_0.5.164_amd64.deb
sudo apt install build/meevax_0.5.221_amd64.deb
```

or
Expand Down Expand Up @@ -123,9 +122,9 @@ sudo rm -rf /usr/local/share/meevax

| Target Name | Description
|-------------|-------------
| `all` | Build shared-library `libmeevax.0.5.164.so` and executable `meevax`
| `all` | Build shared-library `libmeevax.0.5.221.so` and executable `meevax`
| `test` | Test executable `meevax`
| `package` | Generate debian package `meevax_0.5.164_amd64.deb`
| `package` | Generate debian package `meevax_0.5.221_amd64.deb`
| `install` | Copy files into `/usr/local` directly

## Usage
Expand All @@ -149,18 +148,52 @@ See [LICENSE](./LICENSE).

## References

| Authors | Year | Title | Journal Title / Publisher | Pages |
|--------------------------------------------------------------------------------------------------------|:----:|-------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|:--------------:|
| <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 |
| <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 |
| <a id="Henderson-1980" ></a> Peter Henderson | 1980 | [Functional Programming: Application and Implementation](https://archive.org/details/functionalprogra0000hend/mode/2up) | Prentice Hall | |
| <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 |
| <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 |
| <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 |
| <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 |
| <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 |
| <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 |
| <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 | |
| <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 | |
| <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 |
| <a id="Shinn-Cowan-and-Gleckler-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/ | |
[<a name="McCarthy-1960">1</a>] John McCarthy.
<a href="https://dl.acm.org/doi/10.1145/367177.367199">Recursive functions of symbolic expressions and their computation by machine, Part I</a>.
<em><a href="https://dl.acm.org/toc/cacm/1960/3/4">Communications of the ACM</a></em>, 3(4):184--195, 1960.

[<a name="Landin-1964">2</a>] Peter J. Landin.
<a href="https://academic.oup.com/comjnl/article/6/4/308/375725">The Mechanical Evaluation of Expressions</a>.
<em><a href="https://academic.oup.com/comjnl/issue/6/4">The Computor Journal</a></em>, 6(4):308--320, 1964.

[<a name="Henderson-1980">3</a>] Peter Henderson.
<em><a href="https://archive.org/details/functionalprogra0000hend/mode/2up">Functional Programming: Application and Implementation</a></em>.
Prentice Hall, 1980.

[<a name="Bawden-and-Rees-1988">4</a>] Alan Bawden and Jonathan Rees.
<a href="https://dl.acm.org/doi/10.1145/62678.62687">Syntactic Closures</a>.
In <em><a href="https://dl.acm.org/doi/proceedings/10.1145/62678">LFP '88: Proceedings of the 1988 ACM Conference on LISP and Functional Programming</a></em>, pages 86--95, 1988.

[<a name="Clinger-and-Rees-1991a">5</a>] William Clinger and Jonathan Rees (Editors).
<a href="https://dl.acm.org/doi/10.1145/382130.382133">Revised<sup>4</sup> Report on the Algorithmic Language Scheme</a>.
<em><a href="https://dl.acm.org/toc/sigplan-lisppointers/1991/IV/3">ACM SIGPLAN LISP Pointers</a></em>, IV(3):1--55, 1991.

[<a name="Hanson-1991">6</a>] Chris Hanson.
<a href="https://dl.acm.org/doi/10.1145/1317265.1317267">A Syntactic Closures Macro Facility</a>.
<em><a href="https://dl.acm.org/toc/sigplan-lisppointers/1991/IV/4">ACM SIGPLAN LISP Pointers</a></em>, IV(4):9--16, 1991.

[<a name="Clinger-1991">7</a>] William Clinger.
<a href="https://dl.acm.org/doi/10.1145/1317265.1317269">Hygienic Macros Through Explicit Renaming</a>.
<em><a href="https://dl.acm.org/toc/sigplan-lisppointers/1991/IV/4">ACM SIGPLAN LISP Pointers</a></em>, IV(4):25--28, 1991.

[<a name="Clinger-and-Rees-1991b">8</a>] William Clinger and Jonathan Rees.
<a href="https://dl.acm.org/doi/10.1145/99583.99607">Macros That Work</a>.
In <em><a href="https://dl.acm.org/doi/proceedings/10.1145/99583">POPL '91: Proceedings of the 18th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages</a></em>, pages 155--162, 1991.

[<a name="Kelsey-Clinger-and-Rees-1998">9</a>] Rechard Kelsey, William Clinger, and Jonathan Rees (Editors).
<a href="https://dl.acm.org/doi/10.1145/290229.290234">Revised<sup>5</sup> Report on the Algorithmic Language Scheme</a>.
<em><a href="https://dl.acm.org/toc/sigplan/1998/33/9">ACM SIGPLAN Notices</a></em>, 33(9):26--76, 1998.

[<a name="Kempf-2001a">10</a>] William E. Kempf.
<a href="https://www.codeproject.com/Articles/912/A-garbage-collection-framework-for-C">A garbage collection framework for C++</a>, 2001.

[<a name="Kempf-2001b">11</a>] William E. Kempf.
<a href="https://www.codeproject.com/Articles/938/A-garbage-collection-framework-for-C-Part-II">A garbage collection framework for C++ - Part II</a>, 2001.

[<a name="Adams-and-Dybvig-2008">12</a>] Michael D. Adams and R. Kent Dybvig.
<a href="https://dl.acm.org/doi/10.1145/1411204.1411230">Efficient Nondestructive Equality Checking for Trees and Graphs</a>.
In <em> <a href="https://dl.acm.org/doi/proceedings/10.1145/1411204">ICFP '08: Proceedings of the 13th ACM SIGPLAN International Conference on Functional Programming</a></em>, pages 179--188, 2008.

[<a name="Shinn-Cowan-and-Gleckler-2013">13</a>] Alex Shinn, John Cowan, and Arthur A. Gleckler (Editors).
<a href="https://standards.scheme.org/official/r7rs.pdf">Revised<sup>7</sup> Report on the Algorithmic Language Scheme</a>.
Technical report, http://www.scheme-reports.org/, 2013.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.164
0.5.221
4 changes: 2 additions & 2 deletions basis/srfi-0.ss
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(define-library (srfi 0)
(import (only (meevax core) implementation-dependent))
(export (rename implementation-dependent cond-expand)))
(import (only (meevax core) conditional-expand))
(export (rename conditional-expand cond-expand)))
47 changes: 47 additions & 0 deletions configure/Doxyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
PROJECT_NAME = ${PROJECT_NAME}
PROJECT_NUMBER = ${CURRENT_VERSION}
OUTPUT_DIRECTORY = ${CMAKE_CURRENT_SOURCE_DIR}/document
CREATE_SUBDIRS = YES
INLINE_INHERITED_MEMB = YES
STRIP_FROM_PATH = ${CMAKE_CURRENT_SOURCE_DIR}/basis/include \
${CMAKE_CURRENT_SOURCE_DIR}/basis/src \
${CMAKE_CURRENT_SOURCE_DIR}/include \
${CMAKE_CURRENT_SOURCE_DIR}/src
TAB_SIZE = 2
BUILTIN_STL_SUPPORT = YES
INLINE_SIMPLE_STRUCTS = YES

EXTRACT_ALL = YES
EXTRACT_STATIC = YES
SORT_MEMBERS_CTORS_1ST = YES
SORT_BY_SCOPE_NAME = YES

QUIET = YES
INPUT = ${CMAKE_CURRENT_SOURCE_DIR}/README.md \
${CMAKE_CURRENT_SOURCE_DIR}/basis/include \
${CMAKE_CURRENT_SOURCE_DIR}/basis/src \
${CMAKE_CURRENT_SOURCE_DIR}/include \
${CMAKE_CURRENT_SOURCE_DIR}/src
RECURSIVE = YES
EXCLUDE = ${CMAKE_CURRENT_SOURCE_DIR}/include/meevax/unicode
USE_MDFILE_AS_MAINPAGE = ${CMAKE_CURRENT_SOURCE_DIR}/README.md

REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES

HTML_TIMESTAMP = YES
HTML_DYNAMIC_SECTIONS = YES
HTML_INDEX_NUM_ENTRIES = 1000
SEARCHENGINE = NO

GENERATE_LATEX = NO

MACRO_EXPANSION = YES
PREDEFINED = NDEBUG

UML_LOOK = YES
UML_LIMIT_NUM_FIELDS = 100
TEMPLATE_RELATIONS = YES
CALL_GRAPH = YES
INTERACTIVE_SVG = YES
DOT_GRAPH_MAX_NODES = 1000
Loading

0 comments on commit bb24f9d

Please sign in to comment.