Repository navigation
RFC: Formatted Comments As Documentation #84
Replies: 25 comments 9 replies
|
Come to think of it, if I used /*!
comments converted to docs
!*/
//*!
code converted to docs
//!*(The empty |
|
Markdown Embedded C Heuristic Analyzer MECHA |
|
https://github.com/Ratstail91/Toy/blob/main/tools/mecha.cpp I have no self-control. It's really getting to be a problem. |
|
Doxygen can use Markdown and can be converted to Markdown: https://www.doxygen.nl/manual/markdown.html |
|
I'm not super fond of the presentation of doxygen - that's my only gripe with it. But if I can use my own MECHA tool to generate markdown, the markdown can be used by both my docs branch and doxygen, correct? I'm going to keep adding MECHA comments, and making small tweaks as I go along to clarify parts of the lang. The docs between our branches will begin to diverge, so I recommend using toylang.com until I'm done, otherwise you might be wasting effort. |
|
Just committed the mecha-style comments, cdfe17a. These work surprisingly well lol. Edit: you can run |
|
I have checked the commit cdfe17a From what I see, the documentation that already exists is transported directly as the header of the functions. For example: /*! void Toy_setInterpreterError(Toy_Interpreter* interpreter, Toy_PrintFn errorOutput)This function sets the function called when an error occurs within the interpreter. By default, the following wrapper is used: static void errorWrapper(const char* output) {
fprintf(stderr, "%s", output); //no newline
}!/ Doxygen style: /**
and can add a lot of tags...if you want (more permissive): https://www.doxygen.nl/manual/commands.html Other structs must to resolve in tables: /** */ (....) resolves in: http://raw.githack.com/hiperiondev/uC-TOY/main/documentation/doxygen/html/dc/dad/toy__opcodes_8h.html Or you can create your own documentation system but you will have to implement many features that already exist in Doxygen. On the other hand, I advise you to review Sphynx for documentation formatting and its use in Readthedocs. Doxygen, Sphynx and Readthedocs is a de facto standard that is widely used in the industry, even the official documentation of many companies is released directly in these formats (for example ESP-IDF: https://docs.espressif.com/projects/ esp-idf/en/latest/esp32/) Sphynx in particular allows for very "pretty" formats and multilanguage handling. |
|
On the other hand Doxygen is very well handled by many IDEs and the header creation is quite automatic (for example in Eclipse you can start a comment with /** and it automatically creates the whole header). I don't use Visualstudio but have a manager for Doxygen: https://marketplace.visualstudio.com/items?itemName=cschlosser.doxdocgen I have added all the comments in this way in a few minutes here: https://github.com/hiperiondev/uC-TOY |
|
Note: The functionality in the comment should be very concise and avoid too many idiomatic forms. |
|
Note2: Doxygen can export in various formats, not just HTML. In particular, a script could be useful to extract the information that serves you from the XML, This software do that: Or this integration: this is an alternative format of documenting: Can you see an example here: https://github.com/hiperiondev/uC-TOY/tree/main/documentation/doxygen/xml |
|
Sorry it's 2am here, so I'm not thinking too well right now. You're right - I basically just copied over the existing docs with a few tweaks here and there, mostly because I've been tired all day, and it was just an experiment. I am trying to be accommodating, but I've personally never liked the doxygen presentation - I just really hate the way it looks lol. I'm not sure this experiment is really going anywhere. I'm gonna leave the docs issue for a couple days and sort it out on the weekend maybe. |
13:50 here (Argentina UTC -3) |
|
@hiperiondev BTW, the deep-dive section on the site has been revised. In particular, you might be interested in Developing Toy which will eventually document everything I can about the implementation. What about the lang would you like to know more about? The interpreter, specifically? |
|
To improve performance and memory consumption I would need a deep explanation of the interpreter and internal data representation (like the LUA VM documentation I gave you). |
|
For example: |
|
Ah, ok. This only occurs once for each function/hook, and usually only at the start of the program. As for how it works, I'll start soon, though I can't guarantee a full write up anytime soon. |
|
No problem. I understand that documenting the entire operation of the interpreter is quite long and tedious. It is important to optimize several things because I am already noticing a large memory consumption (from the point of view of a microcontroller, of course) |
|
A disassembler would be an excellent tool to start with. |
|
To disassemble the bytecode? huh... There is an option within the repl to parse the bytecode's header (the I need to document the bytecode first, which is gonna be a challenge. |
|
You can't optimize the interpreter if you don't know what it interprets :-) |
|
The bytecode names should ideally specify what is happening. |
|
You'd be up for making a disassembler? That is something I'm interested in. The individual I'll see what I can do for documenting the bytecode. |
|
I recommend another book for a boring weekend, it is quite old but very educational: After this you will love the FORTH language :-) You can see an example of a compact machine here: I made it a long time ago and it has a 2-step assembler and a disassembler |
|
Another good read: https://barrgroup.com/embedded-systems/books/embedded-c-coding-standard |
|
@hiperiondev Hey, sorry things have been going slow on the documentation side of things. I'll try getting some basic writeups of each opcode done tomorrow. What I've done so far is here. |
Uh oh!
There was an error while loading. Please reload this page.
Inspired by a comment from @hiperiondev, I'm thinking about reworking how my documentation system is set up.
Currently, I'm using https://toylang.com as the primary source of documentation, with liberal application of comments within the code itself. However, I'm considering reworking this so that the website actually derives it's content from formatted comments within the code.
An example would be like so:
Which, when scanned, would produce markdown like this:
The exact specification is currently vague, but it would likely plug into the existing github pages system.
Potential
While I initially investigated doxygen for this purpose, I felt that it was a little ugly by my preferences, and that I prefer a markdown-based approach (which can then be plugged into ghpages, as normal). A custom tool could be built into the toolchain...
Concerns
I'm aware of Not Invented Here Syndrome, and I'd like to avoid that - but the power of custom features is very enticing.
All reactions