cvsuser 03/06/23 18:54:14
Modified: languages/BASIC/compiler COMP_parsefuncs.pm COMP_parser.pm
RT_builtins.pasm RT_initialize.pasm RT_io.pasm
RT_platform.pasm RT_platform_ANSIscreen.pasm
RT_platform_win32.pasm RT_support.pasm
Log:
inkey$ almost works properly
Revision Changes Path
1.16 +6 -0 parrot/languages/BASIC/compiler/COMP_parsefuncs.pm
Index: COMP_parsefuncs.pm
===================================================================
RCS file: /cvs/public/parrot/languages/BASIC/compiler/COMP_parsefuncs.pm,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -w -r1.15 -r1.16
--- COMP_parsefuncs.pm 12 Jun 2003 02:52:59 -0000 1.15
+++ COMP_parsefuncs.pm 24 Jun 2003 01:54:14 -0000 1.16
@@ -211,6 +211,7 @@
branch ONOK_${ons}
ONERR_${ons}:
call _ERR_ON_RANGE
+ call _platform_shutdown
end
ONOK_${ons}:
ON
@@ -495,6 +496,7 @@
print "Stopped at source line "
print I11
print "\\n"
+ call _platform_shutdown
end
STOP
}
@@ -1218,6 +1220,7 @@
print "Function $englishname received "
print argc
print " arguments expected $_\\n"
+ call _platform_shutdown
end
${englishname}_ARGOK:
EOH
@@ -1327,6 +1330,7 @@
print "Structure type of "
print S0
print " not found\\n"
+ call _platform_shutdown
end
DISP2
@@ -1346,6 +1350,7 @@
print "Structure type of "
print S0
print " not found\\n"
+ call _platform_shutdown
end
DISP2
RTJUMP:
@@ -1364,6 +1369,7 @@
print "Runtime branch of "
print JUMPLABEL
print " not found\\n"
+ call _platform_shutdown
end
RTBE
}
1.12 +1 -1 parrot/languages/BASIC/compiler/COMP_parser.pm
Index: COMP_parser.pm
===================================================================
RCS file: /cvs/public/parrot/languages/BASIC/compiler/COMP_parser.pm,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -w -r1.11 -r1.12
--- COMP_parser.pm 17 Jun 2003 02:24:48 -0000 1.11
+++ COMP_parser.pm 24 Jun 2003 01:54:14 -0000 1.12
@@ -250,7 +250,7 @@
print CODE "CASE_$s->{jump}_FIN:\n";
goto PARSE;
}
- push @{$code{$seg}->{code}}, "\tend\n";
+ push @{$code{$seg}->{code}}, "\tcall _platform_shutdown\n\tend\n";
goto PARSE;
}
die "Unkown keyword $syms[CURR]/$type[CURR] source line $sourceline";
1.7 +5 -2 parrot/languages/BASIC/compiler/RT_builtins.pasm
Index: RT_builtins.pasm
===================================================================
RCS file: /cvs/public/parrot/languages/BASIC/compiler/RT_builtins.pasm,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -w -r1.6 -r1.7
--- RT_builtins.pasm 23 Jun 2003 03:40:07 -0000 1.6
+++ RT_builtins.pasm 24 Jun 2003 01:54:14 -0000 1.7
@@ -579,7 +579,10 @@
restoreall
ret
.end
-.sub _BUILTIN_INKEY_STRING
+.sub _BUILTIN_INKEY_STRING # string inkey$(void)
+ .param int argc
+ call _scan_read # Put terminal in char-at-a-time mode
call _inkey_string
ret
.end
\ No newline at end of file
+
1.7 +1 -0 parrot/languages/BASIC/compiler/RT_initialize.pasm
Index: RT_initialize.pasm
===================================================================
RCS file: /cvs/public/parrot/languages/BASIC/compiler/RT_initialize.pasm,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -w -r1.6 -r1.7
--- RT_initialize.pasm 17 Jun 2003 02:24:48 -0000 1.6
+++ RT_initialize.pasm 24 Jun 2003 01:54:14 -0000 1.7
@@ -25,6 +25,7 @@
call _data_run
call _platform_setup
call _basicmain_run
+ call _platform_shutdown
end
.end
1.3 +3 -0 parrot/languages/BASIC/compiler/RT_io.pasm
Index: RT_io.pasm
===================================================================
RCS file: /cvs/public/parrot/languages/BASIC/compiler/RT_io.pasm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -r1.2 -r1.3
--- RT_io.pasm 6 Jun 2003 21:25:56 -0000 1.2
+++ RT_io.pasm 24 Jun 2003 01:54:14 -0000 1.3
@@ -4,6 +4,8 @@
#
# Not a lot of error handling here yet
.sub _READCHARS # string readchars(int numchar, int fd)
+ call _line_read
+
saveall
.param int numchar
.param int fd
@@ -64,6 +66,7 @@
# # Returns:
# # I0 Error?
.sub _READLINE # string readline(int fd)
+ call _line_read
saveall
.param int fd
set $S0, ""
1.13 +31 -23 parrot/languages/BASIC/compiler/RT_platform.pasm
Index: RT_platform.pasm
===================================================================
RCS file: /cvs/public/parrot/languages/BASIC/compiler/RT_platform.pasm,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -w -r1.12 -r1.13
--- RT_platform.pasm 23 Jun 2003 03:53:02 -0000 1.12
+++ RT_platform.pasm 24 Jun 2003 01:54:14 -0000 1.13
@@ -10,6 +10,16 @@
END: restoreall
ret
.end
+.sub _platform_shutdown
+ saveall
+ sysinfo S0, 4
+ ne S0, "MSWin32", NOTWIN
+ call _win32_shutdown
+ branch END
+NOTWIN: call _ansi_shutdown
+END: restoreall
+ ret
+.end
.sub _screen_clear
saveall
find_global $P0, "PRINTCOL"
@@ -76,6 +86,26 @@
END: restoreall
ret
.end
+
+.sub _line_read
+ saveall
+ .local string sys
+ sysinfo sys, 4
+ eq sys, "MSWin32", END
+ call _TERMIO_normal
+END: restoreall
+ ret
+.end
+.sub _scan_read
+ saveall
+ .local string sys
+ sysinfo sys, 4
+ eq sys, "MSWin32", END
+ call _TERMIO_scankey
+END: restoreall
+ ret
+.end
+
.sub _inkey_string # string inkey$(void)
saveall
.local string sys
@@ -83,29 +113,7 @@
ne sys, "MSWin32", NOTWIN
call _WIN32_INKEY
branch END
-NOTWIN: call _POSIX_INKEY
+NOTWIN: call _TERMIO_INKEY
END: restoreall
ret
.end
-## Problem in ANSI
-#SCREEN_GETFORE:
-# sysinfo S0, 4
-# set I0, 0
-# ne S0, "MSWin32", SCREEN_GETFORE_NOTWIN
-# bsr WIN32_SCREEN_GETFORE
-#SCREEN_GETFORE_NOTWIN:
-# new P6, .PerlArray
-# set P6[.TYPE], "INT"
-# set P6[.VALUE], I0
-# ret
-#
-#SCREEN_GETBACK:
-# sysinfo S0, 4
-# set I0, 0
-# ne S0, "MSWin32", SCREEN_GETBACK_NOTWIN
-# bsr WIN32_SCREEN_GETBACK
-#SCREEN_GETBACK_NOTWIN:
-# new P6, .PerlArray
-# set P6[.TYPE], "INT"
-# set P6[.VALUE], I0
-# ret
1.8 +116 -17 parrot/languages/BASIC/compiler/RT_platform_ANSIscreen.pasm
Index: RT_platform_ANSIscreen.pasm
===================================================================
RCS file: /cvs/public/parrot/languages/BASIC/compiler/RT_platform_ANSIscreen.pasm,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -w -r1.7 -r1.8
--- RT_platform_ANSIscreen.pasm 23 Jun 2003 03:53:02 -0000 1.7
+++ RT_platform_ANSIscreen.pasm 24 Jun 2003 01:54:14 -0000 1.8
@@ -37,6 +37,11 @@
set $P0[14], YELLOW
set $P0[15], 8
store_global "ANSI_bgcolors", $P0
+
+ $P0=new PerlHash
+ $P0["value"]=0
+ store_global "scankey", $P0
+
restoreall
ret
.end
@@ -45,6 +50,10 @@
print "\e[H"
ret
.end
+.sub _ansi_shutdown
+ call _TERMIO_normal
+ ret
+.end
.sub _ANSI_SCREEN_LOCATE # void ansi_screen_locate (int x, int y)
saveall
.param int x
@@ -109,40 +118,130 @@
restoreall
ret
.end
-.sub _POSIX_INKEY
+.sub _set_noecho_cbreak
saveall
loadlib P1, ""
- dlfunc P0, P1, "system", "it"
+ dlfunc P0, P1, "ioctl", "iiip"
set I0, 1
- set S5, "stty cbreak -echo"
- invoke
+ P9 = new ManagedStruct # Saved
+ P10 = new ManagedStruct # New
+ set P9, 20 # sizeof termio 4/byte aligned
+ set P10, 20
+ set I5, 0
+ set I6, 0x5405 # TCGETA
+ set P5, P9
+ invoke # ioctl(0, TCGETA, &savetty);
+ set I5, 0
+ set I6, 0x5405
+ set P5, P10
+ invoke # ioctl(0, TCGETA, &settty);
+ .arg 2
+ .arg 6
+ .arg P10
+ call _get_little_endian
+ .result I0
+ set I1, 2 # ICANON
+ bnot I1, I1 # ~ICANON
+ band I0, I0, I1 # settty.c_lflag &= ~ICANON;
+ set I1, 8 # IECHO
+ bnot I1, I1 # ~ICANON
+ band I0, I0, I1 # settty.c_lflag &= ~ECHO;
+ .arg I0
+ .arg 2
+ .arg 6
+ .arg P10
+ call _set_little_endian
+ set I5, 0
+ set I6, 0x5408
+ set P5, P10
+ invoke # ioctl(0, TCSETAF, &settty);
+ store_global "ioctl_mode", P9
+ restoreall
+ ret
+.end
+.sub _set_echo_nocbreak
+ saveall
+ loadlib P1, ""
+ dlfunc P0, P1, "ioctl", "iiip"
+ find_global P9, "ioctl_mode"
+ set I5, 0
+ set I6, 0x5408
+ set P5, P9
+ invoke # ioctl(0, TCSETAF, &savetty)
+ restoreall
+ ret
+.end
+.sub _set_nonblock # void _set_nonblock
+ saveall
+ set I11, 0
+ loadlib P1, ""
dlfunc P0, P1, "fcntl", "iiii"
set I0, 1
set I5, 0 # Stdin
set I6, 3 # F_GETFL
- invoke
+ invoke # mode=fcntl(0, F_GETFL, unused)
- set I9, I5 # Old values
+ set I11, I5 # Old values
+ dlfunc P0, P1, "fcntl", "iiil"
bor I7, I5, 2048 # O_NONBLOCK 04000
set I5, 0 # Stdin
set I6, 4 # F_SETFL
- invoke
+ invoke # nmode=fcntl(0, F_SETFL, mode | O_NONBLOCK)
- read S0, 1
-
- set I7, I9
+ $P0=new PerlHash
+ set $P0["value"], I11
+ store_global "fcntl_mode", $P0
+ restoreall
+ ret
+.end
+.sub _unset_nonblock # void _unset_nonblock
+ saveall
+ find_global P0, "fcntl_mode"
+ set I11, P0["value"]
+ loadlib P1, ""
+ dlfunc P0, P1, "fcntl", "iiil"
+ set I7, I11
set I5, 0
set I6, 4
- invoke
+ invoke # nmode=fcntl(0, F_SETFL, mode)
+ restoreall
+ ret
+.end
+.sub _TERMIO_scankey
+ saveall
+ find_global $P0, "scankey"
+ set I0, $P0["value"]
+ eq I0, 1, END
+ #call _set_nonblock
+ call _set_noecho_cbreak
+END: set $P0["value"], 1
+ store_global "scankey", $P0
+ restoreall
+ ret
+.end
+.sub _TERMIO_normal
+ saveall
+ find_global $P0, "scankey"
+ set I0, $P0["value"]
+ eq I0, 0, END
+ #call _unset_nonblock
+ call _set_echo_nocbreak
+END: set $P0["value"], 0
+ store_global "scankey", $P0
+ restoreall
+ ret
+.end
- loadlib P1, ""
- dlfunc P0, P1, "system", "it"
- set I0, 1
- set S5, "stty -cbreak echo"
- invoke
+# For now, uses TERMIO calls directly and assumes you're on a
+# LITTLE ENDIAN machine.
+.sub _TERMIO_INKEY
+ saveall
- .return S0
+ read $S0, 1
+
+ .return $S0
restoreall
ret
.end
+
1.10 +3 -0 parrot/languages/BASIC/compiler/RT_platform_win32.pasm
Index: RT_platform_win32.pasm
===================================================================
RCS file: /cvs/public/parrot/languages/BASIC/compiler/RT_platform_win32.pasm,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -w -r1.9 -r1.10
--- RT_platform_win32.pasm 23 Jun 2003 03:40:07 -0000 1.9
+++ RT_platform_win32.pasm 24 Jun 2003 01:54:14 -0000 1.10
@@ -19,6 +19,9 @@
restoreall
ret
.end
+.sub _win32_shutdown # void win32_shutdown(void)
+ ret
+.end
.sub _WIN32_CONSOLE_INFO # void WIN32_CONSOLE_INFO(void)
saveall
find_global P1, "kernel32"
1.5 +35 -984 parrot/languages/BASIC/compiler/RT_support.pasm
Index: RT_support.pasm
===================================================================
RCS file: /cvs/public/parrot/languages/BASIC/compiler/RT_support.pasm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -r1.4 -r1.5
--- RT_support.pasm 6 Jun 2003 21:25:56 -0000 1.4
+++ RT_support.pasm 24 Jun 2003 01:54:14 -0000 1.5
@@ -66,989 +66,40 @@
ret
.end
-# # Runtime support functions
-#
-# # ##############################
-# # FOR_SIGN Determine how the initial for-loop
-# # should be run.
-# # Inputs:
-# # S0 for variable name
-# # S2 for variable type (INT/FLO)
-# # Outputs:
-# # I0 = -1 end < start and sign(step) == -1
-# # 0 INVALID sign(end-start) != sign(step)
-# # 1 start < end and sign is positive
-# # Based on the for-structure in P11
-#FOR_SIGN:
-# pushp
-# bsr FOR_SETUP # Sets P3, P4, P5 based on S0, S2
-# bsr CASTFLOATS # Sets N3, N4, N5 based on Px
-# set I0, 0
-#
-# eq N5, 0.0, CASE1 # Always OK.
-# lt N5, 0.0, STEPLOW # step is negative.
-#
-#STEPHI: lt N3, N4, CASE1
-# gt N3, N4, CASE0
-# branch CASE1
-#
-#STEPLOW:lt N3, N4, CASE0
-# gt N3, N4, CASEN1
-# branch CASEN1
-#
-#CASEN1: set I0, -1
-# branch END_FOR_SIGN
-#CASE1: set I0, 1
-# branch END_FOR_SIGN
-#CASE0: set I0, 0
-#END_FOR_SIGN:
-# popp
-# ret
-#
-#
-# # ############################
-# # Sets P3, P4, P5 based on S0, S2
-# # for current stackframe
-#FOR_SETUP:
-# #print "For Setup\n"
-# set P0, P11[I25]
-# set P1, P0["FOR"]
-# set P0, P1[S2]
-# set P1, P0[S0]
-#
-# set P3, P1["start"]
-# set P4, P1["finish"]
-# set P5, P1["step"]
-# ret
-#
-# # #############################
-# # Take P3, P4, P5 and set N3, N4, N5
-# # (sets original types in S3, S4, S5 by accident)
-#CASTFLOATS:
-# #print "Cast floats\n"
-# set S3, P3[.TYPE]
-# eq S3, "INT", START_INT
-# set N3, P3[.VALUE]
-# branch FOR_CAST2
-#START_INT:
-# set I3, P3[.VALUE]
-# set N3, I3
-#
-#FOR_CAST2:
-# set S4, P4[.TYPE]
-# eq S4, "INT", START_INTx
-# set N4, P4[.VALUE]
-# branch FOR_CAST3
-#START_INTx:
-# set I4, P4[.VALUE]
-# set N4, I4
-#
-#FOR_CAST3:
-# set S5, P5[.TYPE]
-# eq S5, "INT", START_INTy
-# set N5, P5[.VALUE]
-# branch FOR_CAST4
-#START_INTy:
-# set I5, P5[.VALUE]
-# set N5, I5
-#FOR_CAST4:
-# ret
-#
-#ERR_FORINVALID:
-# print "FOR loop has invalid start/end/step\n"
-# branch GEN_ERROR
-#
-# # ##############
-# # Using I1
-# # I1=-1 S0= ">"
-# # I1=1 S0= "<"
-#WHICH_COMPARE:
-# eq I1, -1, EXPR_LE
-# eq I1, 1, EXPR_GE
-# print "Error in for-loop comparison\n"
-# branch GEN_ERROR
-#
-# # ###############
-# # Push step/finish
-# # Set S0 to "step" or "finish"
-# # Set S1 to the variable
-# # Set S2 to the type
-# # Returns: P7 all set up
-#PUSHSTEP:
-# set P1, P11[I25]
-# set P2, P1["FOR"]
-# set P1, P2[S2]
-# set P2, P1[S1]
-# set P1, P2[S0]
-# set S0, P1[.TYPE]
-# eq S0, "INT", PUSHSTEPINT
-# eq S0, "FLO", PUSHSTEPFLO
-# print "Invalid step type"
-# branch GEN_ERROR
-#PUSHSTEPINT:
-# set I0, P1[.VALUE]
-# new P7, .PerlArray
-# set P7[.TYPE],"INT"
-# set P7[.VALUE],I0
-# ret
-#PUSHSTEPFLO:
-# set N0, P1[.VALUE]
-# new P7, .PerlArray
-# set P7[.TYPE],"FLO"
-# set P7[.VALUE],N0
-# ret
-#
-# # ##########################
-# # Do next read for READ/DATA
-# # P15 has the data itself
-# # P16 has the index (for restore)
-# # I15 is the current pointer
-# # Trashes I0
-# # Returns:
-# # P0 value read.
-#READ: set I0, P15
-# dec I0
-# lt I0, I15, ERR_READ
-# set P0, P15[I15]
-# inc I15
-# ret
-#
-# # ####################################
-# # Index you want to restore into in S0
-# # An invalid "restore X" statement generates
-# # no error! It simply does a "restore"
-#RESTORE:set I15, P16[S0]
-# ret
-#
-#ERR_READ:
-# print "Out of data"
-# branch GEN_ERROR
-.sub _ERR_ON_RANGE
- print "On.. range must be between 0 and 255"
- call _GEN_ERROR
- end
+.sub _get_little_endian # int get_little_endian(struct, offset, bytes)
+ saveall
+ .param ManagedStruct struct
+ .param int offset
+ .param int bytes
+ .local int target
+ set target, 0
+ eq bytes, 0, END
+ add $I6, offset, bytes
+LOOP: lt $I6, offset, END
+ shl target, target, 8
+ set $I3, struct[$I6]
+ add target, target, $I3
+ dec $I6
+ branch LOOP
+END: .return target
+ restoreall
+ ret
.end
-.sub _GEN_ERROR
- print "Error.\n"
- end
+.sub _set_little_endian # void set_little_endian(struct, offset, bytes, value)
+ saveall
+ .param ManagedStruct struct
+ .param int offset
+ .param int bytes
+ .param int value
+ add $I6, offset, bytes
+ eq bytes, 0, END2
+LOOP2: eq offset, $I6, END2
+ band $I1, value, 255
+ shr value, value, 8
+ set struct[offset], $I1
+ inc offset
+ branch LOOP2
+END2: restoreall
+ ret
+
.end
-#
-#
-# # ####################################
-# # GUESSTYPE
-# # Input:
-# # S1 A string of some kind
-# # Return:
-# # P0 A typed value, BASIC-style
-# # Trashes: I0, N1, N0
-# # Method:
-# # Convert the string to Integer and Float.
-# # If zero, call it a string.
-#GUESSTYPE:
-# pushs
-# set I0, 0
-# set N0, 0.0
-# new P0, .PerlArray
-# set P0[.GUESS], 1 # Indicate unsure'd-ness
-# set S0, S1
-# bsr GUESS_ISINT
-# eq I0, 1, GUESS_INT
-# bsr GUESS_ISFLOAT
-# eq I0, 0, GUESS_STRING
-# set N0, S1
-# set P0[.TYPE], "FLO"
-# set P0[.VALUE], N0
-# pops
-# ret
-#GUESS_INT:
-# set I0, S1
-# set P0[.TYPE], "INT"
-# set P0[.VALUE], I0
-# pops
-# ret
-#GUESS_STRING:
-# set P0[.TYPE], "STRING"
-# set P0[.VALUE], S1
-# pops
-# ret
-#
-# # #########################################
-# # SWAP
-# # Input:
-# # P12 a LHS
-# # P13 another LHS
-# # Return:
-# # P12 and P13 properly swapped
-# # Everything (*everything*) internally is done with references.
-# # We have to do this the hard way. :(
-# # SWAPS VALUES, NOT REFERENCES!!
-#SWAP: set S0, P12[.TYPE]
-# set S1, P13[.TYPE]
-# ne S0, S1, ERR_SWAP
-# ne S0, "BARE", ERR_SWAP
-#
-# # Construct a P0 from P12 (COPY!)
-# set P6, P12
-# bsr DEREF # Get the real value of it in P6
-# bsr UNSTUFF # Into vars
-# set S1, S2
-# bsr VARSTUFF # P0's my new guy.
-# set P7, P0 # P7 is P12's old contents
-#
-# set P6, P13
-# bsr DEREF
-# bsr UNSTUFF
-# set S1, S2
-# bsr VARSTUFF
-# set P8, P0 # P8 is P13's old contents
-#
-# set P0, P12
-# set P6, P8
-# bsr ASSIGNMENT
-#
-# set P0, P13
-# set P6, P7
-# bsr ASSIGNMENT
-# ret
-#
-#
-#ERR_SWAP:
-# print "Cannot swap unlike types"
-# branch GEN_ERROR
-#
-#GEN_ERROR:
-# print " at line "
-# print I11
-# print "\n"
-# end
-#
-#
-## Genned with Steve Fink's regex generator
-## Parrot, languages\regex\regex.pl
-##
-##
-## Input: S0 (thing to be tested)
-## Output: I0 (true, false)
-##
-## Ints are ^\s+\d+$
-## Floats are ^\s+\d+\.
-#GUESS_ISINT:
-# pushi
-# pushs
-# pushp
-# new P0, .IntList
-# new P1, .IntList
-# new P2, .IntList
-# set I1, 0
-# length I2, S0
-# set P0[0], 0
-# set P0[1], -2 # open group 1
-# set P1[1], -2 # close group 1
-# ge I1, I2, INT_L57 # need 1 more chars
-# push P2, 0 # pushindex
-#INT_L:
-#
-# # loop
-# sub I0, I2, I1 # need 2 more chars
-# lt I0, 2, INT_L5
-# ord I0, S0, I1 # tmp = INPUT[pos]
-# ne I0, 32, INT_L5 # match 'S'
-# add I1, 1 # pos++
-# branch INT_L3
-#INT_L2:
-#
-# # undo_match
-# add I1, -1 # pos--
-# branch INT_L5
-#INT_L3:
-#
-# # after_match
-# push P2, 1 # pushindex
-# branch INT_L
-#INT_L4:
-#
-# # star_back
-# pop I0, P2 # popint
-# if I0, INT_L2
-# branch INT_L57
-#INT_L5:
-#
-# # star_next
-# ge I1, I2, INT_L4 # need 1 more chars
-# push P2, -1 # pushmark
-#INT_L6:
-#
-# # plus_loop
-# ge I1, I2, INT_L56 # need 1 more chars
-# set I0, P0[1] # get group 1 start
-# push P2, I0 # pushindex
-# set I0, P1[1] # get group 1 end
-# push P2, I0 # pushindex
-# set P0[1], I1 # open group 1
-# ord I0, S0, I1 # tmp = INPUT[pos]
-# ne I0, 48, INT_L9 # match 'A'
-# add I1, 1 # pos++
-# branch INT_L8
-#INT_L7:
-#
-# # undo_match2
-# add I1, -1 # pos--
-# branch INT_L9
-#INT_L8:
-#
-# # after_match2
-# push P2, 0 # pushindex
-# branch INT_L13
-#INT_L9:
-#
-# # alt_try9
-# ord I0, S0, I1 # tmp = INPUT[pos]
-# ne I0, 49, INT_L14 # match 'B'
-# add I1, 1 # pos++
-# branch INT_L11
-#INT_L10:
-#
-# # undo_match3
-# add I1, -1 # pos--
-# branch INT_L14
-#INT_L11:
-#
-# # after_match3
-# push P2, 1 # pushindex
-# branch INT_L13
-#INT_L12:
-#
-# # alt_back9
-# pop I0, P2 # popint
-# eq I0, 0, INT_L7
-# branch INT_L10
-#INT_L13:
-#
-# # alt_next9
-# push P2, 0 # pushindex
-# branch INT_L18
-#INT_L14:
-#
-# # alt_try8
-# ord I0, S0, I1 # tmp = INPUT[pos]
-# ne I0, 50, INT_L19 # match 'C'
-# add I1, 1 # pos++
-# branch INT_L16
-#INT_L15:
-#
-# # undo_match4
-# add I1, -1 # pos--
-# branch INT_L19
-#INT_L16:
-#
-# # after_match4
-# push P2, 1 # pushindex
-# branch INT_L18
-#INT_L17:
-#
-# # alt_back8
-# pop I0, P2 # popint
-# eq I0, 0, INT_L12
-# branch INT_L15
-#INT_L18:
-#
-# # alt_next8
-# push P2, 0 # pushindex
-# branch INT_L23
-#INT_L19:
-#
-# # alt_try7
-# ord I0, S0, I1 # tmp = INPUT[pos]
-# ne I0, 51, INT_L24 # match 'D'
-# add I1, 1 # pos++
-# branch INT_L21
-#INT_L20:
-#
-# # undo_match5
-# add I1, -1 # pos--
-# branch INT_L24
-#INT_L21:
-#
-# # after_match5
-# push P2, 1 # pushindex
-# branch INT_L23
-#INT_L22:
-#
-# # alt_back7
-# pop I0, P2 # popint
-# eq I0, 0, INT_L17
-# branch INT_L20
-#INT_L23:
-#
-# # alt_next7
-# push P2, 0 # pushindex
-# branch INT_L28
-#INT_L24:
-#
-# # alt_try6
-# ord I0, S0, I1 # tmp = INPUT[pos]
-# ne I0, 52, INT_L29 # match 'E'
-# add I1, 1 # pos++
-# branch INT_L26
-#INT_L25:
-#
-# # undo_match6
-# add I1, -1 # pos--
-# branch INT_L29
-#INT_L26:
-#
-# # after_match6
-# push P2, 1 # pushindex
-# branch INT_L28
-#INT_L27:
-#
-# # alt_back6
-# pop I0, P2 # popint
-# eq I0, 0, INT_L22
-# branch INT_L25
-#INT_L28:
-#
-# # alt_next6
-# push P2, 0 # pushindex
-# branch INT_L33
-#INT_L29:
-#
-# # alt_try5
-# ord I0, S0, I1 # tmp = INPUT[pos]
-# ne I0, 53, INT_L34 # match 'F'
-# add I1, 1 # pos++
-# branch INT_L31
-#INT_L30:
-#
-# # undo_match7
-# add I1, -1 # pos--
-# branch INT_L34
-#INT_L31:
-#
-# # after_match7
-# push P2, 1 # pushindex
-# branch INT_L33
-#INT_L32:
-#
-# # alt_back5
-# pop I0, P2 # popint
-# eq I0, 0, INT_L27
-# branch INT_L30
-#INT_L33:
-#
-# # alt_next5
-# push P2, 0 # pushindex
-# branch INT_L38
-#INT_L34:
-#
-# # alt_try4
-# ord I0, S0, I1 # tmp = INPUT[pos]
-# ne I0, 54, INT_L39 # match 'G'
-# add I1, 1 # pos++
-# branch INT_L36
-#INT_L35:
-#
-# # undo_match8
-# add I1, -1 # pos--
-# branch INT_L39
-#INT_L36:
-#
-# # after_match8
-# push P2, 1 # pushindex
-# branch INT_L38
-#INT_L37:
-#
-# # alt_back4
-# pop I0, P2 # popint
-# eq I0, 0, INT_L32
-# branch INT_L35
-#INT_L38:
-#
-# # alt_next4
-# push P2, 0 # pushindex
-# branch INT_L43
-#INT_L39:
-#
-# # alt_try3
-# ord I0, S0, I1 # tmp = INPUT[pos]
-# ne I0, 55, INT_L44 # match 'H'
-# add I1, 1 # pos++
-# branch INT_L41
-#INT_L40:
-#
-# # undo_match9
-# add I1, -1 # pos--
-# branch INT_L44
-#INT_L41:
-#
-# # after_match9
-# push P2, 1 # pushindex
-# branch INT_L43
-#INT_L42:
-#
-# # alt_back3
-# pop I0, P2 # popint
-# eq I0, 0, INT_L37
-# branch INT_L40
-#INT_L43:
-#
-# # alt_next3
-# push P2, 0 # pushindex
-# branch INT_L48
-#INT_L44:
-#
-# # alt_try2
-# ord I0, S0, I1 # tmp = INPUT[pos]
-# ne I0, 56, INT_L49 # match 'I'
-# add I1, 1 # pos++
-# branch INT_L46
-#INT_L45:
-#
-# # undo_match10
-# add I1, -1 # pos--
-# branch INT_L49
-#INT_L46:
-#
-# # after_match10
-# push P2, 1 # pushindex
-# branch INT_L48
-#INT_L47:
-#
-# # alt_back2
-# pop I0, P2 # popint
-# eq I0, 0, INT_L42
-# branch INT_L45
-#INT_L48:
-#
-# # alt_next2
-# push P2, 0 # pushindex
-# branch INT_L53
-#INT_L49:
-#
-# # alt_try
-# ord I0, S0, I1 # tmp = INPUT[pos]
-# ne I0, 57, INT_L54 # match 'J'
-# add I1, 1 # pos++
-# branch INT_L51
-#INT_L50:
-#
-# # undo_match11
-# add I1, -1 # pos--
-# branch INT_L54
-#INT_L51:
-#
-# # after_match11
-# push P2, 1 # pushindex
-# branch INT_L53
-#INT_L52:
-#
-# # alt_back
-# pop I0, P2 # popint
-# eq I0, 0, INT_L47
-# branch INT_L50
-#INT_L53:
-#
-# # alt_next
-# set P1[1], I1 # close group 1
-# branch INT_L55
-#INT_L54:
-#
-# # group_iback
-# pop I0, P2 # popint
-# set P1[1], I0 # close group 1
-# pop I0, P2 # popint
-# set P0[1], I0 # open group 1
-# branch INT_L56
-#INT_L55:
-#
-# # group_next
-# push P2, 0 # pushindex
-# branch INT_L6
-#INT_L56:
-#
-# # plus_rfail
-# pop I0, P2 # popindex
-# eq I0, -1, INT_L4 # was a mark?
-# lt I1, I2, INT_L52 # at end?
-# set I0, 1
-# set P1[0], I1
-# branch INT_L58
-#INT_L57:
-#
-# # FAIL
-# set I0, 0
-# set P1[0], -2
-# save 0
-# branch GUESS_INTDONE
-#INT_L58:
-# save 1
-#GUESS_INTDONE:
-# popi
-# pops
-# popp
-# restore I0
-# ret
-#
-#GUESS_ISFLOAT:
-# pushp
-# pushs
-# pushi
-# new P0, .IntList
-# new P1, .IntList
-# new P2, .IntList
-# set I1, 0
-# length I2, S0
-# set P0[0], 0
-# set P0[1], -2 # open group 1
-# set P1[1], -2 # close group 1
-# sub I0, I2, I1 # need 2 more chars
-# lt I0, 2, FLOAT_L59
-# push P2, 0 # pushindex
-#FLOAT_L:
-#
-# # loop
-# sub I0, I2, I1 # need 3 more chars
-# lt I0, 3, FLOAT_L5
-# ord I0, S0, I1 # tmp = INPUT[pos]
-# ne I0, 32, FLOAT_L5 # match ' '
-# add I1, 1 # pos++
-# branch FLOAT_L3
-#FLOAT_L2:
-#
-# # undo_match
-# add I1, -1 # pos--
-# branch FLOAT_L5
-#FLOAT_L3:
-#
-# # after_match
-# push P2, 1 # pushindex
-# branch FLOAT_L
-#FLOAT_L4:
-#
-# # star_back
-# pop I0, P2 # popint
-# if I0, FLOAT_L2
-# branch FLOAT_L59
-#FLOAT_L5:
-#
-# # star_next
-# sub I0, I2, I1 # need 2 more chars
-# lt I0, 2, FLOAT_L4
-# push P2, -1 # pushmark
-#FLOAT_L6:
-#
-# # plus_loop
-# sub I0, I2, I1 # need 2 more chars
-# lt I0, 2, FLOAT_L56
-# set I0, P0[1] # get group 1 start
-# push P2, I0 # pushindex
-# set I0, P1[1] # get group 1 end
-# push P2, I0 # pushindex
-# set P0[1], I1 # open group 1
-# ord I0, S0, I1 # tmp = INPUT[pos]
-# ne I0, 48, FLOAT_L9 # match 'A'
-# add I1, 1 # pos++
-# branch FLOAT_L8
-#FLOAT_L7:
-#
-# # undo_match2
-# add I1, -1 # pos--
-# branch FLOAT_L9
-#FLOAT_L8:
-#
-# # after_match2
-# push P2, 0 # pushindex
-# branch FLOAT_L13
-#FLOAT_L9:
-#
-# # alt_try9
-# ord I0, S0, I1 # tmp = INPUT[pos]
-# ne I0, 49, FLOAT_L14 # match 'B'
-# add I1, 1 # pos++
-# branch FLOAT_L11
-#FLOAT_L10:
-#
-# # undo_match3
-# add I1, -1 # pos--
-# branch FLOAT_L14
-#FLOAT_L11:
-#
-# # after_match3
-# push P2, 1 # pushindex
-# branch FLOAT_L13
-#FLOAT_L12:
-#
-# # alt_back9
-# pop I0, P2 # popint
-# eq I0, 0, FLOAT_L7
-# branch FLOAT_L10
-#FLOAT_L13:
-#
-# # alt_next9
-# push P2, 0 # pushindex
-# branch FLOAT_L18
-#FLOAT_L14:
-#
-# # alt_try8
-# ord I0, S0, I1 # tmp = INPUT[pos]
-# ne I0, 50, FLOAT_L19 # match 'C'
-# add I1, 1 # pos++
-# branch FLOAT_L16
-#FLOAT_L15:
-#
-# # undo_match4
-# add I1, -1 # pos--
-# branch FLOAT_L19
-#FLOAT_L16:
-#
-# # after_match4
-# push P2, 1 # pushindex
-# branch FLOAT_L18
-#FLOAT_L17:
-#
-# # alt_back8
-# pop I0, P2 # popint
-# eq I0, 0, FLOAT_L12
-# branch FLOAT_L15
-#FLOAT_L18:
-#
-# # alt_next8
-# push P2, 0 # pushindex
-# branch FLOAT_L23
-#FLOAT_L19:
-#
-# # alt_try7
-# ord I0, S0, I1 # tmp = INPUT[pos]
-# ne I0, 51, FLOAT_L24 # match 'D'
-# add I1, 1 # pos++
-# branch FLOAT_L21
-#FLOAT_L20:
-#
-# # undo_match5
-# add I1, -1 # pos--
-# branch FLOAT_L24
-#FLOAT_L21:
-#
-# # after_match5
-# push P2, 1 # pushindex
-# branch FLOAT_L23
-#FLOAT_L22:
-#
-# # alt_back7
-# pop I0, P2 # popint
-# eq I0, 0, FLOAT_L17
-# branch FLOAT_L20
-#FLOAT_L23:
-#
-# # alt_next7
-# push P2, 0 # pushindex
-# branch FLOAT_L28
-#FLOAT_L24:
-#
-# # alt_try6
-# ord I0, S0, I1 # tmp = INPUT[pos]
-# ne I0, 52, FLOAT_L29 # match 'E'
-# add I1, 1 # pos++
-# branch FLOAT_L26
-#FLOAT_L25:
-#
-# # undo_match6
-# add I1, -1 # pos--
-# branch FLOAT_L29
-#FLOAT_L26:
-#
-# # after_match6
-# push P2, 1 # pushindex
-# branch FLOAT_L28
-#FLOAT_L27:
-#
-# # alt_back6
-# pop I0, P2 # popint
-# eq I0, 0, FLOAT_L22
-# branch FLOAT_L25
-#FLOAT_L28:
-#
-# # alt_next6
-# push P2, 0 # pushindex
-# branch FLOAT_L33
-#FLOAT_L29:
-#
-# # alt_try5
-# ord I0, S0, I1 # tmp = INPUT[pos]
-# ne I0, 53, FLOAT_L34 # match 'F'
-# add I1, 1 # pos++
-# branch FLOAT_L31
-#FLOAT_L30:
-#
-# # undo_match7
-# add I1, -1 # pos--
-# branch FLOAT_L34
-#FLOAT_L31:
-#
-# # after_match7
-# push P2, 1 # pushindex
-# branch FLOAT_L33
-#FLOAT_L32:
-#
-# # alt_back5
-# pop I0, P2 # popint
-# eq I0, 0, FLOAT_L27
-# branch FLOAT_L30
-#FLOAT_L33:
-#
-# # alt_next5
-# push P2, 0 # pushindex
-# branch FLOAT_L38
-#FLOAT_L34:
-#
-# # alt_try4
-# ord I0, S0, I1 # tmp = INPUT[pos]
-# ne I0, 54, FLOAT_L39 # match 'G'
-# add I1, 1 # pos++
-# branch FLOAT_L36
-#FLOAT_L35:
-#
-# # undo_match8
-# add I1, -1 # pos--
-# branch FLOAT_L39
-#FLOAT_L36:
-#
-# # after_match8
-# push P2, 1 # pushindex
-# branch FLOAT_L38
-#FLOAT_L37:
-#
-# # alt_back4
-# pop I0, P2 # popint
-# eq I0, 0, FLOAT_L32
-# branch FLOAT_L35
-#FLOAT_L38:
-#
-# # alt_next4
-# push P2, 0 # pushindex
-# branch FLOAT_L43
-#FLOAT_L39:
-#
-# # alt_try3
-# ord I0, S0, I1 # tmp = INPUT[pos]
-# ne I0, 55, FLOAT_L44 # match 'H'
-# add I1, 1 # pos++
-# branch FLOAT_L41
-#FLOAT_L40:
-#
-# # undo_match9
-# add I1, -1 # pos--
-# branch FLOAT_L44
-#FLOAT_L41:
-#
-# # after_match9
-# push P2, 1 # pushindex
-# branch FLOAT_L43
-#FLOAT_L42:
-#
-# # alt_back3
-# pop I0, P2 # popint
-# eq I0, 0, FLOAT_L37
-# branch FLOAT_L40
-#FLOAT_L43:
-#
-# # alt_next3
-# push P2, 0 # pushindex
-# branch FLOAT_L48
-#FLOAT_L44:
-#
-# # alt_try2
-# ord I0, S0, I1 # tmp = INPUT[pos]
-# ne I0, 56, FLOAT_L49 # match 'I'
-# add I1, 1 # pos++
-# branch FLOAT_L46
-#FLOAT_L45:
-#
-# # undo_match10
-# add I1, -1 # pos--
-# branch FLOAT_L49
-#FLOAT_L46:
-#
-# # after_match10
-# push P2, 1 # pushindex
-# branch FLOAT_L48
-#FLOAT_L47:
-#
-# # alt_back2
-# pop I0, P2 # popint
-# eq I0, 0, FLOAT_L42
-# branch FLOAT_L45
-#FLOAT_L48:
-#
-# # alt_next2
-# push P2, 0 # pushindex
-# branch FLOAT_L53
-#FLOAT_L49:
-#
-# # alt_try
-# ord I0, S0, I1 # tmp = INPUT[pos]
-# ne I0, 57, FLOAT_L54 # match 'J'
-# add I1, 1 # pos++
-# branch FLOAT_L51
-#FLOAT_L50:
-#
-# # undo_match11
-# add I1, -1 # pos--
-# branch FLOAT_L54
-#FLOAT_L51:
-#
-# # after_match11
-# push P2, 1 # pushindex
-# branch FLOAT_L53
-#FLOAT_L52:
-#
-# # alt_back
-# pop I0, P2 # popint
-# eq I0, 0, FLOAT_L47
-# branch FLOAT_L50
-#FLOAT_L53:
-#
-# # alt_next
-# set P1[1], I1 # close group 1
-# branch FLOAT_L55
-#FLOAT_L54:
-#
-# # group_iback
-# pop I0, P2 # popint
-# set P1[1], I0 # close group 1
-# pop I0, P2 # popint
-# set P0[1], I0 # open group 1
-# branch FLOAT_L56
-#FLOAT_L55:
-#
-# # group_next
-# push P2, 0 # pushindex
-# branch FLOAT_L6
-#FLOAT_L56:
-#
-# # plus_rfail
-# pop I0, P2 # popindex
-# eq I0, -1, FLOAT_L4 # was a mark?
-# ge I1, I2, FLOAT_L52 # need 1 more chars
-# ord I0, S0, I1 # tmp = INPUT[pos]
-# ne I0, 46, FLOAT_L52 # match '.'
-# add I1, 1 # pos++
-# set I0, 1
-# set P1[0], I1
-# branch FLOAT_L60
-#FLOAT_L59:
-#
-# # FAIL
-# set I0, 0
-# set P1[0], -2
-# save 0
-# branch GUESS_FLOATDONE
-#FLOAT_L60:
-# save 1
-# # RETURN
-#GUESS_FLOATDONE:
-# popp
-# pops
-# popi
-# restore I0
-# ret