I'm in the process of converting BASIC over to use this new assembler... and have hit a few snags. I'm happy to patch, but don't know if this is the Right Thing or not.
At 12:39 AM 6/1/2002 -0400, you wrote: >Support for keyed parameters now exists. I need to change the name of >the 'set_keyed' and 'get_keyed' operator to just 'set', since they >should be relatively unambiguous. Anyway, here's the new syntax >available at the assembly level: Looks great. Converted over with little sweat, noted below. >The next feature which Clinton used in his BASIC compiler but had to do >by hand is a manifest constant. You can use the following syntax to >define an assemble-time constant: > >..constant PerlHash 6 # Important, because the special names 'PerlHash' This should actually be: ..constant PerlHash 6 Right? I was doing a simple X for Y transformation using a pattern like this: ^.const\s+(\w+)\s+(.*) This let me rename registers for sake of clarity. I'm missing that. It's a simple hack, just add an elsif block that looks like: } elsif(/^\.constant \s+ (\w+) \s+ ([NISP]\d+) /x) { # .constant {name} {string $self->{constants}{$1} = $2; } Other things to note: The assembler seems unhappy with multiple labels for the same codepoint. This is no longer allowed: NSORT: COMBSORT: operation.... To allow a bsr NSORT or a bsr COMBSORT to jump to the same instruction you now have to write: NSORT: noop COMBSORT: operation.... And it works fine. The keyed operators get_keyed, set_keyed are unhappy with constants: get_keyed S0, P0[0] For example. Writing them the old way still works. After all this, and checking it in I still can't get BASIC to assemble correctly. The last remaining error I get is: C:\projects\parrot\parrot\languages\BASIC>..\..\parrot.exe basic.pbc PackFile_Constant_clear: Unrecognized type ' ' during unpack! PackFile_unpack: Error reading constant table segment! Parrot VM: Can't unpack packfile basic.pbc. BASIC's all checked in with the corrections noted above. I patched my version of assemble.pl to allow register redefinition (.constant FOO I0). But other than that, once this last error is found it's ready to go. Suggestions?