home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
archives
/
mtsplus.tar.gz
/
mtsplus.tar
/
mtskerm.sr
< prev
next >
Wrap
Text File
|
1984-09-10
|
13KB
|
275 lines
/title "KERMIT Grammar"
-- Author : Bruce Jolliffe
-- This is the grammar for the KERMIT program
procedure main_semantics for
ks_exit_command, ks_finish_command,
ks_server_command, ks_status_command,
ks_get_simple_filename, ks_get_remote_filename,
ks_get_local_filename, ks_error_bad_get_parm,
ks_receive, ks_error_bad_receive_parm,
ks_receive_local_filename, ks_save_filename,
ks_send_simple_filename,
ks_send_remote_filename, ks_send_local_filename,
ks_error_bad_send_parm, ks_set_debug_on,
ks_set_debug_off, ks_mcmd,
ks_set_filetype_text, ks_set_filetype_binary,
ks_set_filetype_mts_binary,
ks_set_binary_blocksize, ks_set_text_blocksize,
ks_set_delay, ks_bye_command, ks_set_failure,
ks_set_line, ks_invalid_command,
ks_error_on_off;
procedure set_semantics for
ks_my_end_of_line, ks_my_packet_length, ks_my_padding,
ks_my_padchar, ks_my_quote, ks_my_start_of_packet,
ks_my_timeout,
ks_your_end_of_line, ks_your_packet_length, ks_your_padding,
ks_your_padchar, ks_your_quote, ks_your_start_of_packet,
ks_your_timeout, ks_set_packet_count_interval,
ks_set_packet_count_interval_off, ks_set_escape;
procedure show_semantics for
kssh_my_end_of_line, kssh_my_packet_length, kssh_my_padding,
kssh_my_padchar, kssh_my_quote, kssh_my_start_of_packet,
kssh_my_timeout,
kssh_your_end_of_line, kssh_your_packet_length, kssh_your_padding,
kssh_your_padchar, kssh_your_quote, kssh_your_start_of_packet,
kssh_your_timeout,
kssh_binary_blocksize,
kssh_notify, kssh_filetype, kssh_delay, kssh_debug;
goal <Kermit_Command> is *blanks* <kermit_command_text>;
<kermit_command_text> is "BYE" *blanks* *end_of_line* #ks_bye_command
or "EXIT" *blanks* *end_of_line* #ks_exit_command
or "FINISH" *blanks* *end_of_line* #ks_finish_command
or <get_command>
or <help_command>
or "LOGOFF" *blanks* *end_of_line* #ks_bye_command
or "QUIT" *blanks* *end_of_line* #ks_exit_command
or "STOP" *blanks* *end_of_line* #ks_exit_command
or <receive_command>
or <send_command>
or "SERVER" *blanks* *end_of_line* #ks_server_command
or <set_command>
or <show_command>
or "STATUS" *blanks* *end_of_line* #ks_status_command
or <mcmd_command>
or <anything> *blanks* *end_of_line* #ks_invalid_comman
<help_command> is "?" or
"HELP" *help_command*;
<get_command> is "GET" <blanks> <get_parameter>;
<get_parameter> is <get_remote_filename> <blanks> <get_local_filename>
or <remote_filename> #ks_save_filename
*blanks* *end_of_line* #ks_get_simple_filename
or <anything> *end_of_line* #ks_error_bad
<get_remote_filename> is <remote_filename> #ks_get_remot
<get_local_filename> is <mts_filename> #ks_save_filename
*blanks* *end_of_line* #ks_get_local_filename;
<receive_command> is "REC"!"EIVE"! <receive_parameter>;
<receive_parameter> is <blanks> <receive_local_filename>
or *blanks* *end_of_line* #ks_receive
or <anything> *end_of_line* #ks_error_bad
<receive_local_filename> is <mts_filename> #ks_save_filename
*blanks* *end_of_line* #ks_receive_local_filename;
<send_command> is "SEND" <blanks> <send_parameter>;
<send_parameter> is <send_local_filename> <blanks> <send_remote_filename>
or <mts_filename> #ks_save_filename
*blanks* *end_of_line* #ks_send_simple_filename
or <anything> *end_of_line* #ks_error_bad_send
<send_local_filename> is <mts_filename> #ks_send_local_filename;
<send_remote_filename> is <remote_filename> #ks_save_filename
*blanks* *end_of_line* #ks_send_remote_filename;
<set_command> is "SET" <blanks> <set_parameter>;
<set_parameter> is <set_debug>
or <set_filetype>
or <set_delay>
or <set_receive_parameters>
or <set_send_parameters>
or <set_line>
or <set_packet_count_interval>
or <set_binary_blocksize>
or <set_text_blocksize>
or <set_escape>
or <set_failure>;
<set_debug> is "DEBUG" <debug_option>;
<debug_option> is *blanks* *end_of_line* #ks_set_debug_on
or <blanks> "ON" *blanks* *end_of_line* #ks_set_debug_on
or <blanks> "OFF" *blanks* *end_of_line* #ks_set_debug_off
or <anything> *end_of_line* #ks_error_on_off;
<set_filetype> is "FILETYPE" <blanks> <filetype_option>;
<filetype_option> is "TEXT" *blanks* *end_of_line* #ks_set_filetype_tex
or "BIN"!"ARY"! *blanks* *end_of_line* #ks_set_filetype_bin
or "MTS-BIN"!"ARY"! *blanks* *end_of_line* #ks_set_filetype_mt
<set_delay> is "DELAY" *blanks* *integer* *blanks* *end_of_line* #ks_set_delay;
<set_receive_parameters> is "RECEIVE" <blanks> <receive_parameters>;
<receive_parameters> is "END-OF-LINE" *blanks* <my_end_of_line>
or "PACKET-LENGTH" *blanks* <my_packet_length>
or "PADDING" *blanks* <my_padding>
or "PADCHAR" *blanks* <my_padchar>
or "QUOTE" *blanks* <my_quote>
or "START-OF-PACKET" *blanks* <my_start_of_packet>
or "TIMEOUT" *blanks* <my_timeout>;
<my_end_of_line> is *integer* *blanks* *end_of_line* #ks_my_end_of_line;
<my_packet_length> is *integer* *blanks* *end_of_line* #ks_my_packet_length;
<my_padding> is *integer* *blanks* *end_of_line* #ks_my_padding;
<my_padchar> is *integer* *blanks* *end_of_line* #ks_my_padchar;
<my_quote> is *integer* *blanks* *end_of_line* #ks_my_quote;
<my_start_of_packet> is *integer* *blanks* *end_of_line* #ks_my_start_of_packet;
<my_timeout> is *integer* *blanks* *end_of_line* #ks_my_timeout;
<set_send_parameters> is "SEND" <blanks> <send_parameters>;
<send_parameters> is "END-OF-LINE" *blanks* <your_end_of_line>
or "PACKET-LENGTH" *blanks* <your_packet_length>
or "PADDING" *blanks* <your_padding>
or "PADCHAR" *blanks* <your_padchar>
or "QUOTE" *blanks* <your_quote>
or "START-OF-PACKET" *blanks* <your_start_of_packet>
or "TIMEOUT" *blanks* <your_timeout>;
<your_end_of_line> is *integer* *blanks* *end_of_line* #ks_your_end_of_line;
<your_packet_length> is *integer* *blanks* *end_of_line* #ks_your_packet_lengt
<your_padding> is *integer* *blanks* *end_of_line* #ks_your_padding;
<your_padchar> is *integer* *blanks* *end_of_line* #ks_your_padchar;
<your_quote> is *integer* *blanks* *end_of_line* #ks_your_quote;
<your_start_of_packet> is *integer* *blanks* *end_of_line* #ks_your_start_of_pac
<your_timeout> is *integer* *blanks* *end_of_line* #ks_your_timeout;
<show_command> is "SHOW" <blanks> <show_parameter>;
<show_parameter> is "BINARY-BLOCKSIZE" *blanks* *end_of_line* #kssh_binary_block
or "DEBUG" *blanks* *end_of_line* #kssh_debug
or "DELAY" *blanks* *end_of_line* #kssh_delay
or "FILETYPE" *blanks* *end_of_line* #kssh_filetype
or "NOTIFY" *blanks* *end_of_line* #kssh_notify
or "RECEIVE" <blanks> <show_receive_parameters>
or "SEND" <blanks> <show_send_parameters>;
<show_receive_parameters> is "END-OF_LINE" *blanks* *end_of_line* #kssh_my_en
or "PACKET-LENGTH" *blanks* *end_of_line* #kssh_my_pa
or "PADDING" *blanks* *end_of_line* #kssh_my_pa
or "PADCHAR" *blanks* *end_of_line* #kssh_my_pa
or "QUOTE" *blanks* *end_of_line* #kssh_my_qu
or "START-OF-PACKET" *blanks* *end_of_line* #kssh_my_s
or "TIMEOUT" *blanks* *end_of_line* #kssh_my_ti
<show_send_parameters> is "END-OF-LINE" *blanks* *end_of_line* #kssh_your_
or "PACKET-LENGTH" *blanks* *end_of_line* #kssh_your_
or "PADDING" *blanks* *end_of_line* #kssh_your_
or "PADCHAR" *blanks* *end_of_line* #kssh_your_
or "QUOTE" *blanks* *end_of_line* #kssh_your_
or "START-OF-PACKET" *blanks* *end_of_line* #kssh_your
or "TIMEOUT" *blanks* *end_of_line* #kssh_your_
<set_line> is *blanks* "LINE" *blanks* <pseudo_unit>;
<pseudo_unit> is "*" <pseudo_unit_terminal> "*" *blanks* *end_of_line* #ks_set_
terminal <pseudo_unit_terminal> is 1 or more of
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";
<set_binary_blocksize> is "BINARY-BLOCKSIZE" *blanks*
*integer* *blanks* *end_of_line* #ks_set_binary_block
<set_text_blocksize> is "TEXT-BLOCKSIZE" *blanks*
*integer* *blanks* *end_of_line* #ks_set_text_blocksi
<set_packet_count_interval> is "NOTIFY" *blanks* <set_notify_value>;
<set_notify_value> is *integer* *blanks* *end_of_line* #ks_set_packet_count_inte
or "OFF" *blanks* *end_of_line* #ks_set_packet_count_inte
<set_escape> is *blanks* "ESCAPE" *blanks* <escape_char>;
<escape_char> is <escape_char_terminal> *blanks* *end_of_line* #ks_set_escape;
terminal <escape_char_terminal> is 1 character;
<set_failure> is <anything> *end_of_line* #ks_set_failure;
<mcmd_command> is "$" <mcmd_text> *blanks* *end_of_line* #ks_mcmd;
terminal <mcmd_text> is 0 or more characters;
terminal <mts_filename> is 1 or more of
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.<]$*-/%_>#:";
terminal <remote_filename> is 1 or more excluding " ,";
terminal <anything> is 0 or more characters;
terminal <blanks> is 1 or more of " ";
-- This section of the grammer is used to parse the PAR string when
-- Kermit is called as a main program
procedure par_string_semantics for
ps_set_mode_user, ps_set_mode_server,
ps_set_filetype_binary, ps_set_filetype_mts_binary, ps_set_filetype_text,
ps_remote_mts, ps_set_debug;
goal <Par_string_list> is *blanks* <par_string_item> *blanks*
<par_string_delimiter> *blanks*
<par_string_item> *blanks* ... *end_of_line*;
<par_string_item> is
"D"!"EBUG"! #ps_set_debug
or "F"!"ILE"!"T"!"YPE"! <blanks> "B"!"INARY"!
#ps_set_filetype_binary
or "F"!"ILE"!"T"!"YPE"! <blanks> "MTS-B"!"INARY"!
#ps_set_filetype_mts_binary
or "F"!"ILE"!"T"!"YPE"! <blanks> "T"!"EXT"!
#ps_set_filetype_text
or "RM" #ps_remote_mts
or "S"!"ERVER"! #ps_set_mode_server
or "U"!"SER"! #ps_set_mode_user;
terminal <par_string_delimiter> is 1 of ", ";
----------------------------------------------------------------------------
-- Semantics for breaking an mts filename into its component parts
procedure filename_semantics for
ks_mts_simple_filename;
goal <check_mts_filename> is <ccid> <mts_simple_filename1>
or <mts_simple_filename1>;
<mts_simple_filename1> is <mts_simple_filename> *End_Of_Line* #ks_mts_simple_f
<ccid> is *ccid* ":";
-- do a simple parse on filename. Use semantics to check the validity of
-- the filename characters, viz. Fnametrt
terminal <mts_simple_filename> is 1 to 12 excluding ": ";