Talk:BASIC token

From C64-Wiki
Jump to navigationJump to search

Does anyone know how the "invisible LET" was stored? I see that the LET is token $88, but is the same token used for:

   100 LET A=10

vs:

   100 A=10

Maury Markowitz (talk) 16:51, 7 December 2020 (CET)


In BASIC V.2 is LET A=10 the same like A=10 (short form). Normally you use not the LET command in CBM BASIC V.2. You use only the short form!
I think the BASIC interpreter used the same token for a variable declaration with LET and without LET.--Jodigi (talk) 19:10, 7 December 2020 (CET)
But then how does LIST work? Does it simply remove any LET that you typed in, sort of how ? turns into PRINT? Maury Markowitz (talk) 20:46, 7 December 2020 (CET)
No, I tried that, typing a LET does come out in the LIST. Maury Markowitz (talk) 22:23, 7 December 2020 (CET)
There is no token at all if LET is omitted. The interpreter asumes the if a statement does not start with a token, it could only be a LET (without the token ;) ). So the parsing continues at the state as an imaginary LET would has been read. Therefore LIST only shows what is actually there. --JohannKlasek (talk) 14:21, 8 December 2020 (CET)
Ah, thanks Johann. Maury Markowitz (talk) 18:03, 6 December 2021 (CET)

Assignment vs. "is-equal"?[edit source]

I see that token $B2 is "= (equals operator)". Is this token also used in assignments, like "A=10"? Or is the = in that case left in ASCII format? Maury Markowitz (talk) 18:03, 6 December 2021 (CET)

The assignment (LET) and the comparative operator "=" found in expressions is always coded with the token byte $B2, only in strings it get coded as $3D. --JohannKlasek (talk) 01:19, 7 December 2021 (CET)
So when you say "in strings" do you mean "this string has an = sign" will have a $3D, but any = found outside a string is $B2? Maury Markowitz (talk) 14:46, 25 April 2022 (CEST)
Yes, exactly. You got it. :) You might put "in strings" as an abbreviation of "in a string constant, any character sequence started with a (") until a (") or end of line ... The parsing in the interpreter has two states: outside and inside a double-quoted character sequence. The inside part denotes a string constant. --JohannKlasek (talk) 21:58, 4 May 2022 (CEST)

Why does SPC and TAB have ( in the name?[edit source]

The list here, and the pages they link to, have the opening paren in the name for SPC( and TAB(. None of the other functions do this. Is there something special about these? Maury Markowitz (talk) 15:45, 14 October 2026 (CEST)

SPC and TAB are not functions in the usual sense. You can say A=SIN(3) but not A=SPC(3). SPC and TAB are modifiers for the PRINT statement. Including the parenthesis might have simplified the implementation.--Ray Chason (talk) 03:28, 16 October 2026 (CEST)