dis.ex

source/dis.ex

dis.ex is a utility for analyzing euphoria programs. It can output the generated IL code for your program, the symbol table, and also document the structure of your program in a fashion somewhat similar to Doxygen, including graphs to show how files are included in your program, and the call graphs of the routines in your program.

It's orginal purpose was to show the disassembled IL code for a program. This can be useful for development activity of the interpreter or translator, or for optimizing euphoria code.

Go to http://www.graphviz.org to get graphviz. make sure graphviz/bin is in your path or make a batch to call it.

$ dot -V 
should get something like: 

dot - Graphviz version 2.20.2 (Mon Jul 7 20:50:29 GMT 2008)

Example Run

exwc EU4\source\dis app --html -g -d appdis 

To see the graphs start appdis\index.html

Breakdown of the command line shown above:

  • dis is just dis.ex (located in the source dir)
  • app is your app
  • --html tells it to give you html output
  • -g suppresses all of the call graphs (this can take a long time, and I don't think you're really interested in this)
  • -d appdis tells dis to put its output in the appdis subdir (whichwill be created if necessary).
  • By default, it filters out the standard library. You can add the '-s' option to include information on the standard library. Basically, it just looks to see if "std/" is in the path of the file.

Once it's finished, go into the appdis dir, and look at index.html. It will give you a giant diagram of all of the includes in your app. You can click on the file links on the left to see just the details for a specific file (i.e., which files included it, and which files it included).

Command Line Options

  • -d [directory] specifies an output directory different than the current directory
  • --html dis.ex will generate html output documenting the structure of your program
  • -f [file] Include this file in the --html output. (This needs to be better documented....)
  • -g Suppress call graphs. When passed with the --html option, this causes the call graphs for routines in the program to not be generated. For a large program, this can save a lot of time.
  • -p Supress dependencies. If the --html argument is passed, this option will cause dis.ex to not generate the graph of include files
  • -s Show standard library information. By default, if the --html argument is passed, any files or routines from the standard library are omitted. This option includes the standard library in the output.
  • -t Translator mode. The program is parsed in translator mode.

Hello, World

This is a sample of the disassembly output of dis.ex for a simple euphoria program:

-- hello.ex
    puts(1, "Hello, World!\n")

Run dis.ex:

$ exwc dis hello
The output is put into hello.ex.dis:
SubProgram [hello.ex-_toplevel_:00132]
     1: 044 133 135                      # PUTS: [LIT 1:133], [LIT "Hello, World!\n":135]
     4: 034                              # RETURNT:
End SubProgram [_toplevel_:00132]

The output is divided into SubPrograms, which are euphoria routines (plus one for top level code, seen here). The left side shows the raw IL code, with the address first. The right side provides the disassembled output for the IL code. Variables, literals and temporary variables are shown in square brackets, and the final number after the colon indicates their location in the symbol table (see ~hello.ex.sym for the dump of the symbol table).

Search



Quick Links

User menu

Not signed in.

Misc Menu