From: Alexander I. Baranovsky
Subject: Exceptions in VIRT, Freeware Interpreter Ver.2.0
Date:
Message-ID: <ADIaZ6wW29@blast.donetsk.ua>
New version of the language VIRT ensures processing of exceptions
and errors handling. Now VIRT supports constructions such as try-except,
try-finally, on-do, raise. You can find the freeware VIRT interpreter
version 2.0 at the following URL : http://www.botspot.com/virt/
The mentioned above concepts are illustrated by a full source written
in VIRT ( file 'interp.w' ). It is interpreter for simple language with
gramma :
Program = "program" { Statement } "end"
Statement = ( Assignment | Print ) ";"
Print = "print" Expression { "," Expression }
Assignment = ID ":=" Expression
Expression = Term { ( "*" | "/" ) Term }
Term = Factor { ( "+" | "-" ) Factor }
Factor = ID | "(" Expression ")" | - Factor | Number
Number = Digit { Digit }
ID = Letter { ( Letter | Digit ) }
Digit = "0"|"1"|..."9"
Letter = "a"|"b"|..."z"
Besides this demo source testifies that VIRT can be very attractive both for
interpreter writing and for the self-description.
As an example you can see a fragment of the file 'interp.w' below :
object Scanner : TScanner
object SymbolTable : TSymbolTable
object Parser : TParser
object Postfix : TPostfix
P := 'program a3 := -78 * ( 6+11 ); b := a3 + 2; print a, b+4; and'
writeln( P )
Scanner.Init( P, SymbolTable )
SymbolTable.Init()
PostFix.Init( SymbolTable )
Parser.Init( Scanner, Postfix )
try
Parser.Parse_PROGRAM()
except
on E : TFailrue do -- TFailrue is user class
E.ShowError()
raise
end
end
try
try
Postfix.Execute()
except
on E : TFailrue do
E.ShowError()
end
end
finally
Postfix.Print()
SymbolTable.Print()
end
return
Another demos are exposing the following VIRT applications : theorem
proving, processing of dynamic data structures, sorting, graph algorithmes,
numerical methods.
Alexander I.Baranovsky
E-mail : ·······@blast.donetsk.ua
Flat 265, Constitution's square, 1
Donetsk, Ukraine.
Tel. 380622-371978