TYL PROGRAMMING LANGUAGE
The All New Tyl Version 2.2 Released!
Download Now
dir rootdir 'C:\temp\rootdir\'
sch '1'
dlist [ rootdir ]
schlist [ ]
dctr lastdctr 1
~
lastdctr < 0 ?
ds io.directories dir
dctr 1
lastdctr len ds
ds d ~ dlist d
diff lastdctr dctr + 1
diff <= 0 ?
i diff ~
  ds io.directories dlist dctr
  ds d ~ dlist d
  dctr ++
  lastdctr ++ len ds
inf { name '' parentpath '' }
dlist d ~
files io.files d
files f ~
inf io.info f
ind string.index inf.name sch
ind >= 0 ?
  idctr ++
  schlist { name inf.name pdir inf.parentpath }
fmap { name '' pdir '' }
max len schlist
print 'searching for `' + sch + '` in `' + rootdir + '`'
print 'found ' + max + ' results' + newline
i max ~
fmap schlist i
print fmap.name + ' ' + fmap.pdir
mssqldb 'data source=(LocalDb)\MSSQLLocalDB;integrated security=true;connection timeout=60;'
mssqldb.connect
dropdb
dbexistcmd 'select count(*) from sys.databases where name=`geodb`'
result mssqldb.value dbexistcmd
not result ? dropdb
dropdb ?
print 'dropping database `geodb`...'
mssqldb.execute 'DROP DATABASE geodb'
~
  pause 1
  result mssqldb.value dbexistcmd
  not result ?
print 'dropped ok.' + newline
print 'creating database `geodb`...'
mssqldb.execute 'CREATE DATABASE geodb;'
~
  pause 1
  result mssqldb.value dbexistcmd
  result ?
print 'created ok.' + newline
mssqldb.sqlerror ? print mssqldb.sqlerror
≡ connect to geodb database
mssqldb 'data source=(LocalDb)\MSSQLLocalDB;initial catalog=geodb;integrated security=true;connection timeout=60;'
mssqldb.connect
tablesexistcmd 'SELECT count(*) FROM geodb.INFORMATION_SCHEMA.TABLES '
tablesexistcmd ++ 'WHERE TABLE_TYPE = `BASE TABLE` '
tablesexistcmd ++ 'AND (TABLE_NAME = `countries` OR TABLE_NAME = `mountains`)'
not dropdb ?
print 'dropping tables `mountains`, `countries`...'
mssqldb.execute 'DROP TABLE mountains; DROP TABLE countries;'
on ~
  pause 1
  num mssqldb.value tablesexistcmd
  not num ?
print 'dropped ok.' + newline
mssqldb.sqlerror ? print mssqldb.sqlerror
≡ ATTENTION MS SQL accepts only apostrophe symbols ('), as
≡     quotation marks. Do replace all apostrophe
≡     symbols with backtick symbols (`).
cmd ''
cmd ++ 'CREATE TABLE [dbo].[countries] ('
cmd ++ ' [id]  INT    IDENTITY (1, 1) NOT NULL,'
cmd ++ ' [name] NVARCHAR (20) DEFAULT (``) NOT NULL,'
cmd ++ ' PRIMARY KEY CLUSTERED ([id] ASC)'
cmd ++ ');'
cmd ++ 'CREATE TABLE [dbo].[mountains] ('
cmd ++ ' [id]  INT    IDENTITY (1, 1) NOT NULL,'
cmd ++ ' [name] NVARCHAR (20) DEFAULT (``) NOT NULL,'
cmd ++ ' [country] INT    NOT NULL,'
cmd ++ ' [height] INT    NOT NULL,'
cmd ++ ' PRIMARY KEY CLUSTERED ([id] ASC),'
cmd ++ ' CONSTRAINT [FK_mountains_countries] FOREIGN KEY ([country]) REFERENCES [dbo].[countries] ([id])'
cmd ++ ');'
mssqldb.execute cmd
pause 1
num mssqldb.value tablesexistcmd
num 2 ?
print 'tables created successfully.'
print 'tables creation failed!' + newline
print mssqldb.sqlerror
mcerrors 'OK' 'INSUFFICIENT ARGUMENTS' 'NON NUMERIC ARGUMENT' 'DIVISION BY ZERO' 'INVALID ACTION'
mcpath 'tools/minicalculator.exe'
avgproc process mcpath avgargs
divproc process mcpath divargs
avgnums 1.8 2.8 4.6
avgargs getargs 'v' avgnums
result avgproc.run
print ( result ? result mcerrors avgproc.exitcode )
args 1.8 9
divargs getargs 'd' args
result divproc.run
print ( result ? result mcerrors divproc.exitcode )
getargs action args »
result [ action ]
args arg ~ result arg
result
hdr msg » print newline + msg
path 'C:\temp\app.settings'
content io.read path
lines string.lines content
smap { name '' age 0 height 0 isstudent }
not lines ?
print 'settings file is empty!'
lines line ~
ind string.index line '='
key string.section line 0 ind
value getvalue string.section line ( ind + 1 )
smap key value
print key + ' ' + value
getvalue value »
result number.of value
not null result ? result
result bool.of value
not null result ? result
value
≡    variable sine function plotting
≡ factors
factor { amp .91 step 2.8 reduce 1.036 }
≡ ui
maxamp 42
maxstep 33
space ''
i maxamp ~ space ++ ' '
amp math.floor factor.amp maxamp
dynamp midamp math.floor amp ÷ 2
step factor.step 2 math.pi ÷ amp
≡ plot
x maxstep ~
y midamp + 1 + math.floor dynamp math.sin x step
dynamp ÷÷ factor.reduce
msg string.section space 0 y
print msg + 'ᐤ'
≡ check if storage list exists
hasnumskey storage.exists 'nums'
print 'nums key exists ' + hasnumskey
≡ get and print storage nums
print 'storage nums ' + storage.get 'nums'
≡ create nums key if not exists
nums
storage.set 'nums' nums
≡ assign nums from storage
nums storage.get 'nums'
≡ print length of nums
numslen len nums
print 'length of nums ' + len nums
≡ add item to storage nums
nums numslen ++
storage.set 'nums' nums
≡ get and print storage nums after setting
print 'storage nums ' + storage.get 'nums'


See all Tyl framework reference



" ... The new version is awesome and useful. Liked the database and process features ... "


DYNAMIC PROGRAM STRUCTURE
FAST EXECUTION MODE
LIST & RECORD ITERATORS
BREAK & CONTINUE
INLINE DEBUGGING
MODULARITY
UNCONDITIONAL LOOPING
SYSTEM MODULES & FUNCTIONS
ONE LINE STATEMENTS
SYMBOLIZED KEYWORDS
CLEAN CODE
MULTIPLE VARIABLES DECLARATION




What's new in version 2.2
Execution Modes
Tyl System distinguishes between activities that are UI and background centric
Performance
Tyl System was redesigned for programs to be built and run faster, a fast execution mode is introduced that effectively shuts down all user interface and system interactivities in favour of better performance
Tyl Launcher
Tyl launcher got more IDE features and improvements: code editing, code visualization, build & run
Create Executable
starting from this version, all execution modes are defined by UI buttons
Modularity
support for creating modules (libraries) that can be called locally or globally, from now it is possible to create an application that will be composed of a main program and various modules
Tyl Runner
runtime management buttons were added that enable run, pause and stop activities, as well as indicators about compile & run state, and error messages with details on components
Command Line Tool
starting in this version, it is posible to activate program management from a console via a new executable command line tool
Variable Assignment
modifications were made to support various assignment scenarios in scalars, lists and records
Numeric Calculations
added support for composite numeric calculation including parentheses
Multiple Declaration
declare as much variables as you like in the same line, provided they are of the same type
Records
added support for dot notation access to record properties, and introduced the ability to add keys of list and record types
Specialized Modules
added dynamic system modules to handle tasks such as database management, running processes and network TCP/IP communication
Input/Output
added support for outputting data to output stream, used in conjunction with processes execution and interactivity




Would you like to participate?