Re: Oxygen Module for Structured Machine Code Programming
Yes I understand but multiline is there and ASM not and also not decided anything. And it will take some time.
Also ASM will be specific of a particular module and not thinBAsic general Core engine so we will not able to follow its evolution from inside of thinBasic (as far as I can see).
I think thinAir should have something in config that should say the beginning of the block and the end of the block in order to be automatically able to understand them whatever they are. Not to be specific to any particular syntax but general like:
block: [FUNCTION][END FUNCTION]
block: [SUB][END SUB]
block: [BEGIN CONST][END CONST]
...
PS: maybe better to split this part of the topic into thinAir forum.
Re: Oxygen Module for Structured Machine Code Programming
Hi Eros and Roberto
With Asm it is desirable to be able to use quote quote marks eg:
mov al,"b" or db "piece of text"
This would require thinBasic to use special markers to delineate a block of data instead of double-quotes. I suggest a pair of brackets, either [] or {} because of nestability. - Brackets are also used extensively within Asm itself
I know this is a fundamental change to thinBasic syntax but I think it will help with syntax highlighting and support many other kinds of script or data passed to modules in general.
[color=purple]MyAsmProc=O2_Asm {
mov eax,#vv
mov [eax], "helo"
..
ret
}
please excuse my colors :)
Re: Oxygen Module for Structured Machine Code Programming
Charles,
who will be responsible to parse all code inside {...} of O2_Asm {...} ?
If responsible to parse code will be module function linked to O2_Asm, I do not see much troubles.
thinCore just need to parse first { and last } and pass all the inside code to O2_Asm function as string.
This will also let to thinAir the freedom to remain as is because syntax will be very close to current parsed syntax.
Ciao
Eros
Re: Oxygen Module for Structured Machine Code Programming
Yes the entire content, including comments can be passed as a BSTR to the module. To avoid the nested brackets problem (for which you would need to parse the entire content) you could use keywords like this:
dim sMc as string=Oxygen_Eval Script
..
EndScript Oxygen_Eval
In general terms:
[module function name] script.. EndScript [module function name]
This syntax could easily support scripts which may contain other scripts :) without getting too complicated
pseudocode:
read script
do
p=instr next_word_pos script, "endscript "
if p=0 then p= len script+1: exit (error)
w=nextword script
if w=function_name then a=next_word_pos script: exit
next_word_pos=this_word_pos
loop
if noerror then assign script ..
Re: Oxygen Module for Structured Machine Code Programming
Eros,
A question about the FreeBasic interface: How did you generate libthinCore.dll.a ? Did you use dlltool and a DEF file ?
1 Attachment(s)
Re: Oxygen Module for Structured Machine Code Programming
Attached file the .bat and .def file I use.
In the .def file you declare the dll from which to export and the functions followed by @ followed by the number of bytes calling process expects to find into the stack.
In the .bat file, the command I use.
I remember it took some time for me to understand this process.
Hope this can help.
Eros
Re: Oxygen Module for Structured Machine Code Programming
Quote:
Originally Posted by Charles Pegge
Yes the entire content, including comments can be passed as a BSTR to the module. To avoid the nested brackets problem (for which you would need to parse the entire content) you could use keywords like this:
dim sMc as string=Oxygen_Eval Script
..
EndScript Oxygen_Eval
In general terms:
[module function name] script.. EndScript [module function name]
This syntax could easily support scripts which may contain other scripts :) without getting too complicated
pseudocode:
read script
do
p=instr next_word_pos script, "endscript "
if p=0 then p= len script+1: exit (error)
w=nextword script
if w=function_name then a=next_word_pos script: exit
next_word_pos=this_word_pos
loop
if noerror then assign script ..
I will study your idea. Very interesting and very easy to manage by thinBasic parser.
Eros
Re: Oxygen Module for Structured Machine Code Programming
Charles,
if there are difficulty inside the interpreters to manage a block (either machine code or assembler) is better to keep things simple (I mean use string or multi string) and try to solve the problem with marker inside the string.
Ciao,
Roberto
Re: Oxygen Module for Structured Machine Code Programming
Charles,
see atached file and let me know if it can be ok for you.
Mainly I've added (as you suggested) RAWTEXT/END RAWTEXT block.
In theory inside that block there can be anything. If all OK a string containing the block will be returned.
Ciao
Eros
Updated:
- SCRIPT/END SCRIPT
substituted with
RAWTEXT/END RAWTEXT - 2008.03.16: added interface function thinBasic_VariableGetInfoEX. See thinCore.inc file inside zip file
Attached file removed. Features present in current thinBasic preview version 1.6.0.2
Re: Oxygen Module for Structured Machine Code Programming
Hi Eros,
fantastic! But as inside can be "anything", why not call it RAWTEXT / END RAWTEXT or similarly.
Without the magic ( Charles module ) it has no script like functionality.
Just idea, could be wrong, today I realised my bike has pierced pneumatic so I am in aggressive mood ;D
Petr