<feed xmlns='http://www.w3.org/2005/Atom'>
<title>chromatopelma/csc/cps-test.csc, branch main</title>
<subtitle>Partial r7rs implementation with a focus on ease of implementation and a reusable library. Work in progress.</subtitle>
<id>https://code.roseh.moe/chromatopelma/atom/csc/cps-test.csc?h=main</id>
<link rel='self' href='https://code.roseh.moe/chromatopelma/atom/csc/cps-test.csc?h=main'/>
<link rel='alternate' type='text/html' href='https://code.roseh.moe/chromatopelma/'/>
<updated>2022-08-02T02:35:19Z</updated>
<entry>
<title>Modify the project structure.</title>
<updated>2022-08-02T02:35:19Z</updated>
<author>
<name>Rose Hogenson</name>
<email>rhogenson@posteo.net</email>
</author>
<published>2022-08-02T02:35:19Z</published>
<link rel='alternate' type='text/html' href='https://code.roseh.moe/chromatopelma/commit/?id=acc561366f3fe6ec0377103f52ef0f7e923711c9'/>
<id>urn:sha1:acc561366f3fe6ec0377103f52ef0f7e923711c9</id>
<content type='text'>
Now the lib directory contains what will eventually end up on the
user's /usr/lib/csc. When I write make install, it will copy all of
the .csc files from lib into the destination lib directory. This means I
can start working on the standard library in lib/scheme.
</content>
</entry>
<entry>
<title>Fix test failures.</title>
<updated>2022-07-30T00:29:13Z</updated>
<author>
<name>Rose Hogenson</name>
<email>rhogenson@posteo.net</email>
</author>
<published>2022-07-30T00:29:13Z</published>
<link rel='alternate' type='text/html' href='https://code.roseh.moe/chromatopelma/commit/?id=2fb60ef2d527b40c7f2e1b6408b2c357dd3b6932'/>
<id>urn:sha1:2fb60ef2d527b40c7f2e1b6408b2c357dd3b6932</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Fix a potential R7RS issue.</title>
<updated>2022-07-27T02:24:10Z</updated>
<author>
<name>Rose Hogenson</name>
<email>rhogenson@posteo.net</email>
</author>
<published>2022-07-27T02:24:10Z</published>
<link rel='alternate' type='text/html' href='https://code.roseh.moe/chromatopelma/commit/?id=becfaeb778a3c8ba241e2155b998d6b27dcfad0c'/>
<id>urn:sha1:becfaeb778a3c8ba241e2155b998d6b27dcfad0c</id>
<content type='text'>
I was using the load procedure to load a program, but by a strict
reading of R7RS, load can only handle expressions and definitions, not
imports. So instead I'm defining each test as a library, and using the
environment procedure to load them at runtime.
</content>
</entry>
<entry>
<title>Start codegen.</title>
<updated>2022-07-25T02:08:49Z</updated>
<author>
<name>Rose Hogenson</name>
<email>rhogenson@posteo.net</email>
</author>
<published>2022-07-25T02:08:49Z</published>
<link rel='alternate' type='text/html' href='https://code.roseh.moe/chromatopelma/commit/?id=745d6b8e16c7f276f479c18d97200e44d16aafc9'/>
<id>urn:sha1:745d6b8e16c7f276f479c18d97200e44d16aafc9</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Handle global variables.</title>
<updated>2022-07-22T19:02:25Z</updated>
<author>
<name>Rose Hogenson</name>
<email>rhogenson@posteo.net</email>
</author>
<published>2022-07-22T19:02:25Z</published>
<link rel='alternate' type='text/html' href='https://code.roseh.moe/chromatopelma/commit/?id=555519b85ded4a8fefd9c217e6acfb529ac67432'/>
<id>urn:sha1:555519b85ded4a8fefd9c217e6acfb529ac67432</id>
<content type='text'>
Global variables will be stored in an array which is kept in register 0.
The linker will later translate each library-ref into an integer, which
is used as an index into the globals table.

This design makes implementing eval quite straightforward, the eval
bytecode will accept a globals table and a bytevector of bytecode, save
the current set of registers, set register 0 to the new globals table,
and begin executing the given bytecode. When eval is finished, it will
restore the saved registers and return to the previous instruction
pointer. In this way, calling eval can create a call stack.

We could think about implementing function calls with eval, and it's
cool that it would work, but the CPS transformation mostly makes this
irrelevant. It's interesting to think about implementing an interpreter,
where a function call would simply eval the function's bytecode, and the
function call stack would be handled automatically.
</content>
</entry>
<entry>
<title>Perform argument conversion.</title>
<updated>2022-07-21T03:08:14Z</updated>
<author>
<name>Rose Hogenson</name>
<email>rhogenson@google.com</email>
</author>
<published>2022-07-20T22:39:23Z</published>
<link rel='alternate' type='text/html' href='https://code.roseh.moe/chromatopelma/commit/?id=e615308b928585013461482f879f536527c5acc2'/>
<id>urn:sha1:e615308b928585013461482f879f536527c5acc2</id>
<content type='text'>
The point of argument conversion is to validate on each function call
that the right number of arguments were passed, and to ensure that no
function has more than 1 argument. This second condition makes CPS
slightly simpler, and ensures that the arguments will all fit in locals.

We take the strategy of allocating a vector for each function call.
Ideally we would optimize away most of these allocations, but for now I
just want it to work.
</content>
</entry>
<entry>
<title>Add builtin operations to IR1.</title>
<updated>2022-07-13T05:55:48Z</updated>
<author>
<name>Rose Hogenson</name>
<email>rhogenson@google.com</email>
</author>
<published>2022-07-13T05:55:48Z</published>
<link rel='alternate' type='text/html' href='https://code.roseh.moe/chromatopelma/commit/?id=d18813441649665f42b524443c65d0b6bb4ac59a'/>
<id>urn:sha1:d18813441649665f42b524443c65d0b6bb4ac59a</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Add a diff library.</title>
<updated>2022-07-03T21:37:10Z</updated>
<author>
<name>Rose Hogenson</name>
<email>rhogenson@posteo.net</email>
</author>
<published>2022-07-03T21:37:10Z</published>
<link rel='alternate' type='text/html' href='https://code.roseh.moe/chromatopelma/commit/?id=bcb098e8eb18637b6999789585a38ff9168de9d5'/>
<id>urn:sha1:bcb098e8eb18637b6999789585a38ff9168de9d5</id>
<content type='text'>
I was hesitant to add a diff library, but it was surprisingly easy. A
straightforward application of dynamic programming.
</content>
</entry>
<entry>
<title>Write closure conversion.</title>
<updated>2022-07-03T06:04:28Z</updated>
<author>
<name>Rose Hogenson</name>
<email>rhogenson@posteo.net</email>
</author>
<published>2022-07-03T06:04:28Z</published>
<link rel='alternate' type='text/html' href='https://code.roseh.moe/chromatopelma/commit/?id=37e086d27d478246e72b8f5c1b75ed5d092495fa'/>
<id>urn:sha1:37e086d27d478246e72b8f5c1b75ed5d092495fa</id>
<content type='text'>
I desperately need a diffing library.
</content>
</entry>
<entry>
<title>Add update conversion.</title>
<updated>2022-07-01T15:29:57Z</updated>
<author>
<name>Rose Hogenson</name>
<email>rhogenson@posteo.net</email>
</author>
<published>2022-07-01T15:29:57Z</published>
<link rel='alternate' type='text/html' href='https://code.roseh.moe/chromatopelma/commit/?id=429aa3c3c58d93c3897fafc98d9b44ddc271e0d6'/>
<id>urn:sha1:429aa3c3c58d93c3897fafc98d9b44ddc271e0d6</id>
<content type='text'>
Now variables can't be updated after they're created, so they can be
freely copied into closures.
</content>
</entry>
</feed>
