Start vipsi with command line Vipsi command syntax: Arguments Glossary: Argumentsargument -h Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or something similar Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and it will show it's command line options.
Most notably: starting it with no options Operators: Make Identifier "@"at all. Flow control: if … then Flow control: try … thenthen it will start in Modes of Operation: Interactive Shellinteractive shell mode. Flow control: if … then Flow control: try … thenthe first thing it prints is information on how to Instructions: getget help:
Among lot's of other List functions: words Shell Immediate Commands: wordswords, it knows Flow control: if … then Flow control: try … thenthe List functions: words Shell Immediate Commands: wordsword List functions: words Shell Immediate Commands: wordswords, which will Data Types: Lists and arrays Item selector "[]": Lists Glossary: list, list_vallist all built-in List functions: words Shell Immediate Commands: wordswords:
Flow control: if … then Flow control: try … thenThe Flow control: nextnext most important List functions: words Shell Immediate Commands: wordsword is Text functions: info Shell Immediate Commands: infoinfo, which takes vipsi - the friendly one.: The namethe name of a List functions: words Shell Immediate Commands: wordsword as a parameter Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and prints information about that List functions: words Shell Immediate Commands: wordsword:
Here are some example dialogs with vipsi, started with no Vipsi command syntax: Arguments Glossary: Argumentsarguments as an Modes of Operation: Interactive Shellinteractive shell.
Flow control: if … thenIf you type in an Vipsi command syntax: Expressions Glossary: Expressionexpression, Flow control: if … then Flow control: try … thenthe Vipsi command syntax: Expressions Glossary: Expressionexpression is executed Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and Flow control: if … then Flow control: try … thenthe result is automagically printed. List functions: thisthis is a convenience behaviour of vipsi when running as shell:
vipsi> 1230.40 * 1.18 = 1451.872
vipsi> Numeric functions: sinsin(Constants: pipi/2) = 1
vipsi> 46+3*1.1 = 49.3
vipsi>
Flow control: if … then Flow control: try … thenThe following shows how to define a Glossary: Variable, var_refvariable, how Flow control: do … looploops look like in About this Guide: General Built-in operators: Generalgeneral Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and how intentional printing to Flow control: if … then Flow control: try … thenthe user (to Constants: stdoutstdout) works:
vipsi> Instructions: var How does VScript::Value() work?: Var*&var i=10
vipsi> Flow control: do … loopdo i--; Flow control: whilewhile i; Instructions: putput i," "; Flow control: do … looploop 9 8 7 6 5 4 3 2 1
vipsi>
Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"And take a preview on Vipsi command syntax: Functions Functions Glossary: Functionfunction definition, Flow control: if … then Flow control: try … thenthe possibility of recursion, conditional Flow controlbranches Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and how to Functions with varying return types: call Instructions: callcall a Vipsi command syntax: Functions Functions Glossary: Functionfunction. nothing odd here. Just Operators: Bitwise Not "~" Operators: Boolean Negation "!"note, that Flow control: if … then Flow control: try … thenthen marks Flow control: if … then Flow control: try … thenthe Flow control: end Shell Immediate Commands: exit, quit, endend of Flow control: if … then Flow control: try … thenthe Flow control: if … thenif … Flow control: if … then Flow control: try … thenelse … Flow control: if … then Flow control: try … thenthen construct.
vipsi> Instructions: procproc fak(n) { Flow control: if … thenif n>1 Flow control: returnreturn n*fak(n-1) Flow control: if … then Flow control: try … thenelse Flow control: returnreturn 1 Flow control: if … then Flow control: try … thenthen }
vipsi> Instructions: putput "fak(7) = ",fak(7) fak(7) = 5040
vipsi>
Flow control: nextNext let's Flow control: try … thentry a simple Example Scripts: CGI Scripts Example Scripts: Scriptsscript. Flow control: if … then Flow control: try … thenThe following sample Example Scripts: CGI Scripts Example Scripts: Scriptsscript uses Flow control: if … then Flow control: try … thenthe built-in Vipsi command syntax: Functions Functions Glossary: Functionfunction List functions: env Shell Immediate Commands: env Shell Immediate Commands: envenv to Instructions: getget Flow control: if … then Flow control: try … thenthe environment Glossary: Variable, var_refvariables of Flow control: if … then Flow control: try … thenthe process Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and prints Flow control: if … then Flow control: try … thenthem. List functions: thisThis example Instructions: requirerequires that vipsi (Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or a Text functions: link Instructions: linklink to vipsi) is already installed in /usr/bin/. Operators: Bitwise Not "~" Operators: Boolean Negation "!"Note that most spaces Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and Flow control: if … then Flow control: try … thenthe Separators: Round brackets "( … )" Separators: Square brackets "[ … ]" Separators: Curly brackets "{ … }"brackets around Vipsi command syntax: Functions Functions Glossary: Functionfunction Vipsi command syntax: Arguments Glossary: Argumentsarguments are optional Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and used here for readability only.
#!/usr/local/bin/vipsi
Instructions: var How does VScript::Value() work?: Var*&var env_vars = List functions: env Shell Immediate Commands: env Shell Immediate Commands: envenv
Instructions: var How does VScript::Value() work?: Var*&var i=0
Instructions: putput Constants: nlnl,"current environment Glossary: Variable, var_refvariables:",Constants: nlnl
Flow control: do … loopdo
Flow control: whilewhile ++i < Numeric functions: countcount( env_vars )
Instructions: putput Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername( env_vars[i] ), " = ", env_vars[i], Constants: nlnl
Flow control: do … looploop
Flow control: end Shell Immediate Commands: exit, quit, endend
List functions: thisThis is a quick overview over Flow control: if … then Flow control: try … thenthe syntax of Flow control: if … then Flow control: try … thenthe vip Example Scripts: CGI Scripts Example Scripts: Scriptsscript language.
There are two types of Vipsi command syntax: Commentscomments, Flow control: if … then Flow control: try … thenthe single line Vipsi command syntax: Commentscomment Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and Flow control: if … then Flow control: try … thenthe block Vipsi command syntax: Commentscomment. They use Flow control: if … then Flow control: try … thenthe same Separatorsseparators as in C:
A program consists of a longish sequence of Vipsi command syntax: Statements Glossary: Statementstatements. A Vipsi command syntax: Statements Glossary: Statementstatement typically starts with an Vipsi command syntax: Instructions Instructions Glossary: Instructioninstruction, which is a List functions: words Shell Immediate Commands: wordsword which Flow control: returnreturns no result Glossary: Valuevalue. Many Vipsi command syntax: Instructions Instructions Glossary: Instructioninstructions Instructions: requirerequire Vipsi command syntax: Arguments Glossary: Argumentsarguments, which are made out of Vipsi command syntax: Expressions Glossary: Expressionexpressions. Also frequently used as a Vipsi command syntax: Statements Glossary: Statementstatement are Operators: Assignment "=" Built-in operators: Assignments:assignments, which actually are Vipsi command syntax: Expressions Glossary: Expressionexpressions which contain an Operators: Assignment "=" Built-in operators: Assignments:assignment Vipsi command syntax: Operators Operators Glossary: Operatoroperator.
Vipsi command syntax: Statements Glossary: StatementStatements need no Separatorsseparators, except in very rare cases, but you can use Separators: Semicolon ";"semicolons for that purpose Flow control: if … thenif you like:
Instructions: var How does VScript::Value() work?: Var*&var a=123; Instructions: putput a; a=a*3; Instructions: putput a;
Instructions: var How does VScript::Value() work?: Var*&var a=123 Instructions: putput a a=a*3 Instructions: putput a
Vipsi command syntax: Instructions Instructions Glossary: InstructionInstructions always mark Flow control: if … then Flow control: try … thenthe beginning of a Instructions: newnew Vipsi command syntax: Statements Glossary: Statementstatement. List functions: thisThis is, because they Flow control: do … loopdo Operators: Bitwise Not "~" Operators: Boolean Negation "!"not Flow control: returnreturn a result Glossary: Valuevalue. They may be followed by Vipsi command syntax: Arguments Glossary: Argumentsarguments Flow control: if … then Flow control: if … thenif the Vipsi command syntax: Instructions Instructions Glossary: Instructioninstruction Instructions: requirerequires so. Vipsi command syntax: Arguments Glossary: ArgumentsArguments need Operators: Bitwise Not "~" Operators: Boolean Negation "!"not be enclosed in Separators: Round brackets "( … )" Separators: Square brackets "[ … ]" Separators: Curly brackets "{ … }"brackets, multiple Vipsi command syntax: Arguments Glossary: Argumentsarguments are separated by Separators: Comma ","commas:
Instructions: putput 1, "anton", Constants: nlnl
Vipsi command syntax: Arguments Glossary: ArgumentsArguments for Vipsi command syntax: Instructions Instructions Glossary: Instructioninstructions, Vipsi command syntax: Functions Functions Glossary: Functionfunctions Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or Flow control: if … then Flow control: try … thenthe like are made out of Vipsi command syntax: Expressions Glossary: Expressionexpressions. Flow control: if … thenIf an Vipsi command syntax: Expressions Glossary: Expressionexpression Flow control: returnreturns a Glossary: Valuevalue of wrong type, certain effort is taken to correct Flow control: if … then Flow control: try … thenthe case:
Vipsi command syntax: Arguments Glossary: ArgumentsArguments are made out of Vipsi command syntax: Expressions Glossary: Expressionexpressions which yield some kind of result Glossary: Valuevalue. Vipsi command syntax: Expressions Glossary: ExpressionExpressions are in Flow control: if … then Flow control: try … thenthe simplest case just one Glossary: number, num_valnumber, Data Types: Text Item selector "[]": Text Glossary: text, text_valtext Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or Literals: List literals Lists and arrays: List literalslist literal:
Instructions: putput 123.456
Instructions: putput "anton"
Instructions: putput { 1, 2, 3 }
But they may be also Glossary: Variable, var_refvariables, Operators: Subtract "-"sub Vipsi command syntax: Expressions Glossary: Expressionexpressions combined by Operators and Functions with Side Effects: operator ++ and --operators and even more complex things:
Instructions: putput 12.5 + 22*1.4e3
Instructions: putput ( Numeric functions: intint(12.5 + 22*1.4e3)<<(my_flag?2:4) ) | $E000;
Instructions: putput my_textlist[ a+3, i+1 to j-2 ]
Vipsi command syntax: Literals Glossary: LiteralLiterals are Glossary: Valuevalues which are written literally in Flow control: if … then Flow control: try … thenthe source. All Data Types Invariants: Data typesdata types have a distinct look. They are covered in more details in --> 'Data Types Invariants: Data typesData types'.
Integer Float Scientific
Number literals: Decimal Integer numbers: Decimal Floating point: DecimalDecimal: 1234 -47.11 123.456e-78
Integer numbers: Hexadecimal Floating point: Hexadecimal Text functions: hexstrHexadecimal: $123affe -$b00.b00f
Integer numbers: Binary Floating point: Binary Text functions: binstrBinary: %10100101 +%1010.0101
Integer numbers: Base 256Base 256: 'Äffe'
"hello"
"say \"hello\""
«"hello". right?»
{ "a", "b", 44 } three items
{ 1, {"a","b"} } two items. Flow control: if … then Flow control: try … thenthe second item is itself a Data Types: Lists and arrays Item selector "[]": Lists Glossary: list, list_vallist
{ x=22, y=33 } two items, named x Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and y
Instructions: procproc(a,b){ Flow control: returnreturn a+b }
Vipsi command syntax: Operators Operators Glossary: OperatorOperators combine Operators: Subtract "-"sub Vipsi command syntax: Expressions Glossary: Expressionexpressions to more complex Vipsi command syntax: Expressions Glossary: Expressionexpressions. Frequently they are processed out of order, due to a hierarchy of Vipsi command syntax: Operators Operators Glossary: Operatoroperator priorities. Flow control: if … then Flow control: try … thenThe vip Example Scripts: CGI Scripts Example Scripts: Scriptsscript language defines a well thought set of Operators: Operator precedenceoperator precedences. List functions: thisThis is covered in full details in chapter --> 'Vipsi command syntax: Operators Operators Glossary: OperatorOperators'.
highest @
Operators: Named Item Selector "." Operators: Item selector "[]"item selector, postfix: . [ … ] ( … ) ++ --
prefix: + - ! ~ ++ --
bit shifting: >> <<
bit masking: & | ^
multiplication: * / %
Operators: Add "+"addition: + -
Select "? :": Concatenationconcatenation: # ##
comparision: == != >= <= > <
boolean: && ||
Operators: Select "? :"triadic selector: ? … : …
Operators: Assignment "=" Built-in operators: Assignments:assignments: = += etc.
lowest
Operators: Assignment "=" Built-in operators: Assignments:Assignments Flow control: returnreturn no result.
Operators: Bitwise Not "~" Operators: Boolean Negation "!"Note: Operators: Assignment "=" Built-in operators: Assignments:Assignment Vipsi command syntax: Operators Operators Glossary: Operatoroperators Flow control: do … loopdo Operators: Bitwise Not "~" Operators: Boolean Negation "!"not Flow control: returnreturn a result Glossary: Valuevalue. There are syntactical ambiguities with Flow control: if … then Flow control: try … thenthe "=" Numeric functions: signsign e.g. in Literals: List literals Lists and arrays: List literalslist literals. List functions: thisThis also allows named items in other places, e.g. passing named Vipsi command syntax: Arguments Glossary: Argumentsarguments to Vipsi command syntax: Procedures Data Types: Procedures Glossary: Procedureprocedures for a obj-C-like syntax. (planned for Flow control: if … then Flow control: try … thenthe future)
Vipsi command syntax: Functions Functions Glossary: FunctionFunctions are built-in List functions: words Shell Immediate Commands: wordswords which take one Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or more Vipsi command syntax: Arguments Glossary: Argumentsarguments Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and Flow control: returnreturn a result Glossary: Valuevalue.
Built-in Vipsi command syntax: Functions Functions Glossary: Functionfunctions which always take exactly one Vipsi command syntax: Arguments Glossary: Argumentsargument may be called without Separators: Round brackets "( … )" Functions with varying return types: bracket expression "()"round brackets around their Vipsi command syntax: Arguments Glossary: Argumentsargument. Flow control: if … then Flow control: try … thenThen they work similar to prefix Operators and Functions with Side Effects: operator ++ and --operators and have similar high Vipsi command syntax: Arguments Glossary: Argumentsargument binding:
Numeric functions: sinsin a == Numeric functions: sinsin(a)
Numeric functions: sinsin 2*Constants: pipi == Numeric functions: sinsin(2) * Constants: pipi !!
Vipsi command syntax: Procedures Data Types: Procedures Glossary: ProcedureProcedure are created with Instructions: procproc:
Instructions: procproc Foo() { }
Instructions: procproc Numeric functions: sinSin(a) { Flow control: returnreturn Numeric functions: sinsin(a*180/Constants: pipi) }
Instructions: procproc Sum(a,b) { Flow control: returnreturn a+b }
Instructions: var How does VScript::Value() work?: Var*&var Bär = Instructions: procproc() { Flow control: returnreturn "Bääär" }
Calling a Vipsi command syntax: Procedures Data Types: Procedures Glossary: Procedureprocedure works like calling Vipsi command syntax: Functions Functions Glossary: Functionfunctions:
Instructions: var How does VScript::Value() work?: Var*&var a = Numeric functions: sinSin(270)
Instructions: var How does VScript::Value() work?: Var*&var s = Sum(47,11)
Vipsi command syntax: Procedures Data Types: Procedures Glossary: ProcedureProcedures can be nested (List functions: localslocal Vipsi command syntax: Procedures Data Types: Procedures Glossary: Procedureprocedures) Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and can be called recursively.
There are some Vipsi command syntax: Instructions Instructions Glossary: Instructioninstructions for conditional execution of Vipsi command syntax: Statements Glossary: Statementstatements Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and Flow control: do … looploops.
Instructions: procproc fak(a) { Flow control: if … thenif a<=1 Flow control: returnreturn 1; Flow control: if … then Flow control: try … thenelse Flow control: returnreturn a*fak(a-1); Flow control: if … then Flow control: try … thenthen }
Operators: Bitwise Not "~" Operators: Boolean Negation "!"Note Flow control: if … then Flow control: try … thenthe slight difference in syntax to C which may be familiar to people accustomed to forth. Flow control: if … then Flow control: try … thenThe Flow control: if … then Flow control: try … thenelse part is optional. There is no need to Instructions: putput Flow control: if … then Flow control: try … thenthe Flow controlcondition in Separators: Round brackets "( … )" Functions with varying return types: bracket expression "()"round brackets as in C, though you can. Flow control: if … then Flow control: try … thenThe Flow control: end Shell Immediate Commands: exit, quit, endend of an Vipsi command syntax: Expressions Glossary: Expressionexpression is evident.
Instructions: procproc fak(a) { Instructions: var How does VScript::Value() work?: Var*&var r=1; Flow control: do … loopdo; Flow control: whilewhile a>1; r=r*a; a=a-1; Flow control: do … looploop; Flow control: returnreturn r; }
Another variant of List functions: thisthis common Vipsi command syntax: Functions Functions Glossary: Functionfunction, Numeric functions: nownow with iteration instead of recursion. Flow control: do … loopdo Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and Flow control: do … looploop embrace Flow control: if … then Flow control: try … thenthe Flow control: do … looploop, Flow control: if … then Flow control: try … thenthe start Flow controlcondition is set before Flow control: if … then Flow control: try … thenthe Flow control: do … looploop using standard methods, Flow control: if … then Flow control: try … thenthe Flow control: do … looploop iterator is decremented using standard methods, Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and Flow control: if … then Flow control: try … thenthe escape from Flow control: if … then Flow control: try … thenthe Flow control: do … looploop is done with a Flow control: whilewhile Vipsi command syntax: Statements Glossary: Statementstatement.
Flow control: do … loopLoops are always formed with Flow control: do … loopdo Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and Flow control: do … looploop. But there are some more control Vipsi command syntax: Statements Glossary: Statementstatements:
Flow control: whilewhile <condition> procede Flow control: whilewhile Flow controlcondition is true; Flow control: if … then Flow control: try … thenelse Flow control: exit Shell Immediate Commands: exit, quit, endexit Flow control: do … looploop
Flow control: untiluntil <condition> similar to Flow control: whilewhile, but with inverted Flow controlcondition
Flow control: exit Shell Immediate Commands: exit, quit, endexit immediately Flow control: exit Shell Immediate Commands: exit, quit, endexit Flow control: if … then Flow control: try … thenthe Flow control: do … looploop
Flow control: nextnext jump to start of Flow control: do … looploop for another go
You need Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiernames for your Glossary: Variable, var_refvariables Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and Vipsi command syntax: Procedures Data Types: Procedures Glossary: Procedureprocedures. Also each item in a Data Types: Lists and arrays Item selector "[]": Lists Glossary: list, list_vallist may be named.
Flow control: if … then Flow control: try … thenThe following restrictions are imposed on source Example Scripts: CGI Scripts Example Scripts: Scriptsscripts:
anton, cäsar, µ, ΩOperators: Subtract "-"sub, sin21, _, _liste_, Café, Smørebrød, Жизмн.
catch 23 contains space
Numeric functions: sinsin pre-defined List functions: words Shell Immediate Commands: wordsword
6pack starts with a Glossary: number, num_valnumber
big-letters no '-' allowed
List functions: words Shell Immediate Commands: wordsWords are always evaluated Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and executed from left to right as soon as possible. Operators and Functions with Side Effects: operator ++ and --Operators and Vipsi command syntax: Procedures Data Types: Procedures Glossary: Procedureprocedures are executed as soon as their Glossary: Operator Glossary: Operandoperands are evaluated. Flow control: if … then Flow control: try … thenThe interpreter has no freedom of choice!
Pruning is performed for ? … : Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and && Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and ||. Flow control: if … then Flow control: if … thenIf the result is sufficiently determined by Flow control: if … then Flow control: try … thenthe first Glossary: Operator Glossary: Operandoperand, Flow control: if … then Flow control: try … thenthen Flow control: if … then Flow control: try … thenthe second Glossary: Operator Glossary: Operandoperand is simply skipped Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and Operators: Bitwise Not "~" Operators: Boolean Negation "!"not executed.
Pruning for &&= Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and ||= is Operators: Bitwise Not "~" Operators: Boolean Negation "!"not yet implemented (version 0.8.7)
|