Next: , Up: Commands


3.1 Built-in Commands

The following commands are listed in the builtin category.

— Command: help cmd

Help on command or category cmd. ‘help all’ gives a list of all commands available in all categories. ‘help help’ tells you how to use help.

— Command: echo args ...

Prints the arguments back to stdout.

— Command: # ...
— Command: comment ...

Whole line comment, ignored by interpreter.

— Command: exit
— Command: quit

Exit the simulator.

— Command: abort

Exit the simulator with a fatal (non-zero) exit status.

— Command: precision [n]

Sets the precision of real-valued numbers to be printed. Without an argument, this command just reports the current precision.

— Command: repeat n cmd...

Repeat a command cmd a fixed number of times, n. If there are any errors in during command processing, the loop will terminate early with a diagnostic message.

— Command: meas-time cmd...

Reports time spent in a command.

— Command: interpret

Open an interactive subshell of the interpreter, by re-opening the standard input stream. This is useful when you want to break in the middle of a non-interactive script and let the user take control temporarily before returning control back to the script. The exit command or Ctrl-D sends the EOF signal to exit the current interactive level of input and return control to the parent. The level of shell is indicated by additional > characters in the prompt. This works if hacprsim was originally launched interactively and without redirecting a script through stdin.

          $ hacprsim foo.haco
          prsim> !cat foo.prsimrc
          # foo.prsimrc
          echo hello world
          interpret
          echo goodbye world
          prsim> source foo.prsimrc
          hello world
          prsim>> echo where am I?
          where am I?
          prsim>> exit
          goodbye world
          prsim> exit
          $

The following command is useful for showing each executed command.

— Command: echo-commands arg

Enables or disables echoing of each interpreted command and tracing through sourced script files. arg is either "on" or "off". Default off.

The following commands pertain to command aliases.

— Command: alias cmd args

Defines an alias, whereby the interpreter expands cmd into args before interpreting the command. args may consist of multiple tokens. This is useful for shortening common commands.

— Command: unalias cmd

Undefines an existing alias cmd.

— Command: unaliasall

Undefines all aliases.

— Command: aliases

Print a list of all known aliases registered with the interpreter.

The following commands emulate a directory like interface for navigating the instance hierarchy, reminiscent of shells. By default, all instance references are relative to the current working directory, just like in a shell. Prefix with ‘::’ to use absolute (from-the-top) reference. Go up levels of hierarchy with ‘../’ prefix. The hierarchy separator is ‘.’ (dot).

— Command: cd dir

Changes current working level of hierarchy.

— Command: pushd dir

Pushes new directory onto directory stack.

— Command: popd

Removes last entry on directory stack.

— Command: pwd

Prints current working directory.

— Command: dirs

Prints entire directory stack.

Shell commands may be executed by prefixing a line with '!'. For example, ‘!whoami’.

New: Block comments are pseudo C-style, using /* and */ to enclose comments. It is recommended to start use block-comment delimiters on their own lines to avoid confusion. The line parser is very crude. Nested comments are supported. Files with unterminated comments will be reported as errors. #-comments are allowed within block comments.