-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Colored printing of code_llvm
and code_native
#36634
Comments
Beautiful printing with such a minimal code, @kimikage! As a general idea, it might be useful for Having said that, maybe syntax highlighting for LLVM/ASM is simple enough to live in InteractiveUtils? |
BTW, as a more minimal improvement, there is also an option to change the color of comments only. As for x86 ASM, I'm quite happy with that. However, as for LLVM IR, it is still difficult to read. 😅 |
I can't decide if the highlighting feature should be in You can see the examples in the GitHub Actions log. Also in the Travis CI log, I welcome your issue reports. |
I think it is a good design for However, my concern is that the internal data displayed by Also, improvements in One of drastic measures is to support portable AST objects for multiple languages, but I think that is beyond the responsibility of I'm still deciding what to do in this repository. Edit: |
Would love to see this in InteractiveUtils
Perhaps then just open a PR with the current change? That doesn't rule out future improvements and until then users can enjoy syntax highlighting 😃 |
I am in the process of writing test code for LLVM IR. (I wrote the minimal test sets for x86/ARM ASM.) After that, I plan to submit a PR to port the functionality to I seriously considered maintaining the code in |
|
cf. https://discourse.julialang.org/t/why-are-code-llvm-and-code-native-not-displayed-in-color/42959
Recently, the display of stack traces has become colorful (cf. issue #36026, PR #36134). I also think it is helpful to make the output of
code_llvm
andcode_native
colorful.Unregistered package ColorfulCodeGen.jl provides the functionality (thanks to @tkf). However, the ColorfulCodeGen.jl uses an external tool Pygments.
I wondered if huge lists of keywords and/or complicated parsers were needed to color the automatically generated LLVM IR or native assembler codes. So I tried to implement it. You can copy & paste the following PoC to your REPL (Julia v1.4 or later).
Edit: You can get the slightly improved version and
code_native
version via ColoredLLCodes.jl package now.PoC for `code_llvm`
Note that the
code_llvm
andcode_native
are defined inInteractiveUtils
(stdlib), notBase
. Also, please do not start a bicycle shed discussion on color schemes before we have a firm idea of where and how to implement this feature. 😅I can continue to improve the PoC in a separate package, but the value of such a heuristic approach (i.e. the motivation) will be diminished.
The text was updated successfully, but these errors were encountered: