samiam95124 / Pascal-P6

6th version of Niklaus Wirth's original Pascal language compiler system
Other
28 stars 9 forks source link

5/3: VSCode integration #29

Open samiam95124 opened 1 year ago

samiam95124 commented 1 year ago

VSCode is rapidly becoming the premier coding editor for programmers. Thus it makes sense to consider it as a target for an IDE for Pascal-P6. The good news is that VSCode appears to have a good set of integration strategies and plug-ins for language adaption. See for example:

https://code.visualstudio.com/docs/editor/tasks https://code.visualstudio.com/api/language-extensions/syntax-highlight-guide https://code.visualstudio.com/api/extension-guides/debugger-extension

As in the order above, the main tasks to be accomplished are:

  1. Integrating the build environment so that builds are kicked off (say when run is hit).
  2. Highlighting, coloring, folding and even syntax dynamic checking.
  3. Debugging.

1 is a the simplest of these, and I have done this for other projects (Petit-ami). It just involves creating a task file.

2 is more complex, but previous Pascal implementations (FPC) can be used for this.

3 is the most interesting task, because the best target for this is the debug mode in pint. The debugger can be hooked to gdb/lldb, but this would be the least capable implementation, since there would be considerable work to adapt the symbol and other conventions to gdb/lldb. This can be done as a second option.

One factor is the upcoming integration of the pc (Pascal compile) integration tool from IP Pascal. This considerably changes the nature of Pascal-P6 builds from scripts/makefiles.

samiam95124 commented 1 year ago

Note: Alessandro Fragnani's extention works for syntax coloring/folding:

https://marketplace.visualstudio.com/items?itemName=alefragnani.pascal

Too bad it doesn't also print in color.

samiam95124 commented 1 year ago

Features I would expect from this:

  1. Ability to place breakpoints in source.
  2. Ability to place tracepoints in source.
  3. Stack frame dump when program is stopped.
  4. Stop/run/step/stepover and stepout/ret/step to cursor capability.
  5. Ability to show variable contents by rollover.
  6. Ability to place a watch on a variable.
  7. Ability to dump the machine and source level trace buffers.
  8. Ability to show profiling.
  9. Ability to edit variable contents.
  10. Ability to access debugger shell.

Also would be nice to have machine level features, like register dumps (pc/sp/mp/ep), memory dumps, stack dumps, etc.