Page 1 of 1

Cobra Compiler WinForms Explorer

PostPosted: Sat May 31, 2008 12:51 am
by Charles
I want to explore the objects in the compiler interactively rather than imagining what their values are by interpreting the code, or sprinkling print/trace statements here and there. Consequently, I've added a WinForms window that let's one browse through the compiler, modules, namespaces, declarations, statements, expressions, etc. These are .NET objects, so what you're seeing are their properties (names and values). For properties that have complex values (e.g., another interesting kind of object), you can drill down via the tree view.

You can use this out of a workspace. See http://cobra-language.com/source/ on how to get one.

In CobraWorkspace\Source, use "win-comp" to build and "cobra-win hello.cobra" to run.

See WinFormsExplorer.cobra for doc string and implementation.

It's not very impressive yet as I just got started today, but once we knock out the TO DO items in the doc string, I think it will be very useful. Also, it's fairly generic right now. It might be possible to break it out as a general tool.

-Chuck

Re: Cobra Compiler WinForms Explorer

PostPosted: Sun Jun 01, 2008 2:40 am
by Charles
I've made the following improvements:

Tree view on the left:
-- Sort the properties alphabetically.
-- Display the contents of lists.
-- Display the contests of dictionaries.
-- Add the CommandLine instance.

Details view on the right:
-- Show the type, serial number and name of the currently chosen object.

Other:
-- Add the current navigation path to the top of the form.
-- Added new button strip with: Copy, Next, Quit, Reset
-- Fix window positioning.
-- Minor fixes.
-- Refactor code: break out ObjectExplorer
-- Code cleanup.

Although the Object Explorer is quite capable now, I think having a search capability is going to be key to making this a productive tool. Forthcoming.

Re: Cobra Compiler WinForms Explorer

PostPosted: Sun Jun 01, 2008 2:42 am
by Charles
And here's a screenshot.

Re: Cobra Compiler WinForms Explorer

PostPosted: Wed Jun 11, 2008 10:03 pm
by Charles
Improvements checked into Subversion:

-- Add a search feature
-- Add a "Key / Value" tab on the right with a Cobra-centric display
-- Break the Object Explorer out to a separate .cobra file so it can be used from any program
-- Add a doc string up top with instructions on usage
-- Minor fixes and refinements

This is what I'm using now to examine objects in the compiler when I fix bugs.