Commit Graph

156 Commits

Author SHA1 Message Date
Sameer Rahmani cb96e15b9c [Bootstrap]: Add some comment explaining the tree rewriting approach 2020-12-25 01:40:13 +00:00
Sameer Rahmani a66245adb0 [Bootstrap]: Fix the error message for mismatch function arguments 2020-12-25 01:18:54 +00:00
Sameer Rahmani 0b56906474 [Bootstra] Rethink the eval loop to rewrite evaluation tree
Implement a new algorithm to eliminate TCO while preventing
premature execution exit by rewriting the evaluation tree and
replacing old nodes with new set of forms, for example the result of
some old form's evaluation, a body of a function or anything in
that nature. Couple the new forms with a possible new execution scope.
2020-12-25 01:18:54 +00:00
mary cf772c1c47 Merge pull request 'add serene's asciiart to the REPL' (#4) from repl-ascii-art into master
Reviewed-on: Serene/Serene#4
Reviewed-by: Sameer Rahmani <lxsameer@gnu.org>
2020-12-24 22:04:47 +00:00
Mary Salehi f5b833cd03 add serene's asciiart to the REPL 2020-12-24 21:58:32 +00:00
Sameer Rahmani 699483e249 Add support for printable strings and 'pr', 'prn' functionalities.
Add 'pr' and 'prn' functions to print out the representation of an
string and 'print' and 'println' to print out the string.
2020-12-24 16:28:12 +00:00
Sameer Rahmani fb6c1b3ba3 Add 'run' subcommand to Serene binary 2020-12-24 16:27:46 +00:00
Sameer Rahmani 69d30dd04e Update dev.org with several resources on memory management 2020-12-24 12:55:16 +00:00
Sameer Rahmani 3f6b9b6e29 [Bootstrap] Add the support for keywords
Both normal and ns qualified keywords with support for ns aliased
keywords.
2020-12-22 23:54:21 +00:00
Sameer Rahmani 4530f35e9c Remove the shared library mocked code from the runtime creation 2020-12-21 18:34:51 +00:00
Sameer Rahmani 5ee7e93647 Add IHashable and the implementation for all the IExpr types 2020-12-20 18:09:06 +00:00
Sameer Rahmani 1d66c2a56e Add support for very basic string implementation 2020-12-16 22:40:59 +00:00
Sameer Rahmani 4b17c0d740 Update the TOC of README.org 2020-12-16 19:11:21 +00:00
Sameer Rahmani 817625d1e6 Update the TOC of README.org 2020-12-16 19:08:49 +00:00
Sameer Rahmani f2b4a15585 Update the TOC of README.org 2020-12-16 19:05:36 +00:00
Sameer Rahmani 578a771fa3 Improve the documentation of the bootstrap 2020-12-16 18:57:54 +00:00
Sameer Rahmani 42058568c7 Add support for native function, multi ns require fn and 'builtins'
* Implemented Native function as IExprs so we can refer to them
  like any other function. Checkout `NativeFunction`.

* `require` has been implemented as a native functions which
  accepts one or more namespace descriptions and load them.
  A namespace description is either a symbol with the ns name
  or an `IColl` in the following form `(some.ns.name alias).

* A hashmap of strings to native functions has been added to the Runtime
  which is used to resolve builtin functions.
2020-12-15 19:08:51 +00:00
Sameer Rahmani 21d15787c9 Add support for loading namespaces via 'require' (symbol only)
At this stage we only supports requiring a namespace via it's name
and only one namespace like `(require 'blah.blah)`. But the support
for name aliases and requiring more namespaces at once would be
easy enough.
2020-12-12 20:33:53 +00:00
Sameer Rahmani a4cc6c0368 Add support for ns qualified symbols to refer to external namespaces 2020-12-12 20:33:35 +00:00
Sameer Rahmani e00291ac0a Turn the 'Namespace' struct to an expression and add helper fns for handling 'externals' 2020-12-12 20:32:39 +00:00
Sameer Rahmani 7f54e68256 Fix the parser to support end of line and bunch of other whitespace equavilents 2020-12-12 20:31:08 +00:00
Sameer Rahmani 572899318f Add 'SetNode' support to IError interface 2020-12-12 20:28:32 +00:00
Sameer Rahmani aa1079c6b6 Add 'paths' support alongside with namespace loading to the Runtime 2020-12-12 20:27:53 +00:00
Sameer Rahmani 17e35aa2e9 Add the Namespace type to the ast 2020-12-12 20:26:26 +00:00
Sameer Rahmani cfa7b967dc Add a TODO list of the remaining features 2020-12-05 14:21:15 +00:00
amirrezaask 5dbe96b79e Merge pull request 'Improve internal Error' (#2) from refactor/make-IError-stdlib-compatible into master
Reviewed-on: Serene/Serene#2
Reviewed-by: Sameer Rahmani <lxsameer@gnu.org>
2020-12-05 11:24:55 +00:00
amirrezaask 2143938705 add wrapped error 2020-12-05 14:43:49 +03:30
amirrezaask b37afd25d4 add .Error method to error struct 2020-12-05 13:37:04 +03:30
Sameer Rahmani 472dc78e8c Update the bootstrap README 2020-12-04 21:27:04 +00:00
Sameer Rahmani 31a4cfb765 Add support for macros via defmacro
Added the support for normal macro (in compare to reader macros and
other types) expansion with out quasiquote support. The quasiquote
will be added as a recursive macro itself.
2020-12-04 21:08:48 +00:00
Sameer Rahmani b3f621ece1 Merge branch 'golang-impl' of devheroes.codes:Serene/Serene into golang-impl 2020-11-26 12:04:01 +00:00
Sameer Rahmani 211e977430 Add 'quote' special form 2020-11-26 12:03:46 +00:00
Sameer Rahmani cacb00753a Merge pull request 'Scheme compilers to check out' (#1) from pouya-abbassi/Serene:golang-impl into golang-impl
Reviewed-on: Serene/Serene#1
2020-11-26 11:35:43 +00:00
Pouya Abbassi 2fa39738fb
Scheme compilers to check out 2020-11-26 00:57:25 +03:30
Sameer Rahmani 688d169286 Add the `let` special form alongside with locatable errors
Add the `let` sform not in the triditional way. In our case
the let scope is available to the bindings. Similar to clojure's let
and let* in triditional sense.

Also add the function `MakeErrorFor` which gets an extra arg, an
`IExpr` and returns an error with the location of that expression.
2020-11-25 19:19:48 +00:00
Sameer Rahmani d86b47c283 Change the `if` special form to use TCO
the bodies of `if` might be utilized for tail call recursion so we
need to run the body inside the TCO loop
2020-11-25 16:41:11 +00:00
Sameer Rahmani 0ef38cd9bd Add the 'do' special form 2020-11-25 16:18:38 +00:00
Sameer Rahmani c2326ae546 Add support for the IF special form 2020-11-25 13:15:19 +00:00
Sameer Rahmani 90888a7bcd Fix the REP loop to terminate early in case of any ParseError 2020-11-24 19:10:01 +00:00
Sameer Rahmani 52fa298a07 Add PrintError function to print out the IError values 2020-11-24 18:39:18 +00:00
Sameer Rahmani eea65489c8 Add True/False values 2020-11-24 18:27:59 +00:00
Sameer Rahmani d92150f0c3 Add IError interface to represent system errors 2020-11-24 18:27:48 +00:00
Sameer Rahmani 57714accfc Add Location type and support to ILocatable 2020-11-23 12:30:02 +00:00
Sameer Rahmani a2725ba412 Add some documentation for the core package 2020-11-20 16:43:07 +00:00
Sameer Rahmani 468b446a4f Enable repl history 2020-11-20 12:33:15 +00:00
Sameer Rahmani 28d7be6efd Create the Block struct to accommodate function bodies 2020-11-19 22:17:50 +00:00
Sameer Rahmani 680017f0ce Add the Def, and Fn special forms 2020-11-19 19:14:06 +00:00
Sameer Rahmani ad37f02742 Restructure the source tree to get around circular dep issue 2020-11-15 22:16:48 +00:00
Sameer Rahmani cba74e29af Add the support for special forms 2020-11-15 21:38:09 +00:00
Sameer Rahmani 38baf577bb Move reader and printer packages to the core package 2020-11-15 19:33:16 +00:00