Post Reply 
monic part 6: the mC programming language and compiler
01-28-2022, 10:20 AM
Post: #7
RE: monic part 6: the mC programming language and compiler
I've written a debugger that supports single-stepping through the source code. The parser creates two bytecode programs - one for execution ("release") and the other for debugging ("debug"). The debug bytecode program contains instructions that halt execution and enable debugging.

As an example, suppose one wishes to step through the program to calculate 5!:

[Image: 51847618123_b194e38cf0.jpg]

The debugger is comprised of the following screens:

1. Source code with arrow pointing at the line to be executed next:

[Image: 51847557446_7ed21d8c7d.jpg]

2. Stack with the line to be executed next at the top:

[Image: 51846583922_8676dd2572.jpg]

3. Global variables with the line to be executed next at the top. The image below gives the values of the variables after stepping through the while loop once:

[Image: 51847613953_95d24082f4.jpg]

4. Parameters with the line to be executed next at the top (not yet active).
5. Local variables with the line to be executed next at the top (not yet active).

6. "Release" bytecode with arrow pointing at the line to be executed next:

[Image: 51847875319_2b2a99fc88.jpg][Image: 51847555326_a90f3971c5.jpg]

7. "Debug" bytecode with arrow pointing at the line to be executed next:

[Image: 51847615023_0cdb0c21f5.jpg][Image: 51847614458_b5aa2660f9.jpg]

Pressing "step" executes a line of the C source code and the user can see which corresponding bytecode instructions are executed in the bytecode debugging screens.

After pressing "step" once more at the end of the program we return to the home screen. The result is on stack level 1:

[Image: 51848200450_80f63589dd.jpg][Image: 51847871149_99186b1df9.jpg]

The C language combines all the power of assembly language with all the ease-of-use of assembly language
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: monic part 6: the mC programming language and compiler - F-73P - 01-28-2022 10:20 AM



User(s) browsing this thread: 1 Guest(s)