######################################################################## ## INFO INFO INFO INFO INFO INFO INFO INFO INFO INFO INFO ## ######################################################################## PACKAGE : mkscan CONTENTS : UNIX shell script to create flex scanner modules for MuPAD AUTHOR : Andreas Sorgatz (andi@uni-paderborn.de) STATUS : tested with MuPAD 1.22, 1.3, 1.4.0 SYSTEMS : UNIX (Sun, SGI, HP, IBM/RS6000,...) INSTALLED: 17.04.1998 What is it for? --------------- This script generates a dynamic scanner module for MuPAD by using the scanner generator (f)lex. To create a scanner named 'x', a (f)lex input file 'x.l' is needed. The scanner module will provide the following interface functions: x::open( file ) -- Opens file 'name' for scanning (==> DOM_BOOL ) x::close() -- Closes the current file (==> DOM_NULL ) x::token() -- Returns the next token (==> DOM_INT ) x::text() -- Returns the text of the token (==> DOM_STRING) x::line() -- Returns the current line number (==> DOM_INT ) x::back() -- Put back the last token (==> DOM_BOOL ) Dynamic modules are not documented in the MuPAD user's manual. An English reference manual will be available in summer 1998. If there are any problems or questions, please contact andi@uni-paderborn.de How to install it? ------------------ Just copy the UNIX shell script 'mkscan'. How to use it? -------------- Execute the shell script 'mkscan' with a (f)lex input file as its argument: USAGE: ./mkscan [-c] name -c : create the complete module source code, but do not compile it name : name of a (f)lex input file, without the suffix '.l' Tokens are non-negative integers. x::token() returns the token 0 when the end of the input file is reached. The following example 'demo.l' defines a very simple scanner 'demo', which allows to count the lines of an input file. Call './mkscan demo' to generate the scanner module: %{ enum { EOFILE=0, UNKNOWN=1, LINE=2 }; %} nline [\n] %% {nline} { return( LINE ); } %% The dynamic scanner module 'demo.mdm' will be placed in the current working directory and can be used within a MuPAD session: >> module( "demo" ): >> demo::open( "demo.l" ): >> l:=0: while demo::token()=2 do l:=l+1 end_while: l; >> demo::close(); The dynamic scanner module 'demo.mdm' will be placed in the current working For further information refer to the (f)lex manual and the files 'demo.yy.c' and 'demo.C' created by 'mkscan'. Known bugs ---------- ######################################################################## ########################################################################