Historical forum-msg-id-137037-edit, Revision 4

Original date:2022-09-21 10:20:08 Edited by: petelomax Subject: Re: Allegro Wrapper?

ghaberek said...

Right now ... I need better tools to visualize the Euphoria source code, intermediate language, and symbol table to better understand how everything works,

Indeed, having a visual display of the parse tree proved very helpful when writing the transpiler, and to a lesser/shorter term extent the token list.
It was not particularly difficult either, while this is phix and in fact p2js-specific, the main bit of code ended up being just

            elsif what="PARSETREE" then 
                sequence tree_nodes = treeify(ast) 
                if tree_dlg=NULL then 
                    tree = IupTreeView(tree_nodes) 
                    IupSetCallback(tree, "SELECTION_CB", Icallback("selection_cb")) 
                    tree_dlg = IupDialog(tree) 
                    IupSetAttribute(tree_dlg,"TITLE","Parse Tree") 
                    IupSetCallback(tree_dlg, "CLOSE_CB", Icallback("close_sub_cb")) 
                end if 
                IupConfigDialogShow(config, tree_dlg, "ParseTree") 

The treeify() function is a fairly trivial (and very p2js-specific) munging into a more consistent structure, and
IupTreeView()/IupTreeAddNodes() were specially written for phix, but probably quite nickable.

Not Categorized, Please Help


Quick Links

User menu

Not signed in.

Misc Menu