Author Topic: The SICK project  (Read 5023 times)

0 Members and 1 Guest are viewing this topic.

Offline eoredson

  • Newbie
  • Posts: 55
  • Let the Farce be with you!
    • View Profile
    • Oredson QB45 Files At Filegate
The SICK project
« on: July 27, 2018, 01:53:49 am »
Attached is The Symbolic Instruction Code Kit which is a pseudo-BASIC interpreter written in
BASIC for QB64 windows..

The Symbolic Instruction Code Kit, which contains a QB64 program named SIC64.BAS
and several smaller utility programs. The source code is public domain and can be
found on several sites, including, www.filegate.net and www.keepandshare.com

This program uses a recursive descent parser to interpret a psuedo-basic language
written in a line number oriented fashion and can be used for small programming chores.

The archive also contains some further imbedded .zip files which contain several
QB64 sample programs, and some .SIC programs which are used by the SIC engine.
* SICK64D2.ZIP (Filesize: 391.56 KB, Downloads: 228)
sickimg.PNG
* sickimg.PNG (Filesize: 21.62 KB, Dimensions: 646x432, Views: 322)
« Last Edit: July 27, 2018, 02:32:59 am by eoredson »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: The SICK project
« Reply #1 on: July 27, 2018, 10:04:41 am »
Hi Erik,

Is there anything new here that is not already included in the "Samples Gallery?

Actually it looks to be a couple of KB smaller and has version 2 attached to the zip.
« Last Edit: July 27, 2018, 10:07:40 am by bplus »

Offline eoredson

  • Newbie
  • Posts: 55
  • Let the Farce be with you!
    • View Profile
    • Oredson QB45 Files At Filegate
Re: The SICK project
« Reply #2 on: July 27, 2018, 07:27:00 pm »
This is a new version with updates to some color prompts fixed, and an addition to support
file attributes for compressed/encrypted files. (v64 r5.2)

Erik.

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: The SICK project
« Reply #3 on: July 29, 2018, 09:47:03 am »
Hello Erik,

In light of the sxmath plug over at the "power function" thread, I decided to return the favor with a slightly tweaked SIC64.bas file. The changes are light and surgical:

At the top and bottom (respectively):
Code: QB64: [Select]
  1. REM $Include: 'sxmath.bi'
  2. REM $Include: 'sxript.bi'
  3. ...
  4. REM $Include: 'sxmath.bm'
  5. REM $Include: 'sxript.bm'
  6.  

...And somewhere in the middle:
Code: QB64: [Select]
  1.         CASE "SXR"
  2.             CALL GetToken3
  3.             CALL GetToken
  4.             CALL Parse1(Temp#)
  5.             Out3 = SxriptEval$(Out3)
  6.             CALL GetToken4
  7.             LastToken = False
  8.  

... And that embeds the full-blown Sxript language into your project. It's dressed up as the "SXR" function of a single string argument. To test it out, I was doing a little calculus in the SIC terminal. First I dragged over the Sxript calculus header:

Code: QB64: [Select]
  1. func(deriv, {
  2.   (([x]([y]+[z])) - ([x]([y]-[z]))) / (2*[z])
  3. }):
  4.  
  5. func(itersolve,{
  6.   [y] - ([x]([y])) / deriv([x],[y],[z])
  7. }):
  8.  
  9. func(newtonsolve, {
  10.   sub({
  11.     let(fxn,[x]):
  12.     let(ans,[y]):
  13.     for(<k,1,[z],1>, {
  14.       let(ans,itersolve([fxn],[ans],0.001))
  15.     }):
  16.     print_[ans]
  17.   })
  18. }):
  19.  
  20. func(lhopital,{
  21.   deriv([x],[z],.001) / deriv([y],[z],.001)
  22. }):
  23.  
  24. func(integral,{
  25.   sub({
  26.     let(fxn,[x]):
  27.     let(tot,0):
  28.     let(step,[t]):
  29.     for(<j,[y],[z],[step]>,{
  30.       let(tot, [tot] + [step] * [fxn]([j]) )
  31.     }):
  32.     print_[tot]
  33.   })
  34. }):
  35.  
  36. print_`calculus.txt':
  37.  

Next I wrote my first *.sic program:
Code: QB64: [Select]
  1. 10 PRINT SXR("include(`calculus.txt')")
  2.  
  3. REM Define the problem to solve.
  4. 20 p$ = "[x]^3 - 10"
  5.  
  6. REM Set guess value.
  7. 30 g = 1.5
  8.  
  9. REM Set number of iterations.
  10. 40 i = 5
  11.  
  12. 50 a$ = SXR("func(problem,{" + p$ + "})")
  13.  
  14. 60 PRINT SXR("newtonsolve(problem," + STR$(g) + "," + STR$(i) + ")")
  15.  

Note that all of the Sxript-ish stuff is stashed away in its own parens and the BASIC user doesn't need to really understand it. That is, the editable lines are 20, 30, and 40. (There are other style remarks implied in the code that are not spelled out.)

... and voila, it does its job of computing the cube root of 10 in this case. See the screenshot below, along with all files needed to replicate the changes. Stick the *.bi/bm files in the same level as the *.BAS at compile time.



sickx.png
* sickx.png (Filesize: 12.34 KB, Dimensions: 642x427, Views: 290)
* SIC64x.BAS (Filesize: 516.52 KB, Downloads: 232)
* newton.sic (Filesize: 0.29 KB, Downloads: 251)
* calculus.txt (Filesize: 0.59 KB, Downloads: 228)
* sxr.zip (Filesize: 19.19 KB, Downloads: 251)
You're not done when it works, you're done when it's right.

Offline eoredson

  • Newbie
  • Posts: 55
  • Let the Farce be with you!
    • View Profile
    • Oredson QB45 Files At Filegate
Re: The SICK project
« Reply #4 on: August 04, 2018, 10:32:06 pm »
Interesting.. Could you bundle up the above files into a separate .zip file please?

Thanks, Erik.
« Last Edit: August 04, 2018, 11:03:32 pm by eoredson »

Offline Aurel

  • Forum Regular
  • Posts: 167
    • View Profile
Re: The SICK project
« Reply #5 on: August 06, 2018, 03:11:32 pm »
hey static
do you ever use maxwell formulas?
//////////////////////////////////////////////////////////////////
https://aurelsoft.ucoz.com
https://www.facebook.com/groups/470369984111370
//////////////////////////////////////////////////////////////////

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: The SICK project
« Reply #6 on: August 07, 2018, 12:06:40 am »
Hi Erik and Aurel

(i) So I'm a bit confused as to why (Erik) you would ask me to re-combine the files above in an undoubtedly more confusing ZIP file. What's on your mind in this direction?

(ii) Maxwell "formulas" are a strange term... There are Maxwell "relations", which have to do with the second derivative of thermodynamic potentials, but I think you're really referring to Maxwell's "equations" of electromagnetism. So put it this way... I routinely address and manipulate Maxwell's equations in more (or fewer) dimensions than it requires to send you this message. Tensor calculus ftw bro! (Did you have a question, or just taking the temperature of my ego?)
« Last Edit: August 07, 2018, 12:08:12 am by STxAxTIC »
You're not done when it works, you're done when it's right.

Offline Aurel

  • Forum Regular
  • Posts: 167
    • View Profile
Re: The SICK project
« Reply #7 on: August 07, 2018, 12:15:28 pm »
but I think you're really referring to Maxwell's "equations" of electromagnetism.

Hi STATIC
Yes about electromagnetic
I found that those formulas are used to calculate current density on metal surfaces
In simple words:
when electromagnetic wave hit this metal surface then as we known electric current arrive .
it is about microstrip antennas.
I found few codes (in matlab or in python) but nothing in BASIC.
Did you ever made such a calculations?
//////////////////////////////////////////////////////////////////
https://aurelsoft.ucoz.com
https://www.facebook.com/groups/470369984111370
//////////////////////////////////////////////////////////////////