Tcl Library Source Code

Documentation
Login


[ Main Table Of Contents | Table Of Contents | Keyword Index | Categories | Modules | Applications ]

NAME

grammar::me::cpu - Virtual machine implementation II for parsing token streams

Table Of Contents

SYNOPSIS

package require Tcl 8.5 9
package require grammar::me::cpu ?0.3?

::grammar::me::cpu meName matchcode
meName option ?arg arg ...?
meName lc location
meName tok ?from ?to??
meName pc state
meName iseof state
meName at state
meName cc state
meName sv
meName ok
meName error
meName lstk state
meName astk state
meName mstk state
meName estk state
meName rstk state
meName nc state
meName ast
meName halted
meName code
meName eof
meName put tok lex line col
meName putstring string lvar cvar
meName run ?n?
meName pull nextcmd
meName reset
meName destroy

DESCRIPTION

This package provides an implementation of the ME virtual machine. Please go and read the document grammar::me_intro first if you do not know what a ME virtual machine is.

This implementation provides an object-based API and the machines are not truly tied to Tcl. A C implementation of the same API is quite possible.

Internally the package actually uses the value-based machine manipulation commands as provided by the package grammar::me::cpu::core to perform its duties.

API

CLASS API

The package directly provides only a single command for the construction of ME virtual machines.

OBJECT API

All ME virtual machine objects created by the class command specified in section CLASS API support the methods listed below.

The machines provided by this package provide methods for operation in both push- and pull-styles. Push-style means that tokens are pushed into the machine state when they arrive, triggering further execution until they are consumed. In other words, this allows the machine to be suspended and resumed at will and an arbitrary number of times, the quasi-parallel operation of several machines, and the operation as part of the event loop.

Bugs, Ideas, Feedback

This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category grammar_me of the Tcllib Trackers. Please also report any ideas for enhancements you may have for either package and/or documentation.

When proposing code changes, please provide unified diffs, i.e the output of diff -u.

Note further that attachments are strongly preferred over inlined patches. Attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar.

KEYWORDS

grammar, parsing, virtual machine

CATEGORY

Grammars and finite automata

COPYRIGHT

Copyright © 2005-2006 Andreas Kupries