Search Forum
(57415 Postings)
Search Site/Articles

Archived Articles
712 Articles

C# Books
C# Consultants
What Is C#?
Download Compiler
Code Archive
Archived Articles
Advertise
Contribute
C# Jobs
Beginners Tutorial
C# Contractors
C# Consulting
Links
C# Manual
Contact Us
Legal

GoDiagram for .NET from Northwoods Software www.nwoods.com


              
Printable Version

XbWrapper- Interpreter Written In C#
By Vjacheslav Selivanov

XbWrapper is an extremely simple scripting language. Its intended use is as an embedded language in other C# programs, this is Xbase style script language.

Download xbwrapp.zip

XbWrapper is small and simple, and is only a one thousand lines of source. So if the functionality you are looking for is more than a simple configuration file parser, XbWrapper could be for you. XbWrapper based on interpreter and wrapper functions library. About functions library:

This library is designed as a set of XBase commands and functions and provided wrappers for work with Access databases.You establish connection from your application and further, in the scripts, you will work with the Access tables using XBase like functions and commands in application:

   XbParser parser=new XbParser(lexer);
   parser.DbClass=new DbWrapper("book.mdb");
   in script:
   # bookstock is table from book.mdb
   # make dataset
   use bookstock
   # set current work table
   select bookstock
   while !eof()
     ? bookstosk.booktitle
# in expression bookstock is table and booktitle is field name
# bookstosk.booktitle=something means store in field "booktitle" variable
# something
     skip
   endwhile     
There are some XBase like functions and commands that you may use with your scripts application.
These are:
use 
select 
skip
eof()
fcount()
recno()
reccount()
field(integer n) ant etc.
For full information see source code.
About interpreter-
interpreter support:
    Automatic declare variables (string,integer,double,boolean) 
    Conditional execution ('if','case' statements) 
    Loops ('while','for') 
    Functions  
    Local variable scope and array.
# declare array length of array=0
Declare ahtml[0]     
# add element to array
AAdd(ahtml,"")
#Length of array =1
? Alen(ahtml) 
The usual range of logic and math operators. 

script.xbs - contains example how generate html page from database,
             written on XbWrapper.

Note that. The submitted code is not the completed application and is intended for the educational purposes.
The only requirement is a NetSdk final release.