LC-3 doctests #171
Labels
📚 docs
Documentation related things
good first issue
Good for new contributers!
help wanted
Extra attention is needed
➕ improvement
Chores and fixes: the small things.
🔧 infra
Project infrastructure, meta, dev-ex, etc.
P-low
Low priority
what
Some of our documentation (mainly
lc3-os::trap
) is really documenting parts of the LC-3 user interface and we would like to paper over the fact that the underlying doc tests are actually Rust code. It would also be nice to have therun
button on examples actually let students run TRAP examples in thetui
.We should:
doc(alias = "...")
to provide some aliases for trap names that users might search for (i.e.println
,printf
forPUTS
, etc.)ARM Assembly,rust
) are accepted and still are picked up as doctests byrustdoc
but the extra tags have to effect on the formattinglc3-os
crate where we don't have any other doctests we can live with overriding the Rust format definition, globally and:rustdoc
does give us hooks to add in our own HTML/CSSmdbook
which uses ace.js and highlights code on the "client side" —rustdoc
lexes doc example code and associates tokens with css classes at build time instead of using a JS syntax highligherdefine
macro or something like it wrap our trap examples in the necessary Rust foo to get the examples to actually be run (or if it ends up just being a macro liketrap_test! { ... }
we can just add the invocations with#
s + HALTs at the end, etc.; maybe even assertions to check)program!
style macros@
for labels) since this makes it so thatrun
won't work (and nor will copy-pasting examples into an assembler/the TUI)TRAP 0x36
as it would regular rust coderustdoc
actually highlights both of these the same way so there's not really a compelling reason to prefer option 3 over option 2run
button on examples send users toweb.utp.tools
and be able to run and debug their example?code=...
and knows to strip out the#
lines, etc.#![doc(html_playground_url = ."..")]
in the os crate to get rustdoc to do the thing hereEventually, when we write some
mdbook
s for the project, we'll want similar infra (but there we can do this as an mdbook plugin that, for example, picks out code blocks with a tag likeLC3
, and rewrites them + adds in the LC-3 test wrapping goop; we can also have aneditable
block and can support highlighting LC3 code correctly ourselves by introducing an ace.js syntax definition for it).steps
where
branch:
imp-lc3-doctests
open questions
The above talks about how we might do this but there's still lots to figure out!
The text was updated successfully, but these errors were encountered: