Commit Graph

63 Commits

Author SHA1 Message Date
107522f67d Cleaning clippy
Signed-off-by: teo3300 <matteo.rogora@live.it>
2024-01-17 20:59:13 +09:00
5648ff7709 Moving a whole bunch of stuff in lisp
Signed-off-by: teo3300 <matteo.rogora@live.it>
2024-01-17 20:58:25 +09:00
8d305cfd68 Minor fixes
Signed-off-by: teo3300 <matteo.rogora@live.it>
2024-01-17 19:17:31 +09:00
4f7140009d Minor fixes
Signed-off-by: teo3300 <matteo.rogora@live.it>
2024-01-17 19:17:04 +09:00
4c55c9219f Fixing history
- Histroy was loaded from correct but saved in wrong file
- Somehow multiline string only works while loading files (not bad)
- Fixing error on not-ended string: unrecoverable

Signed-off-by: teo3300 <matteo.rogora@live.it>
2024-01-17 17:32:13 +09:00
6eed79557f No multiline strings for now
Signed-off-by: teo3300 <matteo.rogora@live.it>
2024-01-17 17:09:08 +09:00
18ca7ddbdf Adding quotation, semiquote macro and env access
Signed-off-by: teo3300 <matteo.rogora@live.it>
2024-01-17 16:36:18 +09:00
0b9e535b7c From rust's load_file to lisp's load-file
Signed-off-by: teo3300 <matteo.rogora@live.it>
2024-01-17 13:51:52 +09:00
c8ccb16c90 Fixing trailing parenthesis problem in loading files
Signed-off-by: teo3300 <matteo.rogora@live.it>
2024-01-17 13:27:32 +09:00
cf08b7e65a Fixing read-str
Previously the interactive mode looped on a READ fail
Now inner READ errors are treated as unrecoverable and cause the reader
to reset

Signed-off-by: teo3300 <matteo.rogora@live.it>
2024-01-17 13:11:52 +09:00
9491983a05 Moving some functios
- Some functions moved from core.rs to core.mal
- Separating MAL_HOME setting from core/config loading

Signed-off-by: teo3300 <matteo.rogora@live.it>
2024-01-17 12:07:06 +09:00
e6924d42b4 Adding helper functions
- improved 'help'
- added 'find'
- using clojure syntax for function arguments

Signed-off-by: teo3300 <matteo.rogora@live.it>
2023-12-29 11:01:12 +09:00
672c73cb4f Clippy fix, removed some Debug traits
Signed-off-by: teo3300 <matteo.rogora@live.it>
2023-12-27 16:38:21 +09:00
6bc8735af6 Step 6
- added 'eval', 'slurp', 'read-string'
- 'not' and 'load-file' defined through mal
- added some missing print functions
- listing all defined repl symbols when calling 'help' with no argumens

Signed-off-by: teo3300 <matteo.rogora@live.it>
2023-12-27 16:26:46 +09:00
7a5ebe5fa1 Using "Editor" for my mental health
Signed-off-by: teo3300 <matteo.rogora@live.it>
2023-12-22 09:54:16 +09:00
28af3f8785 Fixed type for function apply 2023-12-21 19:34:56 +09:00
0b47444836 Applied step 5 TCO
- Some tests disabled for incompatibility
- next step is to restore those tests, as well as a whole "eval" test
2023-12-21 19:25:24 +09:00
c6eeb225df Moving to TCO 2023-12-19 11:34:38 +09:00
816a09504a Other tests
Lotta tests in
- eval
- functional tests

Signed-off-by: teo3300 <matteo.rogora@live.it>
2023-12-06 11:35:55 +09:00
83e45334a5 Adding tests
- functional tests
- more tests
- tests tests tests

Signed-off-by: teo3300 <matteo.rogora@live.it>
2023-11-26 19:48:54 +09:00
1f47c9f57e Added some other tests
- builtin eq test
- load_file return resul

Signed-off-by: teo3300 <matteo.rogora@live.it>
2023-11-25 22:29:06 +09:00
1ea3ecbb92 Ok, maybe I should run Cargo fmt BEFORE
Signed-off-by: teo3300 <matteo.rogora@live.it>
2023-11-25 20:36:21 +09:00
0cbfaaafec Some more tests
- Added hook pre-commit
- Added some reader tests
- Added some eval tests
- Added functional tests

Signed-off-by: teo3300 <matteo.rogora@live.it>
2023-11-25 20:30:21 +09:00
2d5791a766 Adding test for reader.rs
- will implement other tests later

Signed-off-by: teo3300 <matteo.rogora@live.it>
2023-11-22 18:26:28 +09:00
78dee9c848 Added some definition to core
- "=" operator (for almost any type)
- "prn" function
- "list" and "list?"
- "empty" and "count"

Signed-off-by: teo3300 <matteo.rogora@live.it>
2023-11-21 23:09:39 +09:00
136ef726f3 Functional programming goes brr
- reduced some indentation

Signed-off-by: teo3300 <matteo.rogora@live.it>
2023-11-17 22:15:38 +09:00
4a695a635e Clippy doing stuff
Signed-off-by: teo3300 <matteo.rogora@live.it>
2023-11-16 16:02:33 +09:00
0e85435635 Better? type management
Signed-off-by: teo3300 <matteo.rogora@live.it>
2023-11-15 18:25:38 +09:00
3c5b03a2a8 Cleaned code
- removed dereferences
- help function only provide info for the first symbol

Signed-off-by: teo3300 <matteo.rogora@live.it>
2023-11-15 17:42:23 +09:00
695c42010c Using Rc for everything
- avoid eccessive cloning

Signed-off-by: teo3300 <matteo.rogora@live.it>
2023-11-15 10:50:29 +09:00
f240d31f27 Created core file
- keep core functions in a different file
- I can return custom values UwU

Signed-off-by: teo3300 <matteo.rogora@live.it>
2023-11-14 20:55:28 +09:00
0cca2f2b9b Improved read
- no need to parse the input multiple times
- read function is more clean

Signed-off-by: teo3300 <matteo.rogora@live.it>
2023-11-14 10:29:39 +09:00
a3d402fed2 Improved file loading and repl
- multiple line instruction
- multiple intstruction line

Signed-off-by: teo3300 <matteo.rogora@live.it>
2023-11-13 22:08:55 +09:00
6e45205904 Small fixino
Signed-off-by: teo3300 <matteo.rogora@live.it>
2023-10-25 15:52:13 +09:00
21a7c9e695 Implementing side-stuff
- Added error severity, mainly to distinguish between READ and EVAL
  errors, can be later expanded to allow other distinction
- Improved repl using the above function (EVAL errors interrupts the
  repl right away, without the need to double-return)
- Added an helper function to provide infos about builtin and composed
  functions
- Possibility to pass files as arguments to setup the environment

Signed-off-by: teo3300 <matteo.rogora@live.it>
2023-10-25 15:31:44 +09:00
88e9964d9a Recursion finally works
Switched from Box to Rc (Yeah, I peeked at solution but I understood Rc
and RefCell just now) to allow multiple references to env data

Signed-off-by: teo3300 <matteo.rogora@live.it>
2023-08-06 18:26:08 +02:00
81cfe11092 Not really like this fix either
Signed-off-by: teo3300 <matteo.rogora@live.it>
2023-07-27 16:57:29 +02:00
24a42d5628 Implemented fn* special form
- Don't really like how it is behaving: turning expressions into a list
of expression and evaluating them separately

Signed-off-by: teo3300 <matteo.rogora@live.it>
2023-07-27 16:50:45 +02:00
fc7328167a Added do form
Signed-off-by: teo3300 <matteo.rogora@live.it>
2023-07-26 18:33:30 +02:00
67a9c6d0ae Implementing conditional and integer comparators
- added `init` function, will be used later to implement functions
- moved `car_cdr` to `types.rs`
- improved some error messages
- implemented `do` and `if` special forms
- implemented comparison between numeric values (integers)
- improved comment

Signed-off-by: teo3300 <matteo.rogora@live.it>
2023-07-24 23:31:42 +02:00
6f28ca5df6 Fixed panic with let*
Previously panic occured on a `let*` with an empty body, due to how
`let_star` and `eval` functions interacted:

 - (let* (a 1)) resulted in an index-out-of-bound panic on trying to
 evaluate the empty body of the statement, a simple guard has been
 inserted, I probably can write it a bit better

Signed-off-by: teo3300 <matteo.rogora@live.it>
2023-07-08 12:49:34 +02:00
148196dae5 Change code syntax to make it a bit better
Signed-off-by: teo3300 <matteo.rogora@live.it>
2023-07-08 12:48:53 +02:00
308d239ebc Update README.md
Fixed broken links
2023-07-08 12:04:01 +02:00
cf68e7094d Cleaning some match statements in eval.rs
Signed-off-by: teo3300 <matteo.rogora@live.it>
2023-06-21 13:47:24 +02:00
d7173c393c Implemented let* special function
Signed-off-by: teo3300 <matteo.rogora@live.it>
2023-06-21 12:17:31 +02:00
3456a62879 Implemented def!
Implemented `def!` to define new symbols into the current
environment, still need to implement `let*`

Added some helper functon for the eval phase

Defined a macro for more readable environment initialization

Signed-off-by: teo3300 <matteo.rogora@live.it>
2023-06-18 01:00:00 +02:00
b3b1e7f5ae Ignoring editor save file 2023-06-15 17:33:27 +02:00
c8e83ee7a8 Moving to (hopefully) proper references 2023-06-14 00:45:51 +02:00
fe92bbcaa1 Preparing to implement multiple environments
Signed-off-by: teo3300 <matteo.rogora@live.it>
2023-06-13 23:59:39 +02:00
d1c56b02bb Added pointer for outer environment
Signed-off-by: teo3300 <matteo.rogora@live.it>
2023-06-12 00:54:15 +02:00