mini toplevel

Top-Level Commands

Top-level commands are commands that are outside of any subroutine. They are immediately processed when encountered in the source file. They are:

include <filename> -- reads in another Euphoria source file at this point 
with         -- turns on 
without      -- turns off  
             -- one of the options: profile, trace, warning, type_check 
profile -- outputs an execution profile for statements compiled 
		-- "with profile" -- produces a file: 

In addition, any Euphoria statements or declarations can appear at the top level, except for a return statement. They will be immediately executed. If you have a main routine, you must explicitly call it to start your program running.


Each file included in a main program can be given a namespace which is used clear up conflicting identifier names. Here the namespace prefix is included as a reminder that for console:display you must to write include std/console.e first; usually we just write display .


As with any language, you can debug by inserting print statements, and this is easy with an interpreted language like Euphoria where you do not have to recompile and relink.

On top of this, Euphoria provides a debug/trace facility that is activated by the trace(1) command. First you select the statements that you want to be traceable, by placing a with trace command in your code (outside of any subroutine). You could simply put it at the start of your file so everything is traceable. Then you insert a trace(1) statement into your code at the point where you want tracing to begin. When the trace(1) is executed, your screen is saved and a trace screen appears. Hit Enter to single-step through your program, and watch as variable values are updated at the bottom of the screen. Hit q to quit tracing. Press F1 then F2 to flip to the main screen to view your program's output. Down-Arrow will skip over subroutine calls and break out of repetitive loops. ? will let you display a particular variable's value. Control-c will abort the program.


Quick Links

User menu

Not signed in.

Misc Menu