-
Notifications
You must be signed in to change notification settings - Fork 39
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
debug: implement treeRepr()
for PNode
#191
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One typo, looks good to me.
7055da7
to
ecbc5a6
Compare
No longer valid, all suggestions have been fixed.
ready to be merged |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@haxscramper did a review, sorry I'm a little off today. But I hope the feedback is useful. Let me know if you have any concerns.
This is incredible by the way, we can teach people now. It's bonkers how fast we got here.
doc/debug.rst
Outdated
|
||
Both *compiler* and and your file must be compiled with defines - main | ||
compiler requires `nimDebugUtils` (this guard exists to avoid heavy | ||
performance hits), and your test compiler need to be run with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
performance hits), and your test compiler need to be run with | |
performance hits), and your file needs to be compiled with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, it means that main compiler compiles tests compiler, there is no error. Previous suggestion removing main
is also incorrect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know how to word this properly, but considering we are compiling the compiler to compile the file there is bound to be some weird phrasing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then I need to follow through the instructions again, because I'm not getting the mechanics.
I would think we'd want to flip switches (defines) that would produce a test compiler that'll output all the things. Then when we go to use that test compiler we provide more switches (defines) that would control the output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding is:
- Create a compiler that knows to trace (compile a test compiler with defines)
- Use the test compiler created in the prior step to compile your program with tracing parameters to control the output
ecbc5a6
to
c8661b4
Compare
doc/debug.rst
Outdated
Both *compiler* and your file must be compiled with defines - *main* | ||
compiler requires `nimDebugUtils` (this guard exists to avoid heavy | ||
performance hits), and your *test* compiler need to be run with | ||
`nimCompilerDebugCalltrace` to control what exact parts of the default | ||
debugger will be executed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both *compiler* and your file must be compiled with defines - *main* | |
compiler requires `nimDebugUtils` (this guard exists to avoid heavy | |
performance hits), and your *test* compiler need to be run with | |
`nimCompilerDebugCalltrace` to control what exact parts of the default | |
debugger will be executed. | |
Both *compiler* and your file must be compiled with defines. The | |
compiler must be built with `nimDebugUtils` (this guard avoids heavy | |
performance hits). Your file must be compiled with | |
`nimCompilerDebugCalltrace` to control which exact parts of the | |
default debugger will be executed. |
- ADD implementation of the `treeRepr()` proc for the `PNode`, placed in the new `utils/astrepr` file. New file was added to avoid mixing "ast algorithms" with "debug printing". - ADD New overload for `addInDebugUtils` - `PNode -> PSym` trace. This was necessary to write an example on fixing a specific bug. - FIX/ADD return support for AST printing output in the sem trace - it was present before structured report refactor but then got removed. Not it is back again. - REMOVE old implementaiton of the `debug` calls - their functionality is fully replaced by the new `treeRepr()` - REMOVE implementation of the `treeToYaml` converter - their functionality has been fully replaced with the `treeRepr()` which also has almost identical representation. They were not used anywhere in the compiler or tests, so it would be easy to assume they were not used for anything besides debugging. - DOC add example of the updated sem tracer. Move the 'compiler debugging' documentation to a separate file - it is already pretty long and does not really fit into 'compiler architecture' that is `intern.rst`
c8661b4
to
e30fd1e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bors r+
🎉
Build succeeded: |
debug: implement
treeRepr()
forPNode
treeRepr()
proc for thePNode
, placed inthe new
utils/astrepr
file. New file was added to avoid mixing "astalgorithms" with "debug printing".
addInDebugUtils
-PNode -> PSym
trace. This wasnecessary to write an example on fixing a specific bug.
present before structured report refactor but then got removed. Not it is
back again.
debug
calls - their functionality isfully replaced by the new
treeRepr()
treeToYaml
converter - their functionalityhas been fully replaced with the
treeRepr()
which also has almostidentical representation. They were not used anywhere in the compiler or
tests, so it would be easy to assume they were not used for anything
besides debugging.
documentation to a separate file - it is already pretty long and does not
really fit into 'compiler architecture' that is
intern.rst
Remaining todo items:
treeRepr
for the PSym and PType