Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Weird problem with strings / arrays (*solved*)
#1
Hopefully my example listing makes it clear!

Code:
' using version 1.4.0s1864

paper 0
border 0
ink 7
cls

dim textArray(1) as string
dim text as string
dim i as UBYTE

text = "This is a string."

i = 0

textArray(i) = text ' doesn't work - generates "Out of Memory" error if compiled with --debug-memory

textArray(i) = "" + text ' works fine

textArray(0) = text ' works fine

print textArray(0)
pause 0
end

' why does the first method not work?
Reply
#2
Just arrived from Barcelona (for easters). :roll:
This is a *NASTY* severe bug :!: I'm going to fix it ASAP, and tell you when it's fixed. Sorry.

UPDATE: Fixed! As always, it turns out to be a single line of code. Please, download and check Version 1.4.0-r1869.
This bug *ALSO EXIST* in previous version ZX Basic 1.3.x :!:
Reply
#3
Thanks for looking at this bug, but unfortunately it still crashes with the "Out of Memory" error (when compiled with --debug-memory).

Also, with this new version, when I compile to TZX, it now generates 3 Python files:
  • parsetab.py (305 KB)
  • zxbasmtab.py (52 KB)
  • zxbpptab.py (22 KB)
The version I was using before (1.4.0s1864) didn't do that!
Reply
#4
Mousey Wrote:Thanks for looking at this bug, but unfortunately it still crashes with the "Out of Memory" error (when compiled with --debug-memory).

Also, with this new version, when I compile to TZX, it now generates 3 Python files:
  • parsetab.py (305 KB)
  • zxbasmtab.py (52 KB)
  • zxbpptab.py (22 KB)
The version I was using before (1.4.0s1864) didn't do that!
Sad Ooops!

It should generate those .py files. The previous version did not, because I already packaged them.
Please, go into the zxb.py directory (BTW you are using the .py version, aren't you?), and execute zxb.py --version ONCE. Leave the generated .py files there, as it will speed up the compiler a lot.

Note: This fix should (at least) correct the Array(i) = TextString. So the assignation is correctly done.
Reply
#5
[quote="boriel"][quote="Mousey"]Thanks for looking at this bug, but unfortunately it still crashes with the "Out of Memory" error (when compiled with --debug-memory).

Please tell me which version are you using (zxb --version)
To me it all works ok. It should read zxb.py 1.4.0-s1869
Reply
#6
boriel Wrote:Please tell me which version are you using (zxb --version)
To me it all works ok. It should read zxb.py 1.4.0-s1869
I have downloaded and tested with the "Development Version" located here:
<!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Archive">http://www.boriel.com/wiki/en/index.php ... IC:Archive</a><!-- m -->

But the zxb.py version contained in both the .zip and the tar.gz packages is stated as "1.3.0-s1771". Was the wrong version uploaded, or has the version string just not been updated?

Either way, the above test program still reports "Out of Memory" when compiled with --debug-memory.

I am running Python version 2.7.6, on Mac OS X 10.9, in case that helps.
Reply
#7
Mousey Wrote:
boriel Wrote:Please tell me which version are you using (zxb --version)
To me it all works ok. It should read zxb.py 1.4.0-s1869
I have downloaded and tested with the "Development Version" located here:
<!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Archive">http://www.boriel.com/wiki/en/index.php ... IC:Archive</a><!-- m -->

But the zxb.py version contained in both the .zip and the tar.gz packages is stated as "1.3.0-s1771". Was the wrong version uploaded, or has the version string just not been updated?

Either way, the above test program still reports "Out of Memory" when compiled with --debug-memory.

I am running Python version 2.7.6, on Mac OS X 10.9, in case that helps.
Sorry for the delay (was travelling abroad!).
You were right. It was an upload from an old repo. Please, try now??
Reply
#8
boriel Wrote:You were right. It was an upload from an old repo. Please, try now??
Hi - I have also been travelling (just spent 2 weeks in the USA!), so sorry for the delay replying.

I have downloaded it again, and is now reporting the version as:

zxb.py 1.4.0alpha-s1769

not zxb.py 1.4.0-s1869 as it should be! Was this alpha version uploaded in error?

Also, when I try to compile with this version, it gives an error:
Code:
Traceback (most recent call last):
  File "../1.4.0/zxb.py", line 348, in <module>
    sys.exit(main(sys.argv))  # Exit
  File "../1.4.0/zxb.py", line 274, in main
    translator.visit(zxbparser.ast)
  File "/Users/MacMini/Dropbox/Boriel/1.4.0/ast_/ast.py", line 102, in visit
    stack.append(last.send(last_result))
  File "/Users/MacMini/Dropbox/Boriel/1.4.0/arch/zx48k/translator.py", line 538, in visit_ARRAYACCESS
    self.emit('param' + self.TSUFFIX(gl.BOUND_TYPE), node.entry.bounds.count)
AttributeError: 'SymbolBOUNDLIST' object has no attribute 'count'
The same code compiles fine with earlier versions.
Reply
#9
Sorry for the delay.
Apparently I messed up the build script for the python version.
Can you check it now?
Please check the version.
zxb.py --version
should return:
zxb.py 1.4.0-s1876
Reply
#10
boriel Wrote:Sorry for the delay.
Apparently I messed up the build script for the python version.
Can you check it now?
Please check the version.
zxb.py --version
should return:
zxb.py 1.4.0-s1876
Well, the good news is that I finally have version 1.4.0-s1876! The bad news is, it still fails to compile the example listing, with the following error:
Code:
Traceback (most recent call last):
  File "../1.4.0/zxb.py", line 348, in <module>
    sys.exit(main(sys.argv))  # Exit
  File "../1.4.0/zxb.py", line 274, in main
    translator.visit(zxbparser.ast)
  File "/Users/MacMini/Dropbox/Boriel/1.4.0/ast_/ast.py", line 102, in visit
    stack.append(last.send(last_result))
  File "/Users/MacMini/Dropbox/Boriel/1.4.0/arch/zx48k/translator.py", line 542, in visit_ARRAYACCESS
    self.emit('param' + self.TSUFFIX(gl.BOUND_TYPE), node.entry.bounds.count)
AttributeError: 'SymbolBOUNDLIST' object has no attribute 'count'
Very similar to the error given with version 1.4.0alpha-s1769, the only difference I can see is the last error is on line 542 instead of 538.

So, to summarise, here are the versions I have tried and the results:

1.3.0-s1771 - Out of Memory error
1.4.0s1864 - Out of Memory error
1.4.0alpha-s1769 - Fails to compile
1.4.0-s1876 - Fails to compile
Reply
#11
Mousey Wrote:So, to summarise, here are the versions I have tried and the results:

1.3.0-s1771 - Out of Memory error
1.4.0s1864 - Out of Memory error
1.4.0alpha-s1769 - Fails to compile
1.4.0-s1876 - Fails to compile

Sorry, but can't reproduce your bug. I've used this version.
Please, make a CLEAN installation of the compiler in a new directory and check its version number reads 1.4.0-s1876
I've compiled the listing above successfully (no bugs, no compiler error).
Reply
#12
boriel Wrote:Sorry, but can't reproduce your bug. I've used this version.
Please, make a CLEAN installation of the compiler in a new directory and check its version number reads 1.4.0-s1876
I've compiled the listing above successfully (no bugs, no compiler error).
Ok, some good news and bad news. Smile

Firstly - I always install a new version to a completely fresh directory, as I know how important this is! But now onto the news:

I now know what is causing the compiler to fail! I forgot to tell you (sorry!) that I compile with both the --debug-memory and also the --debug-array flag (for array boundary checking).

If you try to compile with the --debug-array flag, the above test program fails with the errors I've already posted. However, if you compile with just the --debug-memory flag, it compiles fine, and also the bug is fixed! Smile

Thanks for all your work so far, it really is appreciated. Any chance the --debug-array problem could be looked into?
Reply
#13
Mousey Wrote:If you try to compile with the --debug-array flag, the above test program fails. However, if you compile with just the --debug-memory flag, it compiles file, and also the bug is fixed! Smile

Thanks for all your work so far, it really is appreciated. Any chance the --debug-array problem could be looked into?
Oh, thanks a lot!! :!: will check it ASAP!
Reply
#14
boriel Wrote:Oh, thanks a lot!! :!: will check it ASAP!
That's great, thanks boriel. Smile
Reply
#15
Mousey Wrote:
boriel Wrote:Oh, thanks a lot!! :!: will check it ASAP!
That's great, thanks boriel. Smile
Try now and download the latest version 1.4.0s1881 and tell me, please. :wink:
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)