Commit Graph

59 Commits (0559d3a73bc2eadb7e965091e3303ecded1839e6)

Author SHA1 Message Date
Mike Gerwitz 61f6ba1470
prebirth: Distinguishable id generation
* build-aux/bootstrap/prebirth.js (Compiler#_idFromName): Distinguish
  between certain types of characters.
2017-08-29 23:59:49 -04:00
Mike Gerwitz 6a736a8fcd
prebirth: Ignore comments in JS parser
* build-aux/bootstrap/prebirth.js (parseLisp): Ingore comment tokens.
  (_lex): Recognize comments.
2017-08-29 01:27:54 -04:00
Mike Gerwitz 3c5089417c
prebirth: Globally unique functions
This was implicit in the `define-block' implementation because of the
conversion from `<foo>' to `$foo$', but that's no longer the case.

This is just a simple, temporary implementation, so don't be alarmed.

* build-aux/bootstrap/libprebirth.js: Updated header documentation to
    mention `$$' prefix.
  ($$js$console): Renamed from `js$console'.
* build-aux/bootstrap/prebirth.js
  (_idFromName): Add `global' parameter to add `$$' prefix to generated
    identifiers.
  (_cdfn, _sexpToEs): Use it.
2017-08-28 23:42:19 -04:00
Mike Gerwitz 19642e59d9
prebirth: Prepend libprebirth to output
* build-aux/bootstrap/libprebirth.js: Add file.
* build-aux/bootstrap/prebirth.js: Prepend `libprebirth.js' contents to
  output.
2017-08-28 01:22:51 -04:00
Mike Gerwitz f2adafb264
prebirth: Allow toplevel function applications
So we can invoke the main function for the program.

* build-aux/bootstrap/prebirth.js
  (Compiler#_cdfn): Handle non-`define' applications.
  (Compiler#assertApply): Remove function.
2017-08-28 01:21:02 -04:00
Mike Gerwitz f23396de2e
prebirth: Abandon `define-block' in favor of `define'
Turns out, I'll kill myself before writing a Prebirth compiler in a
block-define-based Prebirth Lisp.  So, let's degrade even further into a
primitive Scheme.  This is going down a dangerous path to simply
implementing Scheme...

Nonetheless, here I remove `define-block' in favor of a simple shorthand
function definition `define', as is custom in Scheme.  We will worry
about block definitions later as metadata mapping to normal functions.
2017-08-28 00:53:02 -04:00
Mike Gerwitz c0fb8297a6
Prebirth: Add docstring
* build-aux/bootstrap/prebirth.js (Compiler#_docstring): Add method.
  (Compiler#_cdfn): Use it.
2017-08-21 02:39:33 -04:00
Mike Gerwitz 7998296a20
Add prebirth.js
This is hopefully the beginning of a good thing that I'll actually
finish.  I began planning this project formally just before the beginning of
Aug 2017.

* build-aux/bootstrap/prebirth.js: New file.
2017-08-21 02:20:10 -04:00
Mike Gerwitz ecd8b6d9e7
Add README.md and COPYING 2017-08-21 02:19:36 -04:00