.c .y.h HOW TO USE VAX-11 TPARSE .W Douglass J. Wilson Neal Lippman M.I.T. Joint Computer Facility .s .c.y.h TPARSE Features .x.w o Callable from all languages o Table driven - fast, alterable o Supports abreviations o Substates for modularity .s .c.y.h Finite State Concept .$(0 .X.W lqqqqqk xBEGINx lqqqqqqqk mqqqwqj lqqqqqqqquSTATE 2x lvqqqqvqk mwqqqqqwj xSTATE 1x x lvqqqqqk mqwqqqqqj / xFINISHx x / x FAIL x x x mqwqqqqj x lqqqqqvqk x x xSTATE 3tqqqqqqj x mwqqqqqwj lqqqvqqqk x mqqqqqqqk xSTATE 4tqqj lqqvqqqqk mqqqqqqwj xFINISH x mqqqqqqqqqqqqqquSUCCESSx mqqqqqqqj .$(B .s .c .y.h Parameters For $TRAN Macro .x.w o Type - Tparse condition to be fufilled o Dest - Destination state name. If blank then next state o Action - Name of an action routine to be called before the transition .s .c .y.h Parameters For $TRAN Macro .x.w o Mask - Value to be OR'd with the contents of Maskaddr o Maskaddr - Address to or the mask into o Parameter - Value to be placed into TPA$L_PARAM before call to the action routine .s .l .c.y.h Fundamental Token Matches .w.x char - any single quoted character ('x') TPA$_ANY - any single character TPA$_ALPHA - any character A-Z or a-z TPA$_DIGIT - any numeric character TPA$_STRING - any string using A-Z, a-z, 0-9 TPA$_SYMBOL - any string using A-Z, a-z, 0-9, $, _ TPA$_BLANK - any string of blanks and/or tabs .s .c.y.h Fundamental Token Matches (con't) .w.x TPA$_DECIMAL - any decimal number TPA$_OCTAL - any octal number TPA$_HEX - any hexadecimal number 'xyz' - matches the string 'xyz' TPA$_LAMBDA - the empty string ("goto") TPA$_EOS - matches the end of the input string !label - subparse using state table "label" .s .c.y.h Requirements/Action for Transition .x.w o Match between transition type and current token o On a match, the action routine will be called o Routine must return low bit set to compete transition o Predefined symbols TPA$_EXIT and TPA$_FAIL o Mask will be OR'd into mask addr o Control passed to destination (label) in state table .s .c.y.h Data Structures for TPARSE .$(0 .x.w lqqqqqqqqqqqqqk x TEXT STRING x mqqqqqqqqqqqqqj /\ lqqqqqqk xx xSTATE x xx lq>x TABLEx xx x mqqqqqqj \/ x lqqqqqqqqqqqqqqqqk x lqqqqqqqk x LIB$TPARSE xx TABLE x x INTERPRETER x command input done by TPARSE state table instead of user's program .s .c.y.h TPARSE Utility Library .x.w Indirect command file processing: Provides an action routine to set up indirect command files. Other input routines automatically handle processing command files and returning to outer levels on end of file .s .c.y.h TPARSE Utility Library .x.w Token storing action routines: Routines to store tokens (string and numeric) at user-specified addresses. Error handling: Routine to output an error message specified by message-compiler message number Routine to format information in TPARSE parameter block to provide "backslashification" on invalid token .s .c.y.h Effects on State Table coding .x.w o Requires TPA$_EOS transitions for command line input and additional command input o Use of TPA$L_PARAM field requires that "optional" arguments to input routines are actually specified as zero (or, all action routines must zero TPA$L_PARAM field before returning) o Use of exit_flag or exit_routine for image exit (target of second TPA$_EOS transition in main state table) .s