hy icon indicating copy to clipboard operation
hy copied to clipboard

GUI based internals debugger

Open paultag opened this issue 11 years ago • 3 comments

Allow for a curses base debugger that allows debugging of Hy code via an interactive pane-based explorer -- allow "stepping" through Hy code, and highlighting portions of HST, AST and Python that relate to the segment. Perhaps also show macros that've touched the code.

I plan to replace hy2py with this. Branch @ paultag/hy/paultag/refactor/debugging

paultag avatar Jul 07 '13 16:07 paultag

This is interesting.

Do you have a model for this? And do you think there will be the chance to abstract away the GUI bits so there might also be a PySide version possible? Not asking you to write that one, just thinking about the possibilities.

rwtolbert avatar Jul 07 '13 18:07 rwtolbert

Sure, that sounds totally cool. The major bits of work aren't so much the problem, since it's just invoking code in the importer, we have routines for what I've got in mind.

Something a bit more fancy than:

+------------------------------------+----------------------------------------+
| (print (if true                    | [(u'print' (u'if' u'True'              |
|          (do (+ 1 1) true)         |   (u'do' (u'+' 1 1) u'True')           |
|          (do (+ 2 2) false)))      |   (u'do' (u'+' 2 2) u'False')))]       |
+------------------------------------+----------------------------------------+
| Module(body=[                                                               |
| If(                                                                         |
|   test=Name(id='True', ctx=Load()),                                         |
|   body=[                                                                    |
|       Expr(value=BinOp(left=Num(n=1), op=Add(), right=Num(n=1))),           |
|       Assign(targets=[Name(id='_hy_anon_var_1', ctx=Store())],              |
|              value=Name(id='True', ctx=Load()))],                           |
|   orelse=[Expr(value=BinOp(left=Num(n=2), op=Add(), right=Num(n=2))),       |
|           Assign(targets=[Name(id='_hy_anon_var_1', ctx=Store())],          |
|               value=Name(id='False', ctx=Load()))]),                        |
|           Print(dest=None,                                                  |
|               values=[Name(id='_hy_anon_var_1', ctx=Load())], nl=True)])    |
+-----------------------------------------------------------------------------+
| if True:                                                                    |
|     (1 + 1)                                                                 |
|     _hy_anon_var_1 = True                                                   |
| else:                                                                       |
|     (2 + 2)                                                                 |
|     _hy_anon_var_1 = False                                                  |
| print _hy_anon_var_1                                                        |
+-----------------------------------------------------------------------------+

with some sort of highlighting, and being able to trace back where stuff came from (etc)

paultag avatar Jul 07 '13 18:07 paultag

I'd also like a web-UI based one too, so when running from git, we can enable a feature to drop a Compiler error into a Flask server with a full report of what's going on :)

paultag avatar Jul 07 '13 18:07 paultag

This is probably outside the scope of Hy itself at this point. Maybe if someone decides to make it, they can add any necessary support code to Hy.

Kodiologist avatar Nov 12 '23 18:11 Kodiologist