Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symex 2.0 Release Prep #71

Draft
wants to merge 212 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
212 commits
Select commit Hold shift + click to select a range
ce3a72c
Fix links to point to current repo home at drym-org
countvajhula Feb 25, 2023
026ead9
Deprecate the Hydra modal provider
countvajhula Feb 25, 2023
abb0b3e
remove a leftover reference to `symex-modal-backend`
countvajhula Feb 25, 2023
1d43d7a
make a sentence a bit more clear
countvajhula Mar 7, 2023
f153c32
note todo re: `symex-define-command`
countvajhula Sep 15, 2022
f80c7c1
Add a basic `symex-define-command` macro
countvajhula Sep 15, 2022
7ed115c
abstract "tidy" operation over lisp and ts
countvajhula Sep 15, 2022
2db6616
define "clear" using `symex-define-command`
countvajhula Sep 15, 2022
9c1b6cb
move/rename some interfaces to better reflect abstraction level
countvajhula Sep 15, 2022
4de07d0
define "replace" as a proper primitive operation
countvajhula Sep 15, 2022
d6fa6de
Add `symex-define-insertion-command` macro
countvajhula Sep 15, 2022
84a28e7
define "open after" as an insertion command
countvajhula Sep 15, 2022
b68fb1c
define "open before" as an insertion command
countvajhula Sep 15, 2022
c6707c8
note some todos
countvajhula Sep 29, 2022
d74289a
extract ts tidying and selection since it's in the wrapping command m…
countvajhula Sep 29, 2022
94c7b27
define deletion using the command macro
countvajhula Sep 29, 2022
1e6738a
define more insertion commands using the macro
countvajhula Oct 7, 2022
ff444c0
avoid startup issue with macro being undefined
countvajhula Oct 8, 2022
1077197
reuse deletion code in `change`
countvajhula Feb 25, 2023
d48219a
undo `change` with single undo, and follow this for all commands
countvajhula Feb 25, 2023
58a6be0
declare emacs indent style for command macros
countvajhula Feb 25, 2023
6fd9762
declare most transformations formally as symex commands
countvajhula Feb 25, 2023
49969a8
fix symex-replace so undo works in one step
countvajhula Feb 25, 2023
4b9b7ad
fix a selection issue affecting most commands wrt indented symexes
countvajhula Mar 1, 2023
495fcc9
Improve primitive Lisp parsers
countvajhula Mar 7, 2023
46d8fd9
improve primitive "up" motion to ensure valid posterior selection
countvajhula Mar 7, 2023
bb39a43
Improve Lisp paste primitives
countvajhula Mar 7, 2023
80635ee
Simplify lisp tidy feature
countvajhula Mar 7, 2023
bd24cf8
fix paste-after to select the pasted expression
countvajhula Mar 7, 2023
ef07253
a "hack" to enter strings
countvajhula Mar 9, 2023
5238f1b
don't stray from line on visual line motions
countvajhula Mar 9, 2023
323148d
fix hanging whitespace in append-newline
countvajhula Mar 9, 2023
9d4b304
fix infinite loop in shifting forward "the most" at the top level
countvajhula Mar 9, 2023
8c63356
fix join joining to previous on last expression (do nothing instead)
countvajhula Mar 9, 2023
4ad8936
fix some calls to symex-tidy
countvajhula Mar 9, 2023
504ac4e
simplify join-lines implementation
countvajhula Mar 9, 2023
fd53dda
tidy all affected symexes after joining lines
countvajhula Mar 9, 2023
b958932
fix infinite loop in tidy-affected when on last symex
countvajhula Mar 9, 2023
7c5d2ca
improve tidy-affected implementation, don't mutate point
countvajhula Mar 9, 2023
a694c83
tidy affected symexes in appending newlines too
countvajhula Mar 9, 2023
02887ad
commit low-level utility that was left out
countvajhula Mar 9, 2023
06e5489
improve lisp deletion primitive to handle a case better
countvajhula Mar 9, 2023
dd3fe9b
fix trailing whitespace in tidying
countvajhula Mar 9, 2023
45ad93d
better handle another case in deletion
countvajhula Mar 9, 2023
d1d04d8
fix open line below in the presence of an inline comment
countvajhula Mar 9, 2023
b405e0a
remove unused function
countvajhula Mar 9, 2023
fa10d86
rename functions to reflect toplevel private/public correctly
countvajhula Mar 9, 2023
26ee524
fix name
countvajhula Mar 9, 2023
e5f71c4
handle a corner case in lisp primitive forward motion
countvajhula Mar 9, 2023
1796653
improve tidy-affected implementation, esp fix initial behavior
countvajhula Mar 9, 2023
a3a608d
improve paste implementation, handle some edge cases better
countvajhula Mar 9, 2023
7ae79a1
add an extra newline in pasting at the toplevel for "island" symexes
countvajhula Mar 9, 2023
8282e06
refine condition for adding newline padding while pasting
countvajhula Mar 9, 2023
cdb8422
further refine toplevel newline padding criteria during paste
countvajhula Mar 10, 2023
1a7c2e3
fix handling of some edge cases in paste
countvajhula Mar 10, 2023
37e9602
docs: some tips on debugging with macros present
countvajhula Mar 10, 2023
6f8cb95
handle a case more naturally in lisp primitive deletion
countvajhula Mar 10, 2023
61f239b
Handle an edge case in adjusting point, at ( | abc ...)
countvajhula Mar 10, 2023
e8a39ee
simplify "clear" implementation, handle more cases
countvajhula Mar 10, 2023
86bfc0f
improve replace, fix some existing cases and handle more cases
countvajhula Mar 10, 2023
3c47bf9
fix an edge case in join-lines at eol
countvajhula Mar 11, 2023
ea7c4cd
handle more cases in symex-replace
countvajhula Mar 11, 2023
f7e086b
fix: nothing needs to be done in clear if already empty
countvajhula Mar 11, 2023
deeafae
fix some cases involving the use of quantifiers in paste-before
countvajhula Mar 11, 2023
55b3c50
shed evil-cleverparens dependency
countvajhula Mar 11, 2023
dc86949
shed lispy dependency
countvajhula Mar 11, 2023
51708be
update some docs
countvajhula Mar 13, 2023
1c81699
fix capture backwards when on first symex
countvajhula Mar 14, 2023
b6c740d
fix a bug in paste-after that was causing an infinite loop
countvajhula Mar 14, 2023
51690e3
a couple of comments
countvajhula Mar 14, 2023
2f7cd69
restore proper handling of deletion at eol
countvajhula Mar 15, 2023
ff37cca
fix handling of strings in deleting the last element in a multi-line …
countvajhula Mar 15, 2023
659aded
fix handling of empty forms in nearest selection
countvajhula Mar 15, 2023
9f5ed18
fix selection after tidy-remaining
countvajhula Mar 15, 2023
9952683
improve another case in paste-after
countvajhula Mar 15, 2023
b2fdebb
make a note about behavior in an edge case
countvajhula Mar 15, 2023
ab9ac12
handle eob better in paste-after
countvajhula Mar 21, 2023
4cbb352
use forward-line instead of next-line (as advised by docs)
countvajhula Mar 21, 2023
97248ce
fix delete putting an empty line in the kill ring
countvajhula Mar 23, 2023
2a0547e
refactor paste to keep lisp code contained in the primitive layer
countvajhula Mar 28, 2023
502edcc
improve paste behavior in more corner cases
countvajhula Mar 28, 2023
c58f5e7
handle a corner case better in adjusting point for emacs/vim
countvajhula Mar 28, 2023
10871fe
use forward-line instead of previous-line (as suggested by docs)
countvajhula Mar 29, 2023
d442895
organize emit code for lisp/ts
countvajhula Mar 18, 2023
6597078
minor refactor in evaluator
countvajhula Mar 20, 2023
cb629f0
add delete and paste transformations to the DSL
countvajhula Mar 21, 2023
cb0aaae
simplify an example in the docs
countvajhula Mar 22, 2023
781ffa9
fix: incorporate delete/paste result into the traversal computation
countvajhula Mar 22, 2023
26d83e4
try returning success / failure in delete
countvajhula Mar 22, 2023
bd40289
use forward-line instead of next-line/previous-line
countvajhula Mar 22, 2023
5b92046
implement emit-forward as a Symex traversal with transformation
countvajhula Mar 22, 2023
fe258dc
count 0 executions as success when looping indefinitely in circuit
countvajhula Mar 22, 2023
ccb3e4e
execute arbitrary operations in the DSL
countvajhula Mar 22, 2023
f8dcd2c
Implement basic movements as traversals
countvajhula Mar 23, 2023
dcc748d
change delete syntax to specify "what" rather than a count
countvajhula Mar 23, 2023
15caa04
Implement emit-forward using the DSL
countvajhula Mar 23, 2023
b903f71
handle a low level exception in tidy
countvajhula Apr 9, 2023
05143b4
make symex-right-p behavior consistent with symex-left-p
countvajhula Apr 9, 2023
1b7ba3a
don't change level in nearest selection
countvajhula Apr 9, 2023
1060b71
At the DSL level, paste does not move point
countvajhula Apr 9, 2023
4238dc0
be more explicit about structural recursion in traversal evaluation
countvajhula Apr 9, 2023
de85dcd
at the DSL level, don't move point on paste before
countvajhula Apr 9, 2023
848d514
implement emit backward using the DSL
countvajhula Apr 9, 2023
6daebd1
implement capture-backward in the DSL
countvajhula Apr 11, 2023
45a9787
improve lisp deletion to return a status value
countvajhula Apr 11, 2023
b908e86
handle some low-level exceptions in determining paste padding
countvajhula Apr 11, 2023
2d8a133
enter an empty form in low level "up" motion for consistency
countvajhula Apr 11, 2023
08035f9
Improve command macro to preserve underlying return value
countvajhula Apr 11, 2023
c35f0f4
handle a corner case in multiline emit/capture backward
countvajhula Apr 12, 2023
ee8a8ef
more docs on debugging
countvajhula Apr 12, 2023
16623ce
remove unused emit-backward code
countvajhula Apr 12, 2023
b096dd5
Implement capture-forward in the DSL
countvajhula Apr 12, 2023
da90b58
add new primitive lisp delete
countvajhula Apr 12, 2023
36cad70
use new primitive delete in emit and capture
countvajhula Apr 12, 2023
bb7bc87
handle some edge cases in paste
countvajhula Apr 12, 2023
7c39ba8
refile emit and capture traversal specifications
countvajhula Apr 12, 2023
1a54157
improve docstrings on lisp primitive motions
countvajhula Apr 12, 2023
09c0499
refile lisp primitive delete
countvajhula Apr 12, 2023
24fe966
improve nearest selection
countvajhula May 23, 2023
7f1b8b8
add primitive delete for tree-sitter
countvajhula May 23, 2023
e6ac419
move lisp deletion to the primitive layer
countvajhula May 23, 2023
c27fa39
distinguish primitive (deterministic) vs user-level nearest selection
countvajhula May 23, 2023
633f7ff
remove tree-sitter primitive delete that we don't need
countvajhula May 23, 2023
f68b291
modify primitive delete to work across lisp and tree-sitter
countvajhula May 23, 2023
15279ee
a few comments and docstrings
countvajhula May 23, 2023
f520190
implement `delete` and `delete-backwards` in the DSL
countvajhula May 25, 2023
79ec02b
Make primitive delete (more) deterministic
countvajhula May 25, 2023
6f75191
Note phantom undo stack element issue in tidying
countvajhula May 26, 2023
ce20ce0
fix infinite loop on empty multi-line capture
countvajhula May 27, 2023
c92e0ea
indent `symex--save-point-excursion` the same as `save-excursion`
countvajhula May 27, 2023
cbbf9aa
fix: don't delete more expressions than are there
countvajhula May 27, 2023
c44426c
remove unused primitive
countvajhula May 27, 2023
231d466
Fix hierarchy in DSL paste
countvajhula May 27, 2023
3a530f4
implement `paste` at the DSL layer
countvajhula May 27, 2023
e7ec012
Remove counts and ensure point invariance in lisp primitive paste
countvajhula May 27, 2023
7ad64c4
Simplify DSL-level paste implementation
countvajhula May 27, 2023
f252e06
note a todo on stack memory / eliminating counts in the primitives
countvajhula May 27, 2023
cd54cbb
add a missing import
countvajhula May 27, 2023
1e5bbe4
fix posterior selection after pasting before
countvajhula May 27, 2023
6db6ba1
Fix DSL deletion for tree-sitter
countvajhula May 28, 2023
6f7edcb
remove unused ts delete-backward utility
countvajhula May 28, 2023
77f900e
ts: select neighboring text before attempting to select node
countvajhula May 28, 2023
8320ba8
avoid using the user-level delete command internally
countvajhula May 29, 2023
8a65972
handle deletion more uniformly across lisp and ts
countvajhula May 29, 2023
a11a0be
fix ts current line deletion
countvajhula May 29, 2023
5b8b239
use a common delete-line utility in ts and lisp
countvajhula May 29, 2023
08eab0a
make tidying behavior uniform across ts and lisp
countvajhula May 29, 2023
3d07f52
modularize tidying
countvajhula May 29, 2023
7e4df0b
make emacs indent `symex-save-excursion` the same as `save-excursion`
countvajhula May 29, 2023
713de10
move some generic utilities out of lisp primitives
countvajhula May 30, 2023
0c07f07
have emacs indent `ts-save-excursion` the same as `save-excursion`
countvajhula May 30, 2023
82bf762
move tidying utilities down to primitives
countvajhula May 30, 2023
02ab92a
collect some generic useful operations into utilities
countvajhula May 30, 2023
c63b749
make ts and lisp deletion uniform
countvajhula May 30, 2023
7b22557
lint..
countvajhula May 30, 2023
d9fe7e9
fix following-line-empty predicate
countvajhula May 30, 2023
fb2c296
restore correct(?) default handling of tidying after deletion
countvajhula May 30, 2023
f5a50e0
handle leading whitespace differently in lisp, for now
countvajhula May 30, 2023
5c482bf
Restore handling of another deletion case
countvajhula May 30, 2023
8dcfcab
fix indent in ts paste after
countvajhula May 31, 2023
e194cb8
ensure point invariance in primitive ts paste
countvajhula May 31, 2023
db24bac
truthy return value from primitive ts paste (or DSL assumes it failed)
countvajhula May 31, 2023
6bfd67f
greatly simplify `paste-before`
countvajhula May 31, 2023
c47ae4b
fix recently introduced bug in padding toplevel paste with newlines
countvajhula May 31, 2023
ca34840
Add `effect` form
countvajhula May 31, 2023
e5fb293
disregard result of side effect in traversal execution
countvajhula May 31, 2023
226811f
use name consistently
countvajhula May 31, 2023
8b522fc
Eliminate side effects as a special parameter in the evaluator
countvajhula May 31, 2023
0be8684
include the first execution within "traverse with side effect"
countvajhula May 31, 2023
edc8173
have emacs indent `symex-traversal` better
countvajhula Jun 1, 2023
b51f38d
manipulate kill ring via utilities rather than directly
countvajhula Jun 1, 2023
5f492ec
Fix an old bug in composing computations
countvajhula Jun 1, 2023
72d74de
consistently return a list of moves upon traversal execution
countvajhula Jun 3, 2023
e7c4891
Fixes in Symex's computation model
countvajhula Jun 3, 2023
9b16f73
simplify the default computation
countvajhula Jun 3, 2023
d680f53
Include a few interesting computations
countvajhula Jun 4, 2023
42b2c0e
use a traversal computation to implement a utility and temporarily re…
countvajhula Jun 4, 2023
da0d0c2
implement `symex-index` as a symex computation
countvajhula Jun 4, 2023
92016b1
implement `symex-height` as a computation
countvajhula Jun 4, 2023
d86bcbc
fix remaining-length as not zero-based
countvajhula Jun 4, 2023
843d958
rename a function for consistency with others like it
countvajhula Jun 4, 2023
df965e3
rename "decide" -> "synthesize" in computation model; refile a function
countvajhula Jun 6, 2023
da01fc6
Add `loop` form for conditional recursion
countvajhula Jun 6, 2023
6768e18
Make traversal evaluation tail-recursive
countvajhula Jun 8, 2023
68ed116
Improve traversal specifications to be more explicit
countvajhula Jun 9, 2023
013693a
Add "move delta" computation
countvajhula Jun 9, 2023
3aaba5a
Improve "leap branch" implementation by using traversal computations
countvajhula Jun 9, 2023
f96148d
support pure side effects (i.e. with no accompanying traversal)
countvajhula Jun 9, 2023
c5dcb7c
fix deletion bounds at end of buffer
countvajhula Jul 6, 2023
4a2f06b
improve delete so that kills appear in order
countvajhula Jul 6, 2023
122cadd
fix escapes in `effect` expansion
countvajhula Jul 7, 2023
187cb30
rename kill.. -> delete.. to be consistent with emacs terminology
countvajhula Jul 10, 2023
8b80952
rename a function for clarity
countvajhula Jul 13, 2023
c3b94db
disable blink cursor in symex state
countvajhula Jul 13, 2023
ac49e1d
old wip: kill ring composition
countvajhula Mar 27, 2024
cd34a88
old wip: improve kill ring composition
countvajhula Mar 27, 2024
a3181bf
old wip: catch an error in going to next non-whitespace character
countvajhula Mar 27, 2024
071e792
old wip: compose on the kill ring during deletion
countvajhula Mar 28, 2024
c715ea3
old wip: fixes in paste before/after
countvajhula Mar 28, 2024
9b3af7f
old wip: support including whitespace in primitive symex bounds
countvajhula Mar 28, 2024
a743305
old wip: a more conservative way to delete previous
countvajhula Mar 28, 2024
e303a0a
a comment re: expected paste behavior
countvajhula Mar 28, 2024
f4a47aa
remove fixup-whitespace in primitive delete as it moves point
countvajhula Mar 28, 2024
c7d2c81
simplify symex-remove since symex--remove preserves point
countvajhula Mar 28, 2024
81e13ee
Don't include whitespace separators in calculating symex bounds
countvajhula Mar 29, 2024
353288b
Handle a primitive error in bounds appropriately
countvajhula Mar 29, 2024
6bd23bb
update readme re: expressive power of symex
countvajhula Apr 18, 2024
1f544b9
More conservative whitespace handling in symex bounds
countvajhula May 1, 2024
b5ab5fc
Adjust whitespace when pasting before and after
countvajhula May 1, 2024
475f923
Commit some minor fixes in emit and capture
countvajhula Jun 14, 2024
0ecfca9
Revert to using lisp-specific (paredit) emit and capture for now
countvajhula Sep 18, 2024
6f570bb
move utilities to avoid circular dependency
countvajhula Dec 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add "move delta" computation
  • Loading branch information
countvajhula committed Dec 6, 2024
commit 013693ad819c4b14f74a2970c824d6b6d37586d3
29 changes: 29 additions & 0 deletions symex-computations.el
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,35 @@ separately as absolute (non-negative) values. The results are
concatenated by vector addition and represent how many total up/down
steps and how many total forward/backward steps were taken.")

(defun symex--move-delta-+ (a b)
"Add moves A and B using vector addition accounting for height changes.

The index only participates in the addition when we are at the same
height as the original position."
(let ((x1 (symex--move-x a))
(y1 (symex--move-y a))
(x2 (symex--move-x b))
(y2 (symex--move-y b)))
(let ((x (+ x1 x2))
(y (+ y1 y2)))
(cond ((symex--zero-move-p a) b)
((= 0 y)
;; we're at the height we started the traversal at
;; so it makes sense to add movement in the x-direction
(symex-make-move x y))
(t
;; don't modify the accumulated value of x
;; as we are at a different height
(symex-make-move x1 y))))))

(defconst symex--computation-node-distance
(symex-make-computation :perceive #'identity
:synthesize #'symex--move-delta-+)
"X-axis (forward/backward) and y-axis (up/down) moves are added
separately. The results are concatenated by vector addition. Index
deltas are only added together when at the same height as the original
position.")

(defun symex--traversal-account (obj)
"Represents the result OBJ of a traversal as a traversal."
(cond ((symex-traversal-p obj)
Expand Down
5 changes: 5 additions & 0 deletions symex-data.el
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ forward-backward axis, and the Y or in-out axis."
"Check if two moves M1 and M2 are identical."
(equal m1 m2))

(defun symex--zero-move-p (move)
"Check if MOVE is the zero move."
(symex--are-moves-equal-p move
symex--move-zero))

(defun symex--move-+ (a b)
"Add moves A and B using vector addition.

Expand Down