DOC PREVIEW
Columbia COMS W4115 - ScriptEdit Language Reference Manual

This preview shows page 1-2-3-4 out of 13 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 13 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 13 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 13 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 13 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 13 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

IntroductionOverall ideaMain lexical conventionsString constantsCommentsIdentifiers (Names)Keywords, declaration and content operatorsConditionsParenthesized expressionsRelational operatorsConditional operatorsOperator precedenceOther tokensStatementsSemanticsVariable declarationFunction declarationVariable callFunction callFile includeFile execution#if and #else#while, #continue, #break#for, #next, #do#exec#calc#gettoken#write ExamplesHELLOWORLD libraryCreate an array repeating a constant valuePersonal website in two languagesLaTeX article file from matlab simulationsScriptEdit Language Reference ManualBhavesh [email protected] M. [email protected] [email protected] [email protected] 5, 20071 IntroductionScriptEdit is a language that allows you to automatically generate text from alimited set of instructions. You can write new files with this text, or insert it intoan existing file. The instructions may use the text of the edited file, externalfiles or text generated by other standard input/output based applications asinput. ScriptEdit is similar to a macro processor in the sense that replaces textwith other text, but it can also create new files from one single source.The main goal of this language is to allow the user to edit files and the scriptoperations that are needed to create their content all from within one singlesource file. Often, editing content text files (HTML, LATEX, XML, etc) is aprocess that involves several different steps and programs - like separate bashscripts, a text editor, and other console programs (e.g. using ImageMagick toedit images or using Matlab to create graphs that will be linked). ScriptEditis a way to put all those different process calls together with the content textfile.12 Overall ideaA script-edit code is a text file that contains script-edit statements interleavedwith text from another language. We will refer to the latter as string constants(a more detailed definition is given later). Statements process this text and mayoutput text in the position where they are written.3 Main lexical conve ntionsWe have the following kinds of tokens: string constants, keywords, charactersthat separate the arguments of a keyword, identifiers, conditions, mathematicalexpressions, the declaration operator(#) and the content operator ($). Theirdefinitions are provided throughout this document.Whitespace, including tabs and newlines are generally relevant everywhere ex-cept when indicated otherwise within this manual. For example: leading andtrailing whitespaces are not ignored:{My String Variable} is not equivalent to {My String Variable} isnot equivalent to { My String Variable }.3.1 String constantsString constants are all consec utive sets of ascii characters including but notlimited to dashed, numbers and spaces that aren’t keywords, characters thatseparate the arguments of a statement, identifiers, conditions, mathematicalexpressions, the declaration operator(#) or the content op erator ($).The #, $, (, ), {, } characters can be escaped with backslash \ if needed.3.2 CommentsSince ScriptEdit is intended to be embedded within the text of another file, wedo not provide a ScriptEdit-specific comment. To comment your code use thenative comment style in the string constants.For example if you are editing an HTML file you would use:<HTML><!-- your comments --><HTML>23.3 Identifiers (Names)An identifier is a case sensitive sequence of letters, digits, and underscore ( ).The first character cannot be a digit.3.4 Keywords, declaration and content operatorsThe following identifiers are keywords that are reserved for specific use as fol-lows: The # within a line signifies the start of a ScriptEdit command, andis usually immediately proceeded by a keyword without any space characterseperation.$file #file #def #if#else #while #exec #calc#for #next #do #gettoken#write #break #continueThe declaration (#) and content operators ($) may be considered a string con-stant or part of a variable/function declaration depending on rules that arespecified by their semantics.The lexical conventions of each statement are explained along with its seman-tics.3.5 ConditionsConditions are exclusively used as part of the #if and #while constructs. Theyevaluate to either true or false.Allowable binary operators are:=, <, >, >=, >=, !=Conditions are composed by pairs of statements seperated by the binary oper-ator where each statement evaluates to a string value for comparison. Since allvariables are identified by their string value, only strings are compared.Conditional statements can be compounded using the & or | operators. Paren-theses can be used to maintain proper associativity within the conditional state -ment.For example:((${var1}=${var2}) & (${var3}=${var4} | ${var3}=${var5}))33.5.1 Parenthesized expressionsExpressions enclosed in parentheses () have an identical value as an expressionwritten without parentheses. Parentheses can be nested as long as they arebalanced.3.5.2 Relational operatorsOperators >, >=, <, <= are meant to compare only strings that can be con-verted to integer values. If strings can’t be converted to an integer, using theseoperators can produce undesirable results.Operator Use Description> ${v1}>${v2} returns true if the integer value of v1 isgreater than the integer value of v2>= ${v1}>=${v2} returns true if the integer value of v1 isgreater or equal to the integer value of v2< ${v1}<${v2} returns true if the integer value of v1 isless than the integer value of v2<= ${v1}<=${v2} returns true if the integer value of v1 isless or equal than the integer value of v2= v1=v2 returns true if the string v1 is equal tostring v2!= v1!=v2 returns true if the string v1 is NOT equalto string v23.5.3 Conditional operatorsOperator Use Description& cond1 & cond2 returns true if cond1 and cond2 are both true| cond1 | cond2 returns true if either cond1 or cond2 are true! !cond1 returns true if condition cond1 is NOT true3.5.4 Operator precedencePrecedence in evaluation is as follows:operator associativity* / left (highest)+ - left< <= > >= non-associative= != non-associative& left| left= right (lowest)43.6 Other tokensCharacters that separate the arguments of a keyword are “{”, “}”, “(”, “)”, and“,”. The { } are generally used to denote statement blocks and “(”, “)” gen-erally encloses statement or function arguments, but variable calls are specifiedusing the characters { } for


View Full Document

Columbia COMS W4115 - ScriptEdit Language Reference Manual

Documents in this Course
YOLT

YOLT

13 pages

Lattakia

Lattakia

15 pages

EasyQL

EasyQL

14 pages

Photogram

Photogram

163 pages

Espresso

Espresso

27 pages

NumLang

NumLang

6 pages

EMPATH

EMPATH

14 pages

La Mesa

La Mesa

9 pages

JTemplate

JTemplate

238 pages

MATVEC

MATVEC

4 pages

TONEDEF

TONEDEF

14 pages

SASSi

SASSi

16 pages

JTemplate

JTemplate

39 pages

BATS

BATS

10 pages

Synapse

Synapse

11 pages

c.def

c.def

116 pages

TweaXML

TweaXML

108 pages

Load more
Download ScriptEdit Language Reference Manual
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view ScriptEdit Language Reference Manual and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view ScriptEdit Language Reference Manual 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?