LSE allows you to use its knowledge of programming languages to develop software. LSE also allows you to design your own languages. In addition to programming languages, you can define languages for other things, such as memos or letters. Once you have defined a language, you can save it in an environment file and recall it for subsequent editing and update sessions. To create a new language, you first create a source file (.LSE), within LSE, into which you put the LSE commands that define the elements of your language. Once the source file is completed, use the DO command to process the definitions. You may then use the SAVE ENVIRONMENT command to save the definitions in binary form for subsequent use by LSE. For example, to create a file for a new language, you do the following: 1. Create a source file in an empty buffer, with a .LSE extension. 2. Put all language, token, and placeholder definitions in the source file. 3. Execute the commands in the source file by executing a DO command (to load the definitions for the current editing session). 4. Execute a SAVE ENVIRONMENT command to save your new language definitions in a binary file (.ENV), for subsequent use. Thus, to create a binary image file (.ENV) for your language, you use the following sequence of commands: LSE> DO LSE> SAVE ENVIRONMENT filename LSE> EXIT
1 – Defining a Language
All template definitions, whether text or language-oriented, begin with a language definition command (DEFINE LANGUAGE) that specifies language characteristics. For example, to define a language, you use the DEFINE LANGUAGE command to specify: 1. The name of your language (DEFINE LANGUAGE). 2. The file types (/FILE_TYPES) for the language. 3. The identifier characters to be used in token and alias names (/IDENTIFER_CHARACTERS). 4. The punctuation and delimiter characters (/PUNCTUATION_CHARACTERS). 5. The required and optional placeholder delimiters (/OPT, /OPTL, /REQ, /REQL). 6. The initial text heading for the new file (/INITIAL_STRING). 7. The indentation control for tokens and placeholders (/TAB_INCREMENT). Example: DEFINE LANGUAGE MEMO - /IDENTIFIER CHARACTERS = - "abcd....XYZ0123456789" - /INITIAL_STRING ={memo_template}" - /FILE_TYPES = (.MEMO) - /TAB_INCREMENT = 4 - /OPT = ("[","]") - /OPTL = ("[","]...") - /PUNCTUATION_CHARACTERS = ".,':*+-/" - /REQ = ("[","]") - /REQL = ("[","]...") - To define a placeholder, you use the DEFINE PLACEHOLDER command to specify: 1. The name of your placeholder (DEFINE PLACEHOLDER). 2. The associated language (/LANGUAGE). 3. The type of placeholder: terminal, nonterminal, or menu (/TYPE). 4. The description that you want displayed when the placeholder is used in a menu or in the SHOW PLACEHOLDER command. 5. The end of the placeholder definition (END DEFINE). Example: . . DEFINE PLACEHOLDER subject_line - /LANGUAGE = MEMO - /TYPE = TERMINAL - "Subject of the memo." END DEFINE To define a token you use the DEFINE TOKEN command to specify: 1. The name of your token (DEFINE TOKEN). 2. The associated language (/LANGUAGE). 3. The description that you want displayed when the token is used in a menu or in the SHOW TOKEN command. 4. The end of the token definition (END DEFINE). Example: . . DEFINE TOKEN location - /LANGUAGE = MEMO - /DESCRIPTION = "Office location" "LOC: URE-0096" END DEFINE
2 – Language Commands
LSE provides the following commands for creating and manipulating language elements: DEFINE ALIAS [/LANGUAGE=name] specifies the alias name to be defined in the specified language. DEFINE LANGUAGE name specifies characteristics for the current language. DEFINE PLACEHOLDER [/LANGUAGE=name] specifies placeholder characteristics for the specified language. DEFINE TOKEN [/LANGUAGE=name] specifies token characteristics for the specified language. DELETE ALIAS [/LANGUAGE=name] cancels the effect of a DEFINE ALIAS command used for the specified language. DELETE LANGUAGE name cancels the effect of a DEFINE LANGUAGE command. DELETE PLACEHOLDER [/LANGUAGE=name] cancels the effects of a DEFINE PLACEHOLDER command used for the specified language. DELETE TOKEN [/LANGUAGE=name] cancels the effect of DEFINE TOKEN command used in the specified language. DO executes LSE commands or VAXTPU program statements. END DEFINE terminates a DEFINE TOKEN or DEFINE PLACEHOLDER command. EXTRACT LANGUAGE language-name selects the definition of the named language and formats it as a command. HELP/LANGUAGE [name | * ] displays help information about the specified language. MODIFY LANGUAGE name modifies the characteristics of a specified language. SAVE ENVIRONMENT file-spec writes all user-defined languages, tokens, and placeholders to a specified file. SHOW ALIAS name [/LANGUAGE=name] displays the characteristics of the specified alias for the specified language. SHOW LANGUAGE [ name | * ] displays the characteristics of the specified language. SHOW TOKEN name [/LANGUAGE=name] displays the characteristics of the specified token for the specified language. SHOW PLACEHOLDER name [/LANGUAGE=name] displays the characteristics of the specified placeholder for the specified language.