Dependence on Programming Exps

Viktoras Didziulis viktoras at ekoinf.net
Fri Jul 14 06:31:22 EDT 2006


Brian, this is definitely something to start with! Many other programming 
languages support alternative syntaxes through inlining the code without 
tackling with the engine in any way. Such inline capabilities are ensured 
solely by external modules. E.g. one can inline C or ASM into a Perl program

 
so that it even gets compiled and executed when high speed processing is 
needed. Same can be said about other languages that can be inlined. If you 
go to www.cpan.org then you will face the amount of modules implementing 
diverse functionality in Perl. There are 401 inline modules alone 
(http://search.cpan.org/search?query=inline&mode=all) ! So in Perl you just 
write use Inline C and start writing in C... I am not advocating Perl here, 
but this is something to grasp on as a good example of modularity and 
flexibility without ever touching the interpreter. 
 
With library this should be possible: 
start using stack "MathLib" 
x=field "x" 
y=field "y" 
z=x+y 
answer z; 
 
or automatically relate script variables with fields, so we could skip 
assignement of field values and write 
start using stack "MathLib" 
z=x+y 
answer z; 
while MathLib would take care about translating x, y and z to corresponding 
fields on the stack (field "x", field "y" and field "z") 
 
Now compare: 
the assembly 
mov ax, 5 
mov bx, 7 
add ax, bx 
and the transcript: 
put 5 into x 
put 7 into y 
add y to x 
 
So time ago this type of syntax lead to creation of high level languages 
that could understand z=x+y directly. No wonder the same discussion starts 
on this list from time to time ;-) 
 
Just 2 cents from 
Viktoras 
 
 
-------Original Message------- 
 
From: Brian Yennie 
Date: 07/14/06 07:12:07 
To: How to use Revolution 
Subject: Re: Dependence on Programming Experts 
 
For fun, try inserting this as a front script: 
 
on returnInField 
get offset(("field "&quote&"script"&quote&" of card 
"&quote&"revscript"&quote), the long name of the target) 
if (it = 1) then 
put word 2 of the selectedLine into lineNum 
put line (lineNum) of fld "script" of card "revscript" into prevLine 
if (token 2 of prevLine is "=") then 
put ("put"&&(token 3 to -1 of prevLine)&&"into"&&(token 1 of 
prevLine)) into line (lineNum) of fld "script" of card "revscript" 
select empty 
send "revFormatField lineNum,lineNum" to card "revscript" 
select after line (lineNum) of fld "script" of card "revscript" 
end if 
end if 
pass returnInField 
end returnInField 
 
Now edit any script and enter "x=5" or some other simple assignment on 
a line by itself. Hit return. Voila, translation to "verbose" =)! 
 
I'm sure there are various ways a plugin could use this sort of magic 
to allow customized syntax, without needing changes to the Rev engine. 
It would just become a script editor convenience. You could always trap 
script editing messages to even hide the conversion rather than 
converting it on the fly. 
 
- Brian 
 
_______________________________________________ 
use-revolution mailing list 
use-revolution at lists.runrev.com 
Please visit this url to subscribe, unsubscribe and manage your subscription

 
preferences: 
http://lists.runrev.com/mailman/listinfo/use-revolution



More information about the use-livecode mailing list