Author Topic: Lisp in Basic  (Read 208126 times)

0 Members and 4 Guests are viewing this topic.

Mike Lobanovsky

  • Guest
Re: Lisp in Basic
« Reply #165 on: August 05, 2014, 06:23:02 AM »
Hi Rob,

Both Belarusian and Russian languages would reduce an unaccented "o" to "a" so that "milk" would be pronounced as мааО.

But while the Russian grammar preserves the original orthography of root vowels irrespective of the position of accent in a word, the Belarusian orthography professes the write-as-you-hear approach so that all "o"'s are turned into "a"'s unless accented.

Hence Russian молоко turns into Belarusian малако, and the exact same phenomenon can be seen in the orthography of my own name.

The Ukrainian language does not know the reduction of vowels so "milk" will be both pronounced and spelt as молоко irrespective of the accent.


P.S. Oh, I missed your last question: no, "gazonk" doesn't ring the bell for me; it sure doesn't have any Slavonic roots in it. Isn't it coming from a Kyoto fork of the language?

« Last Edit: August 05, 2014, 07:25:13 AM by Mike Lobanovsky »

JRS

  • Guest
Re: Lisp in Basic
« Reply #166 on: August 05, 2014, 08:48:00 AM »
Thanks Mike !!!

So you don't think there is a UCASE() issue with the filename being passed?  I was using Dave's debugger and as it was parsing the load command, the resulting string was upper cased and escaped with \" characters. You got it to work so I must be seeing things.


Mike Lobanovsky

  • Guest
Re: Lisp in Basic
« Reply #167 on: August 05, 2014, 09:02:02 AM »
Bingo! :)

Actually everything that's a SYMBOL is uppercased before it goes into the hash table. It helps analyse the tokens char by char (reduces the range of possible cases to consider). That's how it ought to be.

Case sensitivity of Linux file names is another matter. I'm using a 32-bit Windows scriba.exe for debugging so I don't know how a Linux scriba handles this issue and if it requires a verbatim LispFileName or not. Please try and change lowercase fact.lisp to Fact.lisp but leave (load (quote fact.lisp)) unaltered. This check will tell you if the linuxoid SBLisp requires an exact match of filename characters.

JRS

  • Guest
Re: Lisp in Basic
« Reply #168 on: August 05, 2014, 09:48:30 AM »
Okay. Thanks for the tips.

Here is an interesting tutorial on learning programming using Scheme.

How to Design Programs


Mike Lobanovsky

  • Guest
Re: Lisp in Basic
« Reply #169 on: August 05, 2014, 10:27:02 AM »
A Lamer's Guide to SBLisp! :D

And as an immediate exercise for you as the developer, I'd suggest adding a valid ; comment marker to SBLisp. It shouldn't be too difficult to implement and it would also stimulate your parental instincts. :)

Mike Lobanovsky

  • Guest
Re: Lisp in Basic
« Reply #170 on: August 05, 2014, 12:07:51 PM »
FYI:

FBSL LISP in BASIC translation has been published on the FBSL site.

JRS

  • Guest
Re: Lisp in Basic
« Reply #171 on: August 05, 2014, 05:05:26 PM »
Yep. I'm going to have to deal with the UPPER case issue on Linux.

Code: [Select]
jrs@laptop:~/sb/sb22/sblisp$ scriba lisp.sb
Initializing Memory...
Initializing Lisp Environment...
LISP in BASIC v1.3 by Arthur Nunes-Harwitt
0](load (quote factfunc.scm))
FACTFUNC.SCM  1
(0): error &H16:The file can not be opened.
jrs@laptop:~/sb/sb22/sblisp$

Mike Lobanovsky

  • Guest
Re: Lisp in Basic
« Reply #172 on: August 05, 2014, 05:07:32 PM »
... as it was parsing the load command, the resulting string was upper cased and escaped with \" characters.

Sorry John,

I missed this question somehow. No, you weren't seeing things. As the LISP parser was trying to chew the "filename.ext" string, the SB parser was dealing with its individual characters. Presumably, a \" escape is its internal representation of the DQ glyph similar to how it is expressed within a C string (SB is written in C). This is because strictly speaking, the debugger doesn't respond to what goes on in your SB "program" but rather to what happens in its underlying machine code compiled from the C language sources.

Now that we know SBLisp doesn't recognise enquoted strings, we aren't using DQ's and you won't see such escaped artifacts in your debugger any more.

This implementation of the language doesn't distinguish between numeric data and enquoted string data. It only distinguishes between evaluatable/executable statements, variables, and data literals as a whole. A data literal is an entity enclosed in parentheses and denoted with a quote marker in between them. Data literals are never executed or evaluated and their corresponding parentheses don't denote a command but rather the bounds (scope) of the literal.

That said, (load (quote filename.ext)) can be understood as a command to accept filename.ext as a literal non-evaluatable non-executable piece of data and apply it to load as an argument for execution, or in simpler words, as a command to load filename.exe.

Pooh! :)

Mike Lobanovsky

  • Guest
Re: Lisp in Basic
« Reply #173 on: August 05, 2014, 05:10:33 PM »
Yep. I'm going to have to deal with the UPPER case issue on Linux.

Be forewarned you're gonna lose case insensitivity of the entire language if you just remove the UCASE() conversion blindly.  :-\

JRS

  • Guest
Re: Lisp in Basic
« Reply #174 on: August 05, 2014, 05:15:03 PM »
Agreed but isn't the symbol (LOAD) known at that point and I can handle it with a IF?

Mike Lobanovsky

  • Guest
Re: Lisp in Basic
« Reply #175 on: August 05, 2014, 05:20:59 PM »
Strictly speaking, it is. But to intercept a LOAD XXXXX[.XXX] sequence, you will have to constantly monitor at once the contents of at least one current element of two arrays - the code stack array and the data stack array. It will be very, very burdensome for an interpreted Linux SBLisp. You will be losing the benchmark race to FBSL and Windows SBLisp by at least two fold. ;)

Mike Lobanovsky

  • Guest
Re: Lisp in Basic
« Reply #176 on: August 05, 2014, 05:23:59 PM »
I have a palliating proposition. ;)

JRS

  • Guest
Re: Lisp in Basic
« Reply #177 on: August 05, 2014, 05:44:33 PM »
I'm all ears.

Mike Lobanovsky

  • Guest
Re: Lisp in Basic
« Reply #178 on: August 05, 2014, 06:28:24 PM »
Sorry, I've been held in an iron embrace of HAL 9000 for awhile.

So, since user input is a millenium-long operation from the CPU perspective, it would be reasonable to squeeze the entire LispFileName/filename.ext evaluation procedure into the LispOpenInputFile: block. Here's where you can afford a SELECT CASE or IF block (or a set of labeled subsections) of virtually unlimited length without any perceptible lag.

Let the LispFileName symbol be stored as it is now, in uppercase. Use SELECT CASE or IF (or a set of labeled subsections) within LispOpenInputFile: to transform the uppercase LispFileName into all sorts of imaginable spelling. Try all uppercase; all lowercase; lower for name and upper for extension and vice versa;  check for an underscore in the name and try mixed (camel) case for its parts in every combination; check for a space and retry the preceding combinations; etc. etc. etc. - all of this while trapping the error &H16:The file can not be opened. with SB's own ON ERROR ... to redirect execution to the next option in your SELECT CASE or IF chain (or a set of labeled subsections). And finally, let CASE ELSE or ELSE or trailing subsection label throw the &H16 exception.

Subjectively, this will be executed instantly and it won't affect the interpreter's speed in any way because it will be a one-time action.
« Last Edit: August 05, 2014, 06:38:04 PM by Mike Lobanovsky »

JRS

  • Guest
Re: Lisp in Basic
« Reply #179 on: August 05, 2014, 06:58:41 PM »
All good points. Let me take a look at the easiest and fastest way of fixing this and put a note in the code to come back to it.  :)