Commit Graph

87 Commits

Author SHA1 Message Date
Sameer Rahmani 146e68670a Enable the golangci-lint in the CI 2021-01-25 19:18:35 +00:00
Sameer Rahmani f8d8256d29 Fix all the linting problems through out the bootstrap dir 2021-01-25 18:37:19 +00:00
Sameer Rahmani 23d397b94e Fix the linting issues on the core package 2021-01-25 17:50:33 +00:00
Sameer Rahmani 30669d9327 Fix linter issues on the parser module 2021-01-23 18:32:32 +00:00
Sameer Rahmani b650a10ba0 Fix linter issues in the numbers.go 2021-01-22 21:36:26 +00:00
Sameer Rahmani ea666bfa6a Fix linter problems in function.go and types.go 2021-01-22 21:27:51 +00:00
Sameer Rahmani 4216547dd3 Fix linter problems on on eval.go and some of other pkg/core 2021-01-22 21:19:41 +00:00
Sameer Rahmani 5882897375 Use --fix argument of linters to auto fix as many issue as possible 2021-01-22 20:39:06 +00:00
Sameer Rahmani 3f554445d8 Fix some the linters problems reported by the golang-cli 2021-01-22 20:37:44 +00:00
Sameer Rahmani fabb3cbb32 Fix some random linting issues 2021-01-21 22:52:18 +00:00
Sameer Rahmani 8bcf1ea566 Update the golangci location to be used only for the bootstrap 2021-01-18 18:07:48 +00:00
Sameer Rahmani 3904d6ef74 Fix couple of linting problems 2021-01-15 20:48:56 +00:00
Sameer Rahmani 2d7a32bcf3 Remove the debug data on the Makefile 2021-01-15 18:56:10 +00:00
Sameer Rahmani d154f32079 Fix the build script to compile the bootstrap in a container 2021-01-15 18:52:09 +00:00
Sameer Rahmani e0c6960b6b Add jenkinsfile and makefiles to test it 2021-01-15 18:28:36 +00:00
Sameer Rahmani 09a6d92c08 Replace Tre/False types with a Bool type 2021-01-14 18:17:38 +00:00
Sameer Rahmani c88c7dad96 Fix some of styling issues through out ast and hash modules 2021-01-14 17:48:39 +00:00
Sameer Rahmani e26bc00f09 Document the location.go file 2021-01-12 19:01:41 +00:00
Sameer Rahmani 2f6f79fe35 Split up the ast.go into smaller files 2021-01-11 19:03:02 +00:00
Sameer Rahmani f2241cc31f [Bootstrap] Add E0003 and the MakeRuntimeError to cover for MakeError 2021-01-10 18:30:48 +00:00
Sameer Rahmani c30c93442b [Bootstrap] Update the printer functions to enhace the traceback visuals 2021-01-10 17:03:52 +00:00
Sameer Rahmani c2d4273319 [Bootstrap] Fix the order and location on the traceback
In order to fix this issue I had to make many minor tweaks
including reordering the traceback and the way we pass down
nodes.
2021-01-07 19:45:07 +00:00
Sameer Rahmani e4001e3802 [Bootstrap] Add a basic PrintError function to print error messages with the traceback 2021-01-03 23:42:49 +00:00
Sameer Rahmani 9be27c124a [Bootstrap] Use Serene itself to load and run the main function
This commit consist a series of fixes to make the reach the main
goal of the commit:

* Fix the 'MakeNodeFromExprs' behavior so it returns a pointer
  to a node and if the number of input exprs is zero then nil.

* Fix all the eval loop to return immediately in case of any error
  duh!

* Add a `errtype` field to `Error` with an `ErrType` enum type
  that indicates the type of the error, the type being syntax,
  semantic and runtime error at the moment.

* Rename some of the Error functions to match the error type. For
  Exapmle `MakeSyntaxError` and `MakeSemanticError`
2021-01-02 21:04:35 +00:00
Sameer Rahmani e895377811 [Bootstrap] Update the call stack to container the caller and add a line index to the parser 2021-01-01 19:13:49 +00:00
Sameer Rahmani 66e9340005 [Bootstrap]: Create an index of errors and their descriptions 2021-01-01 19:13:10 +00:00
Sameer Rahmani 9d106d4278 Record the caller details in the stack frame 2020-12-30 17:50:00 +00:00
Sameer Rahmani 3904b050bb [Bootstrap] Update the LICENSE file to hold a copy of GNU GPL2 2020-12-25 23:40:21 +00:00
Sameer Rahmani 8eef7d76ca [Bootstrap] Add minor comment to clearify 'instructions' 2020-12-25 23:20:15 +00:00
Sameer Rahmani dff78f4cf4 [Bootstrap] Document the callstack internals 2020-12-25 22:55:26 +00:00
Sameer Rahmani 1447f8ac45 [Bootstrap] Implement a call stack to keep track of function calls
Add `ICallStack` as the interface to the call stack with a simple
FIFO implementation that tracks the recursive calls as well.
2020-12-25 22:03:21 +00:00
Sameer Rahmani 9dfe54a573 [Bootstrap]: Add internal instructions with an IExpr interface 2020-12-25 22:01:59 +00:00
Sameer Rahmani b0925a527b [Bootstrap] Add a sample shared library to used with ffi api 2020-12-25 21:57:13 +00:00
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 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 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 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