Kartik K. Agaram
067fa9c725
bugfix: unbound variables were not raising error
...
Since we switched error trace semantics from a designated label to a designated
depth (commit 9831a8cef9
on May 19).
2021-05-30 18:02:40 -07:00
Kartik K. Agaram
150db8d56a
some boot-time heartbeat messages
...
This will help us with some common debug scenarios.
2021-05-07 12:27:20 -07:00
Kartik K. Agaram
91f76e6b22
clean up Bresenham line-drawing
2021-05-07 11:28:59 -07:00
Kartik K. Agaram
25eb9c580e
.
2021-05-07 11:02:55 -07:00
Kartik K. Agaram
74be534e2b
starting to implement first macros
...
Another commit, another bugfix.
Some snippets from my currently exploding todo list:
- always investigate lookup errors immediately. Beyond the root cause, they should never happen at the moment, while we aren't reclaiming memory.
we should always return a more precise error message. Usually involving null pointer checks.
- on abort, print out stack trace
- emit mapping of labels to addresses during survey
- store a mapping of symbols somewhere in the code image
- stop allocating 1KB per token; expand space for tokens as needed
2021-05-07 09:49:16 -07:00
Kartik K. Agaram
7c8ad5a419
more paranoia in shell/globals.mu
2021-05-06 19:38:54 -07:00
Kartik K. Agaram
edae464db5
shell: macroexpand outermost call
2021-05-06 18:13:27 -07:00
Kartik K. Agaram
d0e2d093f7
cleaner rendering of fake screens and keyboards
...
I don't understand why a second line in the keyboard is visible now where
it wasn't before. That whole aspect has unclear desires. What exactly do
I want to happen on newlines?
2021-05-01 16:12:49 -07:00
Kartik K. Agaram
c426cc0327
.
...
Clean up trace colors.
2021-05-01 15:49:48 -07:00
Kartik K. Agaram
2b616894fd
move color scheme closer to Solarized dark
...
sed -i 's,0x12/bg=almost-black,0xdc/bg=green-bg,g' shell/*.mu
sed -i 's, 0/bg, 0xc5/bg=blue-bg,g' shell/*.mu
sed -i 's, 7/fg=trace, 0x38/fg=trace,g' shell/*.mu
sed -i 's, 7/bg=grey, 0x5c/bg=black,g' shell/*.mu
Still a few issues.
Thanks Adrian Cochrane and Zach DeCook.
https://floss.social/@alcinnz/106152068473019933
https://social.librem.one/@zachdecook/106159988837603417
2021-05-01 15:37:55 -07:00
Kartik K. Agaram
3385febc11
shell: allow 'def' to overwrite
2021-04-29 23:53:28 -07:00
Kartik K. Agaram
c811754807
render definitions in 2 columns
2021-04-29 16:43:40 -07:00
Kartik K. Agaram
5124feb31e
tweak colors for definitions
2021-04-29 16:14:47 -07:00
Kartik K. Agaram
e13fd3e0a1
render in a narrow column
2021-04-29 16:11:23 -07:00
Kartik K. Agaram
b860f108f7
adjust some colors and padding
2021-04-29 15:10:17 -07:00
Kartik K. Agaram
dcb6a21a91
bugfix: initialize gap buffers before using them
...
I keep running into one hole in Mu's memory-safety since dropping the Linux
dependency: null pointers no longer error when dereferenced. Here the problem
manifests as aliasing: lots of gap buffers share the same exact data near
address 0, because it was never initialized.
2021-04-28 22:03:58 -07:00
Kartik K. Agaram
7fa356abef
fix rendering
2021-04-28 17:54:02 -07:00
Kartik K. Agaram
b9c59a5f5b
shell: load/store from/to disk with indent
...
Once I came up with the right approach, this worked on the first try once
I got the types and registers to line up!
2021-04-28 17:49:55 -07:00
Kartik K. Agaram
9269234e46
start rendering definitions with indentation
2021-04-28 14:47:41 -07:00
Kartik K. Agaram
5b7f938733
start stashing and clearing sandbox after definitions
2021-04-28 13:55:10 -07:00
Kartik K. Agaram
bd9c1e6a79
shell: primitive 'not'
2021-04-25 22:09:51 -07:00
Kartik K. Agaram
6e0f0bdf50
.
2021-04-25 22:00:00 -07:00
Kartik K. Agaram
ffe36c4050
.
2021-04-25 21:45:27 -07:00
Kartik K. Agaram
1323a6bb3a
.
...
Show all builtins now that we have more space.
2021-04-25 17:57:19 -07:00
Kartik Agaram
9c3e2821c1
.
...
Get rid of my experiment adding Game of Life to the shell.
2021-04-24 07:18:15 -07:00
Kartik K. Agaram
7a7191cc3e
clean up with the final bugfix
2021-04-22 09:09:23 -07:00
Kartik K. Agaram
bd0410c993
snapshot
...
It took me _way_ too long to realize that I'm not checking for errors within
the loop, and that will cause it to manifest as an infinite loop as inner
evaluations fail to run.
Debugging notes, for posterity:
printing one row of a chessboard pattern over fake screen (chessboard screen 4 0 0 15) gets stuck in an infinite loop halfway through
debug pattern during infinite loop: VWEX. It's still in the loop but it's not executing the body
raw (fill_rect screen 16 0 20 4 15) works fine
same number of calls to fill_rect work fine
replacing calls to fill_rect with pixel inside chessboard2 works fine
at the point of the infinite loop it's repeatedly going through the hline loop
-- BUT it never executes the check of the loop (< lo hi) with lo=20, hi=20. Something is returning 1, but it's not inside <
stream optimization is not implicated
simple test case with a single loop
(
(globals . (
(foo . (fn () (screen i n)
(while (< i n)
(pixel screen 4 4 i)
(pixel screen 5 4 i)
(pixel screen 6 4 i)
(pixel screen 7 4 i)
(set i (+ i 1)))))
))
(sandbox . (foo screen 0 100))
)
simpler (if you reset cursor position before every print):
(
(globals . (
(foo . (fn () (screen i n)
(while (< i n)
(print screen i)
(set i (+ i 1)))))
))
(sandbox . (foo screen 0 210))
)
I now believe it has nothing to do with the check. The check always works.
Sometimes no body is evaluated. And so the set has no effect.
2021-04-22 09:05:11 -07:00
Kartik K. Agaram
a5e1a220fd
shell: refuse to 'def' duplicate names
2021-04-21 20:54:18 -07:00
Kartik K. Agaram
c54b7e9630
shell: separate 'def' from 'set'
...
'def' creates new bindings (only in globals)
'set' only modifies existing bindings (either in env or globals)
2021-04-21 20:53:38 -07:00
Kartik K. Agaram
e5adb2239c
.
2021-04-17 23:59:30 -07:00
Kartik K. Agaram
1a74c3a1e6
loosening a few more buffers
...
Mu computer now has more code in it:
(
(globals . (
(hline1 . (fn () (screen y lo hi) (if (>= lo hi) () ((fn () (pixel screen lo y 12) (hline1 screen y (+ lo 1) hi))))))
(vline1 . (fn () (screen x lo hi) (if (>= lo hi) () ((fn () (pixel screen x lo 12) (vline1 screen x (+ lo 1) hi))))))
(hline . (fn () (screen y) (hline1 screen y 0 (width screen))))
(vline . (fn () (screen y) (vline1 screen y 0 (height screen))))
(andf . (fn (a b)
(if a
(if b
1
())
())))
(brline . (fn (screen x0 y0 x1 y1)
((fn (dx dy sx sy)
((fn (err)
(brline1 screen x0 y0 x1 y1 dx dy sx sy err))
(+ dx dy)))
(abs (- x1 x0))
(- 0 (abs (- y1 y0)))
(sgn (- x1 x0))
(sgn (- y1 y0)))))
(brline1 . (fn (screen x y xmax ymax dx dy sx sy err)
(pixel screen x y 12)
(if (andf (= x xmax) (= y ymax))
()
((fn (e2)
(brline1 screen
(if (>= e2 dy)
(+ x sx)
x)
(if (<= e2 dx)
(+ y sy)
y)
xmax
ymax
dx
dy
sx
sy
(+ err
(+
(if (>= e2 dy)
dy
0)
(if (<= e2 dx)
dx
0)))))
(* err 2)))))
))
(sandbox . (brline screen 1 1 5 5))
)
2021-04-17 08:29:43 -07:00
Kartik K. Agaram
33f5eb632a
new primitives: abs, sgn
2021-04-16 20:40:02 -07:00
Kartik K. Agaram
cec0d9553b
open question: animations in the fake screen
...
Right now we just render the state of the screen at the end of an evaluation.
2021-04-15 23:20:00 -07:00
Kartik K. Agaram
6aedf5dc59
.
2021-04-15 23:17:15 -07:00
Kartik K. Agaram
735636c7da
.
2021-04-15 23:15:47 -07:00
Kartik K. Agaram
c975f29a0c
.
2021-04-15 23:12:46 -07:00
Kartik K. Agaram
de993bc0cd
shell: primitives for screen size
2021-04-15 22:00:03 -07:00
Kartik K. Agaram
5b20f177b6
shell: restore bindings after restart
2021-04-15 21:40:48 -07:00
Kartik K. Agaram
9d367ec2ed
shell: start persisting global bindings
2021-04-15 21:05:55 -07:00
Kartik K. Agaram
0f760bd60c
.
2021-04-15 20:56:52 -07:00
Kartik K. Agaram
b2e0ce69ef
.
2021-04-15 20:15:22 -07:00
Kartik K. Agaram
fced134f8f
.
2021-04-15 17:41:55 -07:00
Kartik K. Agaram
98715a829e
shell: primitives for comparison, cursor movement
2021-04-14 21:26:16 -07:00
Kartik K. Agaram
0b00cacac6
shell: more detailed description of primitives
2021-04-14 20:56:48 -07:00
Kartik K. Agaram
bbabe8bd1a
shell: pixel graphics
2021-04-13 22:27:59 -07:00
Kartik K. Agaram
1c4e8fe775
shell: none of our primitives need to be closures
2021-04-10 23:32:38 -07:00
Kartik K. Agaram
b0096cd6a6
shell: streams that you can append graphemes to
2021-04-10 23:05:16 -07:00
Kartik K. Agaram
f38c2a1502
.
2021-04-10 22:38:02 -07:00
Kartik K. Agaram
1afc02113a
shell: fake keyboard
2021-04-10 22:28:24 -07:00
Kartik K. Agaram
770cac9412
shell: UI now showing fake keyboard
...
But we don't actually support fake keyboards anywhere yet.
2021-04-10 21:20:46 -07:00
Kartik K. Agaram
400574f956
shell: move fake screen to sandbox
2021-04-10 20:44:26 -07:00
Kartik K. Agaram
6fa86619b2
shell: tweaks for fake screens
...
- make them more discoverable
- clear them between commands
2021-04-10 20:09:18 -07:00
Kartik K. Agaram
90748fa45d
shell: render fake screens
...
'print' turns out to not be working yet.
2021-04-10 17:42:35 -07:00
Kartik K. Agaram
97cffa20d4
shell: start of 'print' primitive
2021-04-10 15:59:40 -07:00
Kartik K. Agaram
1d724f9260
shell: structural equality check
...
Mu can now compute (factorial 5)
2021-04-09 22:51:24 -07:00
Kartik K. Agaram
fd0e9b5b68
shell: render primitives at the bottom
2021-04-08 23:04:30 -07:00
Kartik K. Agaram
c3069ab818
shell: start rendering globals
2021-04-08 23:04:30 -07:00
Kartik K. Agaram
d6d28b8c94
shell: create space to display globals
2021-04-08 22:19:24 -07:00
Kartik K. Agaram
7032a92cf2
shell: 'set' for defining globals
...
Currently stateful, but still good for things.
2021-04-06 10:00:23 -07:00
Kartik K. Agaram
6ef0eabdcf
shell: now we can start adding primitives
2021-04-06 09:07:25 -07:00
Kartik K. Agaram
b9656ea881
shell: look up globals
2021-04-06 07:51:56 -07:00
Kartik K. Agaram
0db683ffdb
shell: extensible array of globals
...
I'm not bothering with full dynamic scope for now.
2021-04-05 23:55:13 -07:00