7.2. syntax.def

[<<<] [>>>]

This file contains the syntax definition of the language ScriptBasic. This syntax definition is converted to C source file containing syntax definition tables using the Perl script `syntaxer.pl'.

The souce code of the file `syntax.def' is:

%FILE syntax
#%HFILE syntax.h
#%CFILE syntax.c
%COMMANDS
EMPTY: nl noexec
LOCAL: 'local' local_list nl noexec
PRAGMA: 'declare' 'option' pragma nl noexec
OPTION: 'option' absolute_symbol expression
# Compare
! sbCaseSensitive   0x00000000
! sbCaseInsensitive 0x00000001
! sbMathErrDiv          0x00000001
! sbMathErrUndef        0x00000002
! sbMathErrUndefCompare 0x00000004
CUNDEF:       'undef' lval_list nl
CBYVAL:       'byval' lval_list nl
# the different looping statements that are common in BASIC
# the ordering of the defintion *IS* important
WHILE:     'while' expression  go_forward(WHILE) come_back(WHILE) nl
WEND:      'wend' go_back(WHILE) come_forward(WHILE) nl
DOWHILE:   'do' 'while' expression go_forward(DO) come_back(DO) nl
DOUNTIL:   'do' 'until' expression go_forward(DO) come_back(DO) nl
LOOPWHILE: 'loop' 'while' expression go_back(LOOP) come_forward(LOOP) nl
LOOPUNTIL: 'loop' 'until' expression go_back(LOOP) come_forward(LOOP) nl
UNTIL:     'until' expression go_back(REPEAT) come_forward(REPEAT) nl
LOOP:      'loop' go_back(DO) come_forward(DO) nl
REPEAT:    'repeat' go_forward(REPEAT) come_back(REPEAT) nl
DO:        'do' go_forward(LOOP) come_back(LOOP) nl
# we allow a symbol after the next, but it does not help to recongnise nexting errors
NEXTI:    'next' symbol go_back(FOR) come_forward(FOR) nl
NEXT:    'next' go_back(FOR) come_forward(FOR) nl
OPENDIR: 'open' 'directory' expression 'pattern' expression 'option' expression 'as' expression nl
# predefined global constants
! sbCollectDirectories   0xFFFFFFFE
! sbCollectDots          0xFFFFFFFD
! sbCollectRecursively   0xFFFFFFFB
! sbCollectFullPath      0xFFFFFDFF
! sbCollectFiles         0xFFFFFFFF
! sbSortBySize           0xFFFFFFF7
! sbSortByCreateTime     0xFFFFFFEF
! sbSortByAccessTime     0xFFFFFFDF
! sbSortByModifyTime     0xFFFFFFBF
! sbSortByName           0xFFFFFF7F
! sbSortByPath           0xFFFFFEFF
! sbSortAscending        0xFFFFFBFF
! sbSortDescending       0xFFFFFFFF
! sbSortByNone           0xFFFFFFFF
# file operations
OPEN/OPEN:   'open' expression 'for' absolute_symbol 'as' expression 'len' '=' expression nl
CLOSE:  'close' '#' expression nl
CLOSE:  'close' expression nl
SEEK:   'seek' '#' expression ',' expression nl
SEEK:   'seek' expression ',' expression nl
REWIND: 'rewind' '#' expression nl
REWIND: 'rewind' expression nl
RESET:  'reset' nl
LINPUTF: 'line' 'input' '#' expression ',' lval nl
LINPUT: 'line' 'input' lval nl
TRUNCATEF: 'truncate' '#' expression ',' expression nl
RLOCK: 'lock' 'region' '#' expression 'from' expression 'to' expression 'for' absolute_symbol nl
RLOCK: 'lock' 'region'  expression 'from' expression 'to' expression 'for' absolute_symbol nl
FLOCK: 'lock' '#' expression ',' absolute_symbol nl
FLOCK: 'lock' expression ',' absolute_symbol nl
MKDIR: 'mkdir' expression nl
DELETEF: 'deltree' expression nl
DELETE: 'delete' expression nl
FCOPY: 'filecopy' expression ',' expression nl
NAME: 'name' expression ',' expression nl
CHDIR: 'chdir' expression nl
SETFILE: 'set' 'file' expression absolute_symbol '=' expression nl
BINMO: 'binmode' 'output' nl
BINMI: 'binmode' 'input' nl
TXTMO: 'textmode' 'output' nl
TXTMI: 'textmode' 'input' nl
BINMF: 'binmode' '#' expression nl
BINMF: 'binmode' expression nl
TXTMF: 'textmode' '#' expression nl
TXTMF: 'textmode' expression nl
SLEEP: 'sleep' expression nl
PAUSE: 'pause' expression nl
# list of unary operators
%UNARIES
PLUS:  +
MINUS: -
NOT: not
BYVAL: byval
EXTOPAC: +^
EXTOPAD: +<
EXTOPAE: +>
EXTOPAF: +?
EXTOPAG: +=
EXTOPAH: +*
EXTOPAI: +/
EXTOPAJ: +%
EXTOPAK: +!
EXTOPAL: +#
EXTOPAM: +&
EXTOPAN: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EXTOPNE: \>
EXTOPNF: \?
EXTOPNG: \=
EXTOPNH: \*
EXTOPNI: \/
EXTOPNJ: \%
EXTOPNK: \!
EXTOPNL: \#
EXTOPNM: \&
EXTOPNN: \\
EXTOPNO: \`
EXTOPNP: \'
EXTOPNQ: \@
EXTOPOC: `^
EXTOPOD: `<
EXTOPOE: `>
EXTOPOF: `?
EXTOPOG: `=
EXTOPOH: `*
EXTOPOI: `/
EXTOPOJ: `%
EXTOPOK: `!
EXTOPOL: `#
EXTOPOM: `&
EXTOPON: `\
EXTOPOO: ``
EXTOPOP: `'
EXTOPOQ: `@
EXTOPPC: '^
EXTOPPD: '<
EXTOPPE: '>
EXTOPPF: '?
EXTOPPG: '=
EXTOPPH: '*
EXTOPPI: '/
EXTOPPJ: '%
EXTOPPK: '!
EXTOPPL: '#
EXTOPPM: '&
EXTOPPN: '\
EXTOPPO: '`
EXTOPPP: ''
EXTOPPQ: '@
EXTOPQC: @^
EXTOPQD: @<
EXTOPQE: @>
EXTOPQF: @?
EXTOPQG: @=
EXTOPQH: @*
EXTOPQI: @/
EXTOPQJ: @%
EXTOPQK: @!
EXTOPQL: @#
EXTOPQM: @&
EXTOPQN: @\
EXTOPQO: @`
EXTOPQP: @'
EXTOPQQ: @@
EXTOPF: ?
EXTOPK: !
EXTOPL: #
EXTOPO: `
EXTOPQ: @
%PRECEDENCE
%PRECEDENCE
MULT: *
DIV: /
IDIV: \
MOD: %
%PRECEDENCE
CONCATENATE: &
%PRECEDENCE
EQ: =
LT: <
LE: <=
GT: >
GE: >=
NE: <>
%PRECEDENCE
OR: or
XOR: xor
# built-in functions: name, min args, max args
%FUNCTIONS
SIN: sin 1 1
ASIN: asin 1 1
COS: cos 1 1
ACOS: acos 1 1
SGN: sgn 1 1
ODD: odd 1 1
GCD: gcd 2 100000
LCM: lcm 2 100000
EVEN: even 1 1
SQR: sqr 1 1
RND: rnd 0 0
ABS: abs 1 1
VAL: val 1 1
PI: pi 0 0
MAXINT: maxint 0 0
MININT: minint 0 0
TRUE: true 0 0
FALSE: false 0 0
FIX: fix 1 1
INT: int 1 1
INT: cint 1 1
FRAC: frac 1 1
CVD: cvd 1 1
CVI: cvi 1 1
CVL: cvl 1 1
CVS: cvs 1 1
MKD: mkd 1 1
MKD: mkd@$ 1 1
MKI: mki 1 1
MKI: mki@$ 1 1
MKS: mks 1 1
MKS: mks@$ 1 1
MKL: mkl 1 1
MKL: mkl@$ 1 1
UNDEF: undef 0 0
ROUND: round 1 2
LOG: log 1 1
LOG10: log10 1 1
POW: pow 1 1
EXP: exp 1 1
LEN: len 1 1
ASC: asc 1 1
LBOUND: lbound 1 1
UBOUND: ubound 1 1
ACOSECANT: acosecant 1 1
ACTAN: actan 1 1
ASECANT: asecant 1 1
ATAN: atan 1 1
ATN: atn 1 1
COSECANT: cosecant 1 1
COTAN: cotan 1 1
COTAN2: cotan2 2 2
HCOS: hcos 1 1
HCOSECANT: hcosecant 1 1
HCTAN: hctan 1 1
HSECANT: hsecant 1 1
HSIN: hsin 1 1
HTAN: htan 1 1
SECANT: secant 1 1
TAN: tan 1 1
TAN2: tan2 2 2
BIN: bin 1 1
OPTIONF: option 1 1
LOC: loc 1 1
LOF: lof 1 1
FILELEN: filelen 1 1
FREEFILE: freefile 0 1
INPUTFUN: input 1 2
EOFFUN: eof 1 1
EODFUN: eod 1 1
FTACCESS: fileaccesstime 1 1
FTMODIFY: filemodifytime 1 1
FTCREATED: filecreatetime 1 1
FOWNER: fileowner 1 1
ISDIR: isdirectory 1 1
ISREG: isfile 1 1
FILEXISTS: fileexists 1 1
NEXTFILE: nextfile 1 1
ENVIRON: environ 1 1
ENVIRON: environ@$ 1 1
CURDIR: curdir 0 0
COMMANDF: command 0 0
ADDRESSF: address 1 1
KILL: kill 1 1
ICALLFUN: icall 1 2000000
FCRYPT: crypt 2 2
CREATEPROCESS: system 1 1
CREATEPROCESSEX: execute 3 3
WAITPID: waitpid 2 2
FORK: fork 0 0


[<<<] [>>>]