mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-23 00:43:28 +00:00
This patch adds three features to the lang/mlton port:
* Support for FreeBSD 6.x * Support for compilation with SML/NJ * Cross-compilation with mingw32 PR: 124061 Submitted by: Timothy Bourke <timbob@bigpond.com> Approved by: maintainer
This commit is contained in:
parent
2866bad5d8
commit
776ae1fb28
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=224064
@ -12,10 +12,11 @@
|
||||
|
||||
PORTNAME= mlton
|
||||
PORTVERSION= 20070826
|
||||
PORTREVISION= 1
|
||||
PORTREVISION= 2
|
||||
CATEGORIES= lang
|
||||
MASTER_SITES= http://mlton.org/pages/Download/attachments/ \
|
||||
http://mlton.org/pages/Experimental/attachments/
|
||||
http://mlton.org/pages/Experimental/attachments/ \
|
||||
http://www.cse.unsw.edu.au/~tbourke/distfiles/
|
||||
DISTFILES= ${BOOT_DIST} ${SRC_DIST}
|
||||
EXTRACT_ONLY= ${SRC_DIST}
|
||||
|
||||
@ -23,17 +24,43 @@ EXTRACT_ONLY= ${SRC_DIST}
|
||||
MAINTAINER= jesper.louis.andersen@gmail.com
|
||||
COMMENT= An optimizing Standard ML compiler
|
||||
|
||||
LIB_DEPENDS= gmp.7:${PORTSDIR}/math/libgmp4
|
||||
RUN_DEPENDS= bash:${PORTSDIR}/shells/bash
|
||||
BUILD_DEPENDS= bash:${PORTSDIR}/shells/bash
|
||||
|
||||
OPTIONS= SMLNJ "Bootstrap with SML/NJ (can take >15 hours)" off \
|
||||
MINGW32 "Add the mingw32 target (requires wine)" off
|
||||
|
||||
.include <bsd.port.pre.mk>
|
||||
|
||||
.if !defined(NOPORTDOCS)
|
||||
BUILD_DEPENDS+= gsed:${PORTSDIR}/textproc/gsed \
|
||||
htmldoc:${PORTSDIR}/textproc/htmldoc \
|
||||
latex:${PORTSDIR}/print/teTeX
|
||||
.endif
|
||||
LIB_DEPENDS= gmp.7:${PORTSDIR}/math/libgmp4
|
||||
RUN_DEPENDS= bash:${PORTSDIR}/shells/bash
|
||||
|
||||
SRC_DIST= ${DISTNAME}-1.src.tgz
|
||||
BOOT_DIST= ${PORTNAME}-${BOOT_VER}-1-0.${MACHINE_ARCH}-freebsd.${BOOT_SUF}
|
||||
|
||||
.if defined(WITH_SMLNJ)
|
||||
BUILD_DEPENDS+= smlnj-devel>=110.65:${PORTSDIR}/lang/sml-nj-devel
|
||||
BOOT_DIST=
|
||||
MAKE_ENV+= SMLNJ_DEVEL=yes
|
||||
ALL_TARGET= bootstrap-nj
|
||||
.else
|
||||
BOOT_DIST= ${PORTNAME}-${BOOT_VER}-1.${MACHINE_ARCH}-freebsd${OSRELMAJ}.${BOOT_SUF}
|
||||
.endif
|
||||
|
||||
.if defined(WITH_MINGW32)
|
||||
BUILD_DEPENDS+= wine:${PORTSDIR}/emulators/wine \
|
||||
mingw32-gcc:${PORTSDIR}/devel/mingw32-gcc \
|
||||
${LOCALBASE}/mingw32/lib/libgmp.a:${PORTSDIR}/devel/mingw32-libgmp4
|
||||
RUN_DEPENDS+= mingw32-gcc:${PORTSDIR}/devel/mingw32-gcc \
|
||||
${LOCALBASE}/mingw32/lib/libgmp.a:${PORTSDIR}/devel/mingw32-libgmp4
|
||||
|
||||
PLIST_SUB+= MINGW32CROSS=""
|
||||
.else
|
||||
PLIST_SUB+= MINGW32CROSS="@comment "
|
||||
.endif
|
||||
|
||||
ONLY_FOR_ARCHS= i386
|
||||
|
||||
@ -42,7 +69,6 @@ MANCOMPRESSED= yes
|
||||
|
||||
BOOT_WRKSRC= ${WRKDIR}/mlton-bootstrap
|
||||
|
||||
ALL_TARGET= all
|
||||
USE_GMAKE= yes
|
||||
MAKE_ARGS= DESTDIR='' \
|
||||
PATH=${WRKSRC}/build/bin:${BOOT_WRKSRC}/bin:${PATH} \
|
||||
@ -52,14 +78,17 @@ MAKE_ARGS= DESTDIR='' \
|
||||
INSTALL_TARGET= install-no-docs
|
||||
.endif
|
||||
|
||||
.include <bsd.port.pre.mk>
|
||||
|
||||
.if ${ARCH} == "i386"
|
||||
MLTON_ARCH= "x86"
|
||||
.endif
|
||||
|
||||
.if ${OSVERSION} < 700000
|
||||
IGNORE= cannot bootstrap on FreeBSD < 7.0
|
||||
.if ${OSVERSION} >= 700000
|
||||
OSRELMAJ=
|
||||
.else
|
||||
OSRELMAJ= -6
|
||||
.if ${OSVERSION} < 600000
|
||||
IGNORE= cannot bootstrap on FreeBSD < 6.0
|
||||
.endif
|
||||
.endif
|
||||
|
||||
BOOT_EXTRACT= --bzip2
|
||||
@ -67,11 +96,22 @@ BOOT_SUF= tbz
|
||||
BOOT_VER= 20070826
|
||||
|
||||
post-extract:
|
||||
@${CP} ${FILESDIR}/add-local-cross ${WRKSRC}/bin/
|
||||
.if defined(WITH_SMLNJ)
|
||||
@${CP} ${FILESDIR}/upgrade-basis.sml ${WRKSRC}/mlton/
|
||||
@for f in `ls ${FILESDIR}/ml.* ${FILESDIR}/mlb.*`; do \
|
||||
${CP} $$f ${WRKSRC}/mlton/front-end/; \
|
||||
done
|
||||
@for f in `ls ${FILESDIR}/yacc.*`; do \
|
||||
${CP} $$f ${WRKSRC}/mlyacc/src/; \
|
||||
done
|
||||
.else
|
||||
@${MKDIR} ${BOOT_WRKSRC}
|
||||
@${TAR} xf ${DISTDIR}/${BOOT_DIST} ${BOOT_EXTRACT} -C ${BOOT_WRKSRC}
|
||||
@${REINPLACE_CMD} -e \
|
||||
"s|lib=\'${LOCALBASE}/|lib=\'${BOOT_WRKSRC}/|" \
|
||||
${BOOT_WRKSRC}/bin/mlton
|
||||
.endif
|
||||
|
||||
post-patch:
|
||||
@${REINPLACE_CMD} -e \
|
||||
@ -81,6 +121,12 @@ post-patch:
|
||||
"s|CFLAGS += -I/usr/local/include|CFLAGS += -I${LOCALBASE}/include|" \
|
||||
${WRKSRC}/runtime/bytecode/Makefile
|
||||
|
||||
post-build:
|
||||
.if defined(WITH_MINGW32)
|
||||
@${ECHO} Adding mingw32 target...
|
||||
${WRKSRC}/bin/add-local-cross mingw32 x86 mingw
|
||||
.endif
|
||||
|
||||
post-install:
|
||||
.for bin in mllex mlnlffigen mlprof mlton mlyacc
|
||||
${CHOWN} ${SHAREOWN}:${SHAREGRP} ${PREFIX}/bin/${bin} \
|
||||
|
@ -1,6 +1,9 @@
|
||||
MD5 (mlton-20070826-1-0.i386-freebsd.tbz) = 60ce94e330ec2d8c66563e7b6b9bd534
|
||||
SHA256 (mlton-20070826-1-0.i386-freebsd.tbz) = b953da050a725d79c0445896cd6892d266f340622c52824d7f06bf8a4aed34cf
|
||||
SIZE (mlton-20070826-1-0.i386-freebsd.tbz) = 7006769
|
||||
MD5 (mlton-20070826-1.i386-freebsd-6.tbz) = 006bdcedd9840b06a4f57822edb5d162
|
||||
SHA256 (mlton-20070826-1.i386-freebsd-6.tbz) = 515d7c11892793e330effce8c4e02467bbfb870671d91ef544b3644003709bea
|
||||
SIZE (mlton-20070826-1.i386-freebsd-6.tbz) = 7120924
|
||||
MD5 (mlton-20070826-1.i386-freebsd.tbz) = 60ce94e330ec2d8c66563e7b6b9bd534
|
||||
SHA256 (mlton-20070826-1.i386-freebsd.tbz) = b953da050a725d79c0445896cd6892d266f340622c52824d7f06bf8a4aed34cf
|
||||
SIZE (mlton-20070826-1.i386-freebsd.tbz) = 7006769
|
||||
MD5 (mlton-20070826-1.src.tgz) = 08356566e20f47c1bcc8002fde72c2ec
|
||||
SHA256 (mlton-20070826-1.src.tgz) = c2f7e07523294d070682399377ea83ed11f2ed59d142b30fc7032c1c8fd9e103
|
||||
SIZE (mlton-20070826-1.src.tgz) = 5585773
|
||||
|
197
lang/mlton/files/add-local-cross
Normal file
197
lang/mlton/files/add-local-cross
Normal file
@ -0,0 +1,197 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
# This script adds a new crosscompiler target for MLton.
|
||||
#
|
||||
# It takes three arguments.
|
||||
#
|
||||
# 1. <crossTarget>, which is what MLton would pass via the -b flag to the GCC
|
||||
# cross-compiler tools. You don't need to have installed these tools in order
|
||||
# to run this script, since it uses ssh and the native gcc on the target.
|
||||
# Examples of $crossTarget are i386-pc-cygwin and sparc-sun-solaris.
|
||||
#
|
||||
# 2. <crossArch> specifies the target architecture.
|
||||
# The posibilities are: amd64, hppa, sparc, x86.
|
||||
#
|
||||
# 3. <crossOS> specifies the target OS.
|
||||
# The possibilities are: aix, cygwin, darwin, freebsd, hpux, linux, mingw,
|
||||
# netbsd, openbsd, solaris.
|
||||
#
|
||||
# Here are some example uses of this script.
|
||||
#
|
||||
# add-cross mingw32 x86 mingw
|
||||
#
|
||||
# You also may need to set $libDir, which determines where the$exe.c
|
||||
# cross-compiler target will be installed.
|
||||
#
|
||||
# This script is a modification of add-cross. Rather than ssh into a box
|
||||
# running the target platform it uses cross-compiler tools to produce
|
||||
# executables and an environment to execute them.
|
||||
#
|
||||
# It only works with the mingw32 cross-compiler and the wine environment.
|
||||
#
|
||||
|
||||
MAKE=gmake
|
||||
GCC=mingw32-gcc
|
||||
RUN=wine
|
||||
|
||||
die () {
|
||||
echo >&2 "$1"
|
||||
exit 1
|
||||
}
|
||||
|
||||
usage () {
|
||||
die "usage: $name <crossTarget> <crossArch> <crossOS>"
|
||||
}
|
||||
|
||||
case "$#" in
|
||||
3)
|
||||
crossTarget="$1"
|
||||
crossArch="$2"
|
||||
crossOS="$3"
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
|
||||
name=`basename "$0"`
|
||||
original=`pwd`
|
||||
dir=`dirname "$0"`
|
||||
src=`cd "$dir/.." && pwd`
|
||||
|
||||
PATH="$dir":$PATH
|
||||
|
||||
# libDir is the mlton lib directory where you would like the
|
||||
# cross-compiler information to be installed. If you have installed
|
||||
# from the rpms, this will usually be /usr/lib/mlton. You must have
|
||||
# write permission there.
|
||||
|
||||
lib="$src/build/lib"
|
||||
|
||||
# You shouldn't need to change anything below this line.
|
||||
|
||||
rm -rf "$lib/$crossTarget"
|
||||
mkdir -p "$lib/$crossTarget" || die "Cannot write to $lib."
|
||||
|
||||
tmp="$src/cross-$crossTarget"
|
||||
#ssh $machine "rm -rf $tmp && mkdir $tmp"
|
||||
rm -rf $tmp && mkdir $tmp
|
||||
|
||||
$MAKE -C "$src" dirs
|
||||
|
||||
echo '* Making runtime.'
|
||||
#( cd "$src" && tar cf - Makefile basis-library bin include runtime ) |
|
||||
# ssh $machine "cd $tmp && tar xf - && cd runtime &&
|
||||
# ../bin/mmake COMPILE_FAST=yes OMIT_BYTECODE=yes TARGET_ARCH=$crossArch TARGET_OS=$crossOS clean all &&
|
||||
# cd .. && make dirs runtime"
|
||||
cd "$src"
|
||||
for f in Makefile basis-library bin include runtime; do
|
||||
cp -pfR $f "$tmp"
|
||||
done
|
||||
|
||||
echo "* Running make clean all in $tmp/runtime."
|
||||
cd "$tmp"
|
||||
$MAKE -C runtime COMPILE_FAST=yes OMIT_BYTECODE=yes TARGET=$crossTarget \
|
||||
TARGET_ARCH=$crossArch \
|
||||
TARGET_OS=$crossOS \
|
||||
clean all
|
||||
|
||||
echo "* Running make dirs runtime in $tmp."
|
||||
$MAKE TARGET=$crossTarget TARGET_ARCH=$crossArch TARGET_OS=$crossOS dirs runtime
|
||||
|
||||
echo "* Copy from tmp to build (build/lib/$crossTarget)."
|
||||
# ssh $machine "cd $tmp/build/lib/self && tar cf - ." |
|
||||
# ( cd "$lib/$crossTarget" && tar xf - )
|
||||
cp -pfR "$tmp/build/lib/$crossTarget" "$lib/"
|
||||
|
||||
echo "* Copy from $crossArch-$crossOS (basis-library/config/c/$crossArch-crossOS)."
|
||||
#ssh $machine "cd $tmp/basis-library/config/c && tar cf - $crossArch-$crossOS" |
|
||||
# ( cd "$lib/sml/basis/config/c" && tar xf - )
|
||||
cp -pfR "$tmp/basis-library/config/c/$crossArch-$crossOS" \
|
||||
"$lib/sml/basis/config/c/"
|
||||
|
||||
echo "* Running make mlbpathmap targetmap in $src."
|
||||
#( cd "$src" &&
|
||||
# mmake TARGET=$crossTarget TARGET_ARCH=$crossArch TARGET_OS=$crossOS \
|
||||
# mlbpathmap targetmap )
|
||||
cd "$src"
|
||||
$MAKE TARGET=$crossTarget TARGET_ARCH=$crossArch TARGET_OS=$crossOS \
|
||||
mlbpathmap targetmap
|
||||
|
||||
case "$crossOS" in
|
||||
mingw)
|
||||
#suf='.exe'
|
||||
suf=''
|
||||
;;
|
||||
*)
|
||||
suf=''
|
||||
;;
|
||||
esac
|
||||
|
||||
# Copied from mlton-script
|
||||
case "$crossArch" in
|
||||
amd64)
|
||||
archOpts='-m64'
|
||||
;;
|
||||
hppa)
|
||||
archOpts=''
|
||||
;;
|
||||
sparc)
|
||||
archOpts='-m32'
|
||||
;;
|
||||
x86)
|
||||
archOpts=''
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$crossOS" in
|
||||
aix)
|
||||
osOpts=''
|
||||
;;
|
||||
cygwin)
|
||||
osOpts=''
|
||||
;;
|
||||
darwin)
|
||||
osOpts='-I/opt/local/include -I/sw/include -L/opt/local/lib -L/sw/lib -lgmp'
|
||||
;;
|
||||
freebsd)
|
||||
osOpts='-I/usr/local/include -L/usr/local/lib/ -lgmp'
|
||||
;;
|
||||
hpux)
|
||||
osOpts=''
|
||||
;;
|
||||
linux)
|
||||
osOpts=''
|
||||
;;
|
||||
mingw)
|
||||
libs='-lws2_32 -lkernel32 -lpsapi -lnetapi32'
|
||||
;;
|
||||
netbsd)
|
||||
osOpts='-I/usr/pkg/include -Wl,-R/usr/pkg/lib -L/usr/pkg/lib/ -lgmp'
|
||||
;;
|
||||
openbsd)
|
||||
osOpts='-I/usr/local/include -L/usr/local/lib/ -lgmp'
|
||||
;;
|
||||
solaris)
|
||||
osOpts='-lnsl -lsocket -lrt'
|
||||
;;
|
||||
esac
|
||||
|
||||
exe='print-constants'
|
||||
echo "* Compiling and running print-constants."
|
||||
#"$src/build/bin/mlton" -target $crossTarget -build-constants true |
|
||||
# ssh $machine "cd $tmp/runtime &&
|
||||
# cat >$exe.c &&
|
||||
# gcc $archOpts $osOpts -I. -o $exe $exe.c libmlton.a libgdtoa.a -lgmp -lm"
|
||||
"$src/build/bin/mlton" -target $crossTarget -build-constants true \
|
||||
> "$tmp/runtime/$exe.c"
|
||||
cd "$tmp/runtime/"
|
||||
$GCC $archOpts $osOpts -I. -o $exe $exe.c libmlton.a libgdtoa.a -lgmp -lm $libs
|
||||
|
||||
#ssh $machine "$tmp/runtime/$exe$suf" >"$lib/$crossTarget/constants"
|
||||
$RUN "$tmp/runtime/$exe$suf" > "$lib/$crossTarget/constants"
|
||||
#ssh $machine "rm -rf $tmp"
|
||||
# rm -rf "$tmp"
|
||||
|
88
lang/mlton/files/ml.grm.sig
Normal file
88
lang/mlton/files/ml.grm.sig
Normal file
@ -0,0 +1,88 @@
|
||||
signature ML_TOKENS =
|
||||
sig
|
||||
type ('a,'b) token
|
||||
type svalue
|
||||
val PRIM: 'a * 'a -> (svalue,'a) token
|
||||
val SYMBOL: 'a * 'a -> (svalue,'a) token
|
||||
val IMPORT: 'a * 'a -> (svalue,'a) token
|
||||
val EXPORT: 'a * 'a -> (svalue,'a) token
|
||||
val ADDRESS: 'a * 'a -> (svalue,'a) token
|
||||
val CONST: 'a * 'a -> (svalue,'a) token
|
||||
val COMMAND_LINE_CONST: 'a * 'a -> (svalue,'a) token
|
||||
val BUILD_CONST: 'a * 'a -> (svalue,'a) token
|
||||
val WITHTYPE: 'a * 'a -> (svalue,'a) token
|
||||
val WITH: 'a * 'a -> (svalue,'a) token
|
||||
val WILD: 'a * 'a -> (svalue,'a) token
|
||||
val WHILE: 'a * 'a -> (svalue,'a) token
|
||||
val WHERE: 'a * 'a -> (svalue,'a) token
|
||||
val VAL: 'a * 'a -> (svalue,'a) token
|
||||
val TYPE: 'a * 'a -> (svalue,'a) token
|
||||
val THEN: 'a * 'a -> (svalue,'a) token
|
||||
val STRUCTURE: 'a * 'a -> (svalue,'a) token
|
||||
val STRUCT: 'a * 'a -> (svalue,'a) token
|
||||
val SIGNATURE: 'a * 'a -> (svalue,'a) token
|
||||
val SIG: 'a * 'a -> (svalue,'a) token
|
||||
val SHARING: 'a * 'a -> (svalue,'a) token
|
||||
val SEMICOLON: 'a * 'a -> (svalue,'a) token
|
||||
val RPAREN: 'a * 'a -> (svalue,'a) token
|
||||
val REC: 'a * 'a -> (svalue,'a) token
|
||||
val RBRACKET: 'a * 'a -> (svalue,'a) token
|
||||
val RBRACE: 'a * 'a -> (svalue,'a) token
|
||||
val RAISE: 'a * 'a -> (svalue,'a) token
|
||||
val OVERLOAD: 'a * 'a -> (svalue,'a) token
|
||||
val OPEN: 'a * 'a -> (svalue,'a) token
|
||||
val OP: 'a * 'a -> (svalue,'a) token
|
||||
val OF: 'a * 'a -> (svalue,'a) token
|
||||
val ORELSE: 'a * 'a -> (svalue,'a) token
|
||||
val NONFIX: 'a * 'a -> (svalue,'a) token
|
||||
val LPAREN: 'a * 'a -> (svalue,'a) token
|
||||
val LOCAL: 'a * 'a -> (svalue,'a) token
|
||||
val LET: 'a * 'a -> (svalue,'a) token
|
||||
val LBRACKET: 'a * 'a -> (svalue,'a) token
|
||||
val LBRACE: 'a * 'a -> (svalue,'a) token
|
||||
val INFIXR: 'a * 'a -> (svalue,'a) token
|
||||
val INFIX: 'a * 'a -> (svalue,'a) token
|
||||
val INCLUDE: 'a * 'a -> (svalue,'a) token
|
||||
val IN: 'a * 'a -> (svalue,'a) token
|
||||
val IF: 'a * 'a -> (svalue,'a) token
|
||||
val HASH: 'a * 'a -> (svalue,'a) token
|
||||
val HANDLE: 'a * 'a -> (svalue,'a) token
|
||||
val FUNCTOR: 'a * 'a -> (svalue,'a) token
|
||||
val FUN: 'a * 'a -> (svalue,'a) token
|
||||
val FN: 'a * 'a -> (svalue,'a) token
|
||||
val DARROW: 'a * 'a -> (svalue,'a) token
|
||||
val DO: 'a * 'a -> (svalue,'a) token
|
||||
val EXCEPTION: 'a * 'a -> (svalue,'a) token
|
||||
val EQTYPE: 'a * 'a -> (svalue,'a) token
|
||||
val EQUALOP: 'a * 'a -> (svalue,'a) token
|
||||
val EOF: 'a * 'a -> (svalue,'a) token
|
||||
val END: 'a * 'a -> (svalue,'a) token
|
||||
val ELSE: 'a * 'a -> (svalue,'a) token
|
||||
val DOTDOTDOT: 'a * 'a -> (svalue,'a) token
|
||||
val DATATYPE: 'a * 'a -> (svalue,'a) token
|
||||
val COMMA: 'a * 'a -> (svalue,'a) token
|
||||
val COLONGT: 'a * 'a -> (svalue,'a) token
|
||||
val COLON: 'a * 'a -> (svalue,'a) token
|
||||
val CASE: 'a * 'a -> (svalue,'a) token
|
||||
val BAR: 'a * 'a -> (svalue,'a) token
|
||||
val ASTERISK: 'a * 'a -> (svalue,'a) token
|
||||
val AS: 'a * 'a -> (svalue,'a) token
|
||||
val ARROW: 'a * 'a -> (svalue,'a) token
|
||||
val ANDALSO: 'a * 'a -> (svalue,'a) token
|
||||
val AND: 'a * 'a -> (svalue,'a) token
|
||||
val ABSTYPE: 'a * 'a -> (svalue,'a) token
|
||||
val WORD: ({ digits:string,radix:StringCvt.radix } ) * 'a * 'a -> (svalue,'a) token
|
||||
val TYVAR: (string) * 'a * 'a -> (svalue,'a) token
|
||||
val STRING: (IntInf.t vector) * 'a * 'a -> (svalue,'a) token
|
||||
val REAL: (string) * 'a * 'a -> (svalue,'a) token
|
||||
val LONGID: (string) * 'a * 'a -> (svalue,'a) token
|
||||
val INT: ({ digits:string,negate:bool,radix:StringCvt.radix } ) * 'a * 'a -> (svalue,'a) token
|
||||
val CHAR: (IntInf.t) * 'a * 'a -> (svalue,'a) token
|
||||
end
|
||||
signature ML_LRVALS=
|
||||
sig
|
||||
structure Tokens : ML_TOKENS
|
||||
structure ParserData:PARSER_DATA
|
||||
sharing type ParserData.Token.token = Tokens.token
|
||||
sharing type ParserData.svalue = Tokens.svalue
|
||||
end
|
5497
lang/mlton/files/ml.grm.sml
Normal file
5497
lang/mlton/files/ml.grm.sml
Normal file
File diff suppressed because it is too large
Load Diff
5660
lang/mlton/files/ml.lex.sml
Normal file
5660
lang/mlton/files/ml.lex.sml
Normal file
File diff suppressed because it is too large
Load Diff
32
lang/mlton/files/mlb.grm.sig
Normal file
32
lang/mlton/files/mlb.grm.sig
Normal file
@ -0,0 +1,32 @@
|
||||
signature MLB_TOKENS =
|
||||
sig
|
||||
type ('a,'b) token
|
||||
type svalue
|
||||
val STRING: (string) * 'a * 'a -> (svalue,'a) token
|
||||
val FILE: (string) * 'a * 'a -> (svalue,'a) token
|
||||
val PRIM: 'a * 'a -> (svalue,'a) token
|
||||
val ANN: 'a * 'a -> (svalue,'a) token
|
||||
val STRUCTURE: 'a * 'a -> (svalue,'a) token
|
||||
val SIGNATURE: 'a * 'a -> (svalue,'a) token
|
||||
val OPEN: 'a * 'a -> (svalue,'a) token
|
||||
val LOCAL: 'a * 'a -> (svalue,'a) token
|
||||
val LET: 'a * 'a -> (svalue,'a) token
|
||||
val IN: 'a * 'a -> (svalue,'a) token
|
||||
val FUNCTOR: 'a * 'a -> (svalue,'a) token
|
||||
val EQUALOP: 'a * 'a -> (svalue,'a) token
|
||||
val END: 'a * 'a -> (svalue,'a) token
|
||||
val BASIS: 'a * 'a -> (svalue,'a) token
|
||||
val BAS: 'a * 'a -> (svalue,'a) token
|
||||
val AND: 'a * 'a -> (svalue,'a) token
|
||||
val EOF: 'a * 'a -> (svalue,'a) token
|
||||
val SEMICOLON: 'a * 'a -> (svalue,'a) token
|
||||
val COMMA: 'a * 'a -> (svalue,'a) token
|
||||
val ID: (string) * 'a * 'a -> (svalue,'a) token
|
||||
end
|
||||
signature MLB_LRVALS=
|
||||
sig
|
||||
structure Tokens : MLB_TOKENS
|
||||
structure ParserData:PARSER_DATA
|
||||
sharing type ParserData.Token.token = Tokens.token
|
||||
sharing type ParserData.svalue = Tokens.svalue
|
||||
end
|
894
lang/mlton/files/mlb.grm.sml
Normal file
894
lang/mlton/files/mlb.grm.sml
Normal file
@ -0,0 +1,894 @@
|
||||
|
||||
functor MLBLrValsFun (structure Token: TOKEN
|
||||
structure Ast: AST
|
||||
val lexAndParseProgOrMLB: File.t * Region.t ->
|
||||
Ast.Basdec.node) =
|
||||
struct
|
||||
structure ParserData=
|
||||
struct
|
||||
structure Header =
|
||||
struct
|
||||
(* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh
|
||||
* Jagannathan, and Stephen Weeks.
|
||||
* Copyright (C) 1997-2000 NEC Research Institute.
|
||||
*
|
||||
* MLton is released under a BSD-style license.
|
||||
* See the file MLton-LICENSE for details.
|
||||
*)
|
||||
|
||||
type int = Int.t
|
||||
|
||||
fun reg (left, right) = Region.make {left = left, right = right}
|
||||
fun error (reg, msg) = Control.error (reg, Layout.str msg, Layout.empty)
|
||||
|
||||
open Ast
|
||||
|
||||
type fctbinds = {lhs: Fctid.t, rhs: Fctid.t} list
|
||||
type sigbinds = {lhs: Sigid.t, rhs: Sigid.t} list
|
||||
type strbinds = {lhs: Strid.t, rhs: Strid.t} list
|
||||
|
||||
type basbinds = {name: Basid.t, def: Basexp.t} list
|
||||
|
||||
|
||||
end
|
||||
structure LrTable = Token.LrTable
|
||||
structure Token = Token
|
||||
local open LrTable in
|
||||
val table=let val actionRows =
|
||||
"\
|
||||
\\001\000\001\000\025\000\000\000\
|
||||
\\001\000\001\000\025\000\006\000\070\000\012\000\069\000\000\000\
|
||||
\\001\000\004\000\000\000\000\000\
|
||||
\\001\000\008\000\071\000\000\000\
|
||||
\\001\000\008\000\074\000\000\000\
|
||||
\\001\000\008\000\082\000\000\000\
|
||||
\\001\000\008\000\084\000\000\000\
|
||||
\\001\000\009\000\053\000\000\000\
|
||||
\\001\000\011\000\039\000\000\000\
|
||||
\\001\000\011\000\049\000\000\000\
|
||||
\\001\000\011\000\081\000\000\000\
|
||||
\\001\000\020\000\021\000\000\000\
|
||||
\\086\000\000\000\
|
||||
\\087\000\000\000\
|
||||
\\088\000\003\000\017\000\007\000\016\000\010\000\015\000\013\000\014\000\
|
||||
\\014\000\013\000\015\000\012\000\016\000\011\000\017\000\010\000\
|
||||
\\018\000\009\000\019\000\008\000\020\000\007\000\000\000\
|
||||
\\089\000\000\000\
|
||||
\\090\000\000\000\
|
||||
\\091\000\000\000\
|
||||
\\092\000\000\000\
|
||||
\\093\000\000\000\
|
||||
\\094\000\000\000\
|
||||
\\095\000\000\000\
|
||||
\\096\000\000\000\
|
||||
\\097\000\000\000\
|
||||
\\098\000\000\000\
|
||||
\\099\000\000\000\
|
||||
\\100\000\000\000\
|
||||
\\101\000\000\000\
|
||||
\\102\000\000\000\
|
||||
\\103\000\000\000\
|
||||
\\104\000\000\000\
|
||||
\\105\000\005\000\052\000\000\000\
|
||||
\\105\000\005\000\052\000\009\000\051\000\000\000\
|
||||
\\106\000\000\000\
|
||||
\\107\000\000\000\
|
||||
\\108\000\000\000\
|
||||
\\109\000\000\000\
|
||||
\\110\000\005\000\047\000\000\000\
|
||||
\\110\000\005\000\047\000\009\000\046\000\000\000\
|
||||
\\111\000\000\000\
|
||||
\\112\000\000\000\
|
||||
\\113\000\000\000\
|
||||
\\114\000\000\000\
|
||||
\\115\000\005\000\044\000\000\000\
|
||||
\\115\000\005\000\044\000\009\000\043\000\000\000\
|
||||
\\116\000\000\000\
|
||||
\\117\000\000\000\
|
||||
\\118\000\000\000\
|
||||
\\119\000\005\000\077\000\000\000\
|
||||
\\120\000\000\000\
|
||||
\\121\000\000\000\
|
||||
\\122\000\000\000\
|
||||
\\123\000\000\000\
|
||||
\\124\000\000\000\
|
||||
\\125\000\000\000\
|
||||
\\126\000\001\000\025\000\000\000\
|
||||
\\127\000\000\000\
|
||||
\\128\000\000\000\
|
||||
\\129\000\000\000\
|
||||
\\130\000\000\000\
|
||||
\\131\000\000\000\
|
||||
\\132\000\000\000\
|
||||
\\133\000\000\000\
|
||||
\\134\000\020\000\021\000\000\000\
|
||||
\\135\000\000\000\
|
||||
\"
|
||||
val actionRowNumbers =
|
||||
"\014\000\013\000\012\000\017\000\
|
||||
\\014\000\025\000\024\000\026\000\
|
||||
\\011\000\000\000\000\000\000\000\
|
||||
\\014\000\000\000\000\000\014\000\
|
||||
\\016\000\008\000\063\000\061\000\
|
||||
\\044\000\020\000\059\000\060\000\
|
||||
\\038\000\019\000\058\000\054\000\
|
||||
\\023\000\055\000\009\000\057\000\
|
||||
\\032\000\018\000\007\000\021\000\
|
||||
\\015\000\014\000\062\000\064\000\
|
||||
\\041\000\000\000\000\000\035\000\
|
||||
\\000\000\000\000\056\000\014\000\
|
||||
\\029\000\000\000\000\000\001\000\
|
||||
\\003\000\043\000\040\000\045\000\
|
||||
\\037\000\034\000\039\000\004\000\
|
||||
\\031\000\028\000\033\000\052\000\
|
||||
\\050\000\048\000\046\000\014\000\
|
||||
\\014\000\027\000\042\000\036\000\
|
||||
\\022\000\030\000\047\000\000\000\
|
||||
\\010\000\005\000\049\000\001\000\
|
||||
\\051\000\006\000\053\000\002\000"
|
||||
val gotoT =
|
||||
"\
|
||||
\\007\000\004\000\008\000\003\000\009\000\002\000\010\000\001\000\
|
||||
\\020\000\083\000\000\000\
|
||||
\\000\000\
|
||||
\\000\000\
|
||||
\\000\000\
|
||||
\\007\000\004\000\008\000\003\000\009\000\016\000\010\000\001\000\000\000\
|
||||
\\000\000\
|
||||
\\000\000\
|
||||
\\000\000\
|
||||
\\001\000\018\000\002\000\017\000\000\000\
|
||||
\\019\000\022\000\025\000\021\000\028\000\020\000\000\000\
|
||||
\\019\000\026\000\021\000\025\000\024\000\024\000\000\000\
|
||||
\\013\000\029\000\014\000\028\000\019\000\027\000\000\000\
|
||||
\\007\000\004\000\008\000\003\000\009\000\030\000\010\000\001\000\000\000\
|
||||
\\015\000\033\000\018\000\032\000\019\000\031\000\000\000\
|
||||
\\004\000\035\000\013\000\034\000\019\000\027\000\000\000\
|
||||
\\007\000\004\000\008\000\003\000\009\000\036\000\010\000\001\000\000\000\
|
||||
\\000\000\
|
||||
\\000\000\
|
||||
\\001\000\018\000\002\000\039\000\003\000\038\000\000\000\
|
||||
\\000\000\
|
||||
\\027\000\040\000\000\000\
|
||||
\\000\000\
|
||||
\\000\000\
|
||||
\\000\000\
|
||||
\\023\000\043\000\000\000\
|
||||
\\000\000\
|
||||
\\000\000\
|
||||
\\000\000\
|
||||
\\000\000\
|
||||
\\013\000\029\000\014\000\046\000\019\000\027\000\000\000\
|
||||
\\000\000\
|
||||
\\000\000\
|
||||
\\017\000\048\000\000\000\
|
||||
\\000\000\
|
||||
\\000\000\
|
||||
\\000\000\
|
||||
\\000\000\
|
||||
\\007\000\004\000\008\000\003\000\009\000\052\000\010\000\001\000\000\000\
|
||||
\\000\000\
|
||||
\\000\000\
|
||||
\\000\000\
|
||||
\\019\000\022\000\026\000\054\000\028\000\053\000\000\000\
|
||||
\\019\000\022\000\025\000\055\000\028\000\020\000\000\000\
|
||||
\\000\000\
|
||||
\\019\000\026\000\022\000\057\000\024\000\056\000\000\000\
|
||||
\\019\000\026\000\021\000\058\000\024\000\024\000\000\000\
|
||||
\\000\000\
|
||||
\\007\000\004\000\008\000\003\000\009\000\059\000\010\000\001\000\000\000\
|
||||
\\000\000\
|
||||
\\016\000\061\000\018\000\060\000\019\000\031\000\000\000\
|
||||
\\015\000\062\000\018\000\032\000\019\000\031\000\000\000\
|
||||
\\005\000\066\000\011\000\065\000\012\000\064\000\013\000\063\000\
|
||||
\\019\000\027\000\000\000\
|
||||
\\000\000\
|
||||
\\027\000\070\000\000\000\
|
||||
\\000\000\
|
||||
\\000\000\
|
||||
\\023\000\071\000\000\000\
|
||||
\\000\000\
|
||||
\\000\000\
|
||||
\\000\000\
|
||||
\\017\000\073\000\000\000\
|
||||
\\000\000\
|
||||
\\000\000\
|
||||
\\000\000\
|
||||
\\000\000\
|
||||
\\006\000\074\000\000\000\
|
||||
\\000\000\
|
||||
\\007\000\004\000\008\000\003\000\009\000\076\000\010\000\001\000\000\000\
|
||||
\\007\000\004\000\008\000\003\000\009\000\077\000\010\000\001\000\000\000\
|
||||
\\000\000\
|
||||
\\000\000\
|
||||
\\000\000\
|
||||
\\000\000\
|
||||
\\000\000\
|
||||
\\000\000\
|
||||
\\004\000\078\000\013\000\034\000\019\000\027\000\000\000\
|
||||
\\000\000\
|
||||
\\000\000\
|
||||
\\000\000\
|
||||
\\011\000\081\000\012\000\064\000\013\000\063\000\019\000\027\000\000\000\
|
||||
\\000\000\
|
||||
\\000\000\
|
||||
\\000\000\
|
||||
\\000\000\
|
||||
\"
|
||||
val numstates = 84
|
||||
val numrules = 50
|
||||
val s = ref "" and index = ref 0
|
||||
val string_to_int = fn () =>
|
||||
let val i = !index
|
||||
in index := i+2; Char.ord(String.sub(!s,i)) + Char.ord(String.sub(!s,i+1)) * 256
|
||||
end
|
||||
val string_to_list = fn s' =>
|
||||
let val len = String.size s'
|
||||
fun f () =
|
||||
if !index < len then string_to_int() :: f()
|
||||
else nil
|
||||
in index := 0; s := s'; f ()
|
||||
end
|
||||
val string_to_pairlist = fn (conv_key,conv_entry) =>
|
||||
let fun f () =
|
||||
case string_to_int()
|
||||
of 0 => EMPTY
|
||||
| n => PAIR(conv_key (n-1),conv_entry (string_to_int()),f())
|
||||
in f
|
||||
end
|
||||
val string_to_pairlist_default = fn (conv_key,conv_entry) =>
|
||||
let val conv_row = string_to_pairlist(conv_key,conv_entry)
|
||||
in fn () =>
|
||||
let val default = conv_entry(string_to_int())
|
||||
val row = conv_row()
|
||||
in (row,default)
|
||||
end
|
||||
end
|
||||
val string_to_table = fn (convert_row,s') =>
|
||||
let val len = String.size s'
|
||||
fun f ()=
|
||||
if !index < len then convert_row() :: f()
|
||||
else nil
|
||||
in (s := s'; index := 0; f ())
|
||||
end
|
||||
local
|
||||
val memo = Array.array(numstates+numrules,ERROR)
|
||||
val _ =let fun g i=(Array.update(memo,i,REDUCE(i-numstates)); g(i+1))
|
||||
fun f i =
|
||||
if i=numstates then g i
|
||||
else (Array.update(memo,i,SHIFT (STATE i)); f (i+1))
|
||||
in f 0 handle Subscript => ()
|
||||
end
|
||||
in
|
||||
val entry_to_action = fn 0 => ACCEPT | 1 => ERROR | j => Array.sub(memo,(j-2))
|
||||
end
|
||||
val gotoT=Array.fromList(string_to_table(string_to_pairlist(NT,STATE),gotoT))
|
||||
val actionRows=string_to_table(string_to_pairlist_default(T,entry_to_action),actionRows)
|
||||
val actionRowNumbers = string_to_list actionRowNumbers
|
||||
val actionT = let val actionRowLookUp=
|
||||
let val a=Array.fromList(actionRows) in fn i=>Array.sub(a,i) end
|
||||
in Array.fromList(map actionRowLookUp actionRowNumbers)
|
||||
end
|
||||
in LrTable.mkLrTable {actions=actionT,gotos=gotoT,numRules=numrules,
|
||||
numStates=numstates,initialState=STATE 0}
|
||||
end
|
||||
end
|
||||
local open Header in
|
||||
type pos = SourcePos.t
|
||||
type arg = unit
|
||||
structure MlyValue =
|
||||
struct
|
||||
datatype svalue = VOID | ntVOID of unit -> unit
|
||||
| STRING of unit -> (string) | FILE of unit -> (string)
|
||||
| ID of unit -> (string) | strid of unit -> (Strid.t)
|
||||
| strbinds'' of unit -> (strbinds)
|
||||
| strbinds' of unit -> (Strid.t*strbinds)
|
||||
| strbinds of unit -> (strbinds) | sigid of unit -> (Sigid.t)
|
||||
| sigbinds'' of unit -> (sigbinds)
|
||||
| sigbinds' of unit -> (Sigid.t*sigbinds)
|
||||
| sigbinds of unit -> (sigbinds) | mlb of unit -> (Basdec.t)
|
||||
| id of unit -> (Symbol.t*Region.t) | fctid of unit -> (Fctid.t)
|
||||
| fctbinds'' of unit -> (fctbinds)
|
||||
| fctbinds' of unit -> (Fctid.t*fctbinds)
|
||||
| fctbinds of unit -> (fctbinds) | basids of unit -> (Basid.t list)
|
||||
| basid of unit -> (Basid.t) | basexpnode of unit -> (Basexp.node)
|
||||
| basexp of unit -> (Basexp.t)
|
||||
| basdecsnode of unit -> (Basdec.node)
|
||||
| basdecs of unit -> (Basdec.t)
|
||||
| basdecnode of unit -> (Basdec.node)
|
||||
| basdec of unit -> (Basdec.t) | basbinds'' of unit -> (basbinds)
|
||||
| basbinds' of unit -> (Basexp.t*basbinds)
|
||||
| basbinds of unit -> (basbinds)
|
||||
| annStar of unit -> ( ( string * Region.t ) list)
|
||||
| annPlus of unit -> ( ( string * Region.t ) list)
|
||||
| ann of unit -> (string*Region.t)
|
||||
end
|
||||
type svalue = MlyValue.svalue
|
||||
type result = Basdec.t
|
||||
end
|
||||
structure EC=
|
||||
struct
|
||||
open LrTable
|
||||
infix 5 $$
|
||||
fun x $$ y = y::x
|
||||
val is_keyword =
|
||||
fn (T 4) => true | (T 5) => true | (T 6) => true | (T 7) => true | (T
|
||||
9) => true | (T 10) => true | (T 11) => true | (T 12) => true | (T 13)
|
||||
=> true | (T 14) => true | (T 15) => true | (T 16) => true | (T 17)
|
||||
=> true | _ => false
|
||||
val preferred_change : (term list * term list) list =
|
||||
(nil
|
||||
,nil
|
||||
$$ (T 2))::
|
||||
(nil
|
||||
,nil
|
||||
$$ (T 7) $$ (T 0) $$ (T 10))::
|
||||
nil
|
||||
val noShift =
|
||||
fn (T 3) => true | _ => false
|
||||
val showTerminal =
|
||||
fn (T 0) => "ID"
|
||||
| (T 1) => "COMMA"
|
||||
| (T 2) => "SEMICOLON"
|
||||
| (T 3) => "EOF"
|
||||
| (T 4) => "AND"
|
||||
| (T 5) => "BAS"
|
||||
| (T 6) => "BASIS"
|
||||
| (T 7) => "END"
|
||||
| (T 8) => "EQUALOP"
|
||||
| (T 9) => "FUNCTOR"
|
||||
| (T 10) => "IN"
|
||||
| (T 11) => "LET"
|
||||
| (T 12) => "LOCAL"
|
||||
| (T 13) => "OPEN"
|
||||
| (T 14) => "SIGNATURE"
|
||||
| (T 15) => "STRUCTURE"
|
||||
| (T 16) => "ANN"
|
||||
| (T 17) => "PRIM"
|
||||
| (T 18) => "FILE"
|
||||
| (T 19) => "STRING"
|
||||
| _ => "bogus-term"
|
||||
local open Header in
|
||||
val errtermvalue=
|
||||
fn (T 0) => MlyValue.ID(fn () => ("bogus")) |
|
||||
_ => MlyValue.VOID
|
||||
end
|
||||
val terms : term list = nil
|
||||
$$ (T 17) $$ (T 16) $$ (T 15) $$ (T 14) $$ (T 13) $$ (T 12) $$ (T 11)
|
||||
$$ (T 10) $$ (T 9) $$ (T 8) $$ (T 7) $$ (T 6) $$ (T 5) $$ (T 4) $$
|
||||
(T 3) $$ (T 2) $$ (T 1)end
|
||||
structure Actions =
|
||||
struct
|
||||
type int = Int.int
|
||||
exception mlyAction of int
|
||||
local open Header in
|
||||
val actions =
|
||||
fn (i392:int,defaultPos,stack,
|
||||
(()):arg) =>
|
||||
case (i392,stack)
|
||||
of ( 0, ( ( _, ( MlyValue.basdecs basdecs1, basdecs1left,
|
||||
basdecs1right)) :: rest671)) => let val result = MlyValue.mlb (fn _
|
||||
=> let val (basdecs as basdecs1) = basdecs1 ()
|
||||
in (basdecs)
|
||||
end)
|
||||
in ( LrTable.NT 19, ( result, basdecs1left, basdecs1right), rest671)
|
||||
|
||||
end
|
||||
| ( 1, ( ( _, ( MlyValue.basdecsnode basdecsnode1, (basdecsnodeleft
|
||||
as basdecsnode1left), (basdecsnoderight as basdecsnode1right))) ::
|
||||
rest671)) => let val result = MlyValue.basdecs (fn _ => let val (
|
||||
basdecsnode as basdecsnode1) = basdecsnode1 ()
|
||||
in (
|
||||
Basdec.makeRegion'
|
||||
(basdecsnode, basdecsnodeleft, basdecsnoderight)
|
||||
)
|
||||
end)
|
||||
in ( LrTable.NT 8, ( result, basdecsnode1left, basdecsnode1right),
|
||||
rest671)
|
||||
end
|
||||
| ( 2, ( rest671)) => let val result = MlyValue.basdecsnode (fn _ =>
|
||||
(Basdec.Seq []))
|
||||
in ( LrTable.NT 9, ( result, defaultPos, defaultPos), rest671)
|
||||
end
|
||||
| ( 3, ( ( _, ( MlyValue.basdecs basdecs1, _, basdecs1right)) :: ( _,
|
||||
( _, SEMICOLON1left, _)) :: rest671)) => let val result =
|
||||
MlyValue.basdecsnode (fn _ => let val (basdecs as basdecs1) =
|
||||
basdecs1 ()
|
||||
in (Basdec.Seq [basdecs])
|
||||
end)
|
||||
in ( LrTable.NT 9, ( result, SEMICOLON1left, basdecs1right), rest671)
|
||||
|
||||
end
|
||||
| ( 4, ( ( _, ( MlyValue.basdecs basdecs1, _, basdecs1right)) :: ( _,
|
||||
( MlyValue.basdec basdec1, basdec1left, _)) :: rest671)) => let val
|
||||
result = MlyValue.basdecsnode (fn _ => let val (basdec as basdec1) =
|
||||
basdec1 ()
|
||||
val (basdecs as basdecs1) = basdecs1 ()
|
||||
in (Basdec.Seq [basdec, basdecs])
|
||||
end)
|
||||
in ( LrTable.NT 9, ( result, basdec1left, basdecs1right), rest671)
|
||||
|
||||
end
|
||||
| ( 5, ( ( _, ( MlyValue.basdecnode basdecnode1, (basdecnodeleft as
|
||||
basdecnode1left), (basdecnoderight as basdecnode1right))) :: rest671))
|
||||
=> let val result = MlyValue.basdec (fn _ => let val (basdecnode
|
||||
as basdecnode1) = basdecnode1 ()
|
||||
in (
|
||||
Basdec.makeRegion'
|
||||
(basdecnode, basdecnodeleft, basdecnoderight)
|
||||
)
|
||||
end)
|
||||
in ( LrTable.NT 6, ( result, basdecnode1left, basdecnode1right),
|
||||
rest671)
|
||||
end
|
||||
| ( 6, ( ( _, ( MlyValue.fctbinds fctbinds1, _, (fctbindsright as
|
||||
fctbinds1right))) :: ( _, ( _, (FUNCTORleft as FUNCTOR1left), _)) ::
|
||||
rest671)) => let val result = MlyValue.basdecnode (fn _ => let val (
|
||||
fctbinds as fctbinds1) = fctbinds1 ()
|
||||
in (
|
||||
let
|
||||
val fctbinds = Vector.fromList fctbinds
|
||||
in
|
||||
Basdec.Defs (ModIdBind.makeRegion' (ModIdBind.Fct fctbinds, FUNCTORleft, fctbindsright))
|
||||
end
|
||||
)
|
||||
end)
|
||||
in ( LrTable.NT 7, ( result, FUNCTOR1left, fctbinds1right), rest671)
|
||||
|
||||
end
|
||||
| ( 7, ( ( _, ( MlyValue.sigbinds sigbinds1, _, (sigbindsright as
|
||||
sigbinds1right))) :: ( _, ( _, (SIGNATUREleft as SIGNATURE1left), _))
|
||||
:: rest671)) => let val result = MlyValue.basdecnode (fn _ => let
|
||||
val (sigbinds as sigbinds1) = sigbinds1 ()
|
||||
in (
|
||||
let
|
||||
val sigbinds = Vector.fromList sigbinds
|
||||
in
|
||||
Basdec.Defs (ModIdBind.makeRegion' (ModIdBind.Sig sigbinds, SIGNATUREleft, sigbindsright))
|
||||
end
|
||||
)
|
||||
end)
|
||||
in ( LrTable.NT 7, ( result, SIGNATURE1left, sigbinds1right), rest671
|
||||
)
|
||||
end
|
||||
| ( 8, ( ( _, ( MlyValue.strbinds strbinds1, _, (strbindsright as
|
||||
strbinds1right))) :: ( _, ( _, (STRUCTUREleft as STRUCTURE1left), _))
|
||||
:: rest671)) => let val result = MlyValue.basdecnode (fn _ => let
|
||||
val (strbinds as strbinds1) = strbinds1 ()
|
||||
in (
|
||||
let
|
||||
val strbinds = Vector.fromList strbinds
|
||||
in
|
||||
Basdec.Defs (ModIdBind.makeRegion' (ModIdBind.Str strbinds, STRUCTUREleft, strbindsright))
|
||||
end
|
||||
)
|
||||
end)
|
||||
in ( LrTable.NT 7, ( result, STRUCTURE1left, strbinds1right), rest671
|
||||
)
|
||||
end
|
||||
| ( 9, ( ( _, ( MlyValue.basbinds basbinds1, _, basbinds1right)) :: (
|
||||
_, ( _, BASIS1left, _)) :: rest671)) => let val result =
|
||||
MlyValue.basdecnode (fn _ => let val (basbinds as basbinds1) =
|
||||
basbinds1 ()
|
||||
in (
|
||||
let
|
||||
val basbinds = Vector.fromList basbinds
|
||||
in
|
||||
Basdec.Basis basbinds
|
||||
end
|
||||
)
|
||||
end)
|
||||
in ( LrTable.NT 7, ( result, BASIS1left, basbinds1right), rest671)
|
||||
|
||||
end
|
||||
| ( 10, ( ( _, ( _, _, END1right)) :: ( _, ( MlyValue.basdecs
|
||||
basdecs2, _, _)) :: _ :: ( _, ( MlyValue.basdecs basdecs1, _, _)) :: (
|
||||
_, ( _, LOCAL1left, _)) :: rest671)) => let val result =
|
||||
MlyValue.basdecnode (fn _ => let val basdecs1 = basdecs1 ()
|
||||
val basdecs2 = basdecs2 ()
|
||||
in (Basdec.Local (basdecs1, basdecs2))
|
||||
end)
|
||||
in ( LrTable.NT 7, ( result, LOCAL1left, END1right), rest671)
|
||||
end
|
||||
| ( 11, ( ( _, ( MlyValue.basids basids1, _, basids1right)) :: ( _, (
|
||||
_, OPEN1left, _)) :: rest671)) => let val result =
|
||||
MlyValue.basdecnode (fn _ => let val (basids as basids1) = basids1 ()
|
||||
in (Basdec.Open (Vector.fromList basids))
|
||||
end)
|
||||
in ( LrTable.NT 7, ( result, OPEN1left, basids1right), rest671)
|
||||
end
|
||||
| ( 12, ( ( _, ( MlyValue.FILE FILE1, (FILEleft as FILE1left), (
|
||||
FILEright as FILE1right))) :: rest671)) => let val result =
|
||||
MlyValue.basdecnode (fn _ => let val (FILE as FILE1) = FILE1 ()
|
||||
in (
|
||||
let val reg = reg (FILEleft, FILEright)
|
||||
in lexAndParseProgOrMLB (FILE, reg)
|
||||
end
|
||||
)
|
||||
end)
|
||||
in ( LrTable.NT 7, ( result, FILE1left, FILE1right), rest671)
|
||||
end
|
||||
| ( 13, ( ( _, ( MlyValue.STRING STRING1, (STRINGleft as STRING1left)
|
||||
, (STRINGright as STRING1right))) :: rest671)) => let val result =
|
||||
MlyValue.basdecnode (fn _ => let val (STRING as STRING1) = STRING1 ()
|
||||
in (
|
||||
let val reg = reg (STRINGleft, STRINGright)
|
||||
in lexAndParseProgOrMLB (STRING, reg)
|
||||
end
|
||||
)
|
||||
end)
|
||||
in ( LrTable.NT 7, ( result, STRING1left, STRING1right), rest671)
|
||||
end
|
||||
| ( 14, ( ( _, ( _, PRIM1left, PRIM1right)) :: rest671)) => let val
|
||||
result = MlyValue.basdecnode (fn _ => (Basdec.Prim))
|
||||
in ( LrTable.NT 7, ( result, PRIM1left, PRIM1right), rest671)
|
||||
end
|
||||
| ( 15, ( ( _, ( _, _, END1right)) :: ( _, ( MlyValue.basdecs
|
||||
basdecs1, _, _)) :: _ :: ( _, ( MlyValue.annPlus annPlus1, _, _)) :: (
|
||||
_, ( _, ANN1left, _)) :: rest671)) => let val result =
|
||||
MlyValue.basdecnode (fn _ => let val (annPlus as annPlus1) = annPlus1
|
||||
()
|
||||
val (basdecs as basdecs1) = basdecs1 ()
|
||||
in (
|
||||
let
|
||||
val extendRight =
|
||||
let val right = valOf (Region.right (Basdec.region basdecs))
|
||||
in fn reg => Region.extendRight (reg, right)
|
||||
end
|
||||
fun mkAnn' ((ann,reg), basdecs) = Basdec.Ann (ann, reg, basdecs)
|
||||
fun mkAnn ((ann,reg), basdecsnode) : Basdec.node =
|
||||
mkAnn' ((ann,reg), Basdec.makeRegion (basdecsnode, extendRight reg))
|
||||
val (anns,ann) = List.splitLast annPlus
|
||||
in
|
||||
List.fold(anns, mkAnn'(ann, basdecs), mkAnn)
|
||||
end
|
||||
)
|
||||
end)
|
||||
in ( LrTable.NT 7, ( result, ANN1left, END1right), rest671)
|
||||
end
|
||||
| ( 16, ( ( _, ( MlyValue.fctbinds' fctbinds'1, _, fctbinds'1right))
|
||||
:: _ :: ( _, ( MlyValue.fctid fctid1, fctid1left, _)) :: rest671)) =>
|
||||
let val result = MlyValue.fctbinds (fn _ => let val (fctid as
|
||||
fctid1) = fctid1 ()
|
||||
val (fctbinds' as fctbinds'1) = fctbinds'1 ()
|
||||
in (
|
||||
let val (def, fctbinds) = fctbinds'
|
||||
in {lhs = fctid, rhs = def}
|
||||
:: fctbinds
|
||||
end
|
||||
)
|
||||
end)
|
||||
in ( LrTable.NT 14, ( result, fctid1left, fctbinds'1right), rest671)
|
||||
|
||||
end
|
||||
| ( 17, ( ( _, ( MlyValue.fctbinds'' fctbinds''1, _, fctbinds''1right
|
||||
)) :: ( _, ( MlyValue.fctid fctid1, fctid1left, _)) :: rest671)) =>
|
||||
let val result = MlyValue.fctbinds (fn _ => let val (fctid as
|
||||
fctid1) = fctid1 ()
|
||||
val (fctbinds'' as fctbinds''1) = fctbinds''1 ()
|
||||
in ({lhs = fctid, rhs = fctid} :: fctbinds'')
|
||||
end)
|
||||
in ( LrTable.NT 14, ( result, fctid1left, fctbinds''1right), rest671)
|
||||
|
||||
end
|
||||
| ( 18, ( ( _, ( MlyValue.fctbinds'' fctbinds''1, _, fctbinds''1right
|
||||
)) :: ( _, ( MlyValue.fctid fctid1, fctid1left, _)) :: rest671)) =>
|
||||
let val result = MlyValue.fctbinds' (fn _ => let val (fctid as
|
||||
fctid1) = fctid1 ()
|
||||
val (fctbinds'' as fctbinds''1) = fctbinds''1 ()
|
||||
in (fctid, fctbinds'')
|
||||
end)
|
||||
in ( LrTable.NT 15, ( result, fctid1left, fctbinds''1right), rest671)
|
||||
|
||||
end
|
||||
| ( 19, ( rest671)) => let val result = MlyValue.fctbinds'' (fn _ =>
|
||||
([]))
|
||||
in ( LrTable.NT 16, ( result, defaultPos, defaultPos), rest671)
|
||||
end
|
||||
| ( 20, ( ( _, ( MlyValue.fctbinds fctbinds1, _, fctbinds1right)) ::
|
||||
( _, ( _, AND1left, _)) :: rest671)) => let val result =
|
||||
MlyValue.fctbinds'' (fn _ => let val (fctbinds as fctbinds1) =
|
||||
fctbinds1 ()
|
||||
in (fctbinds)
|
||||
end)
|
||||
in ( LrTable.NT 16, ( result, AND1left, fctbinds1right), rest671)
|
||||
end
|
||||
| ( 21, ( ( _, ( MlyValue.sigbinds' sigbinds'1, _, sigbinds'1right))
|
||||
:: _ :: ( _, ( MlyValue.sigid sigid1, sigid1left, _)) :: rest671)) =>
|
||||
let val result = MlyValue.sigbinds (fn _ => let val (sigid as
|
||||
sigid1) = sigid1 ()
|
||||
val (sigbinds' as sigbinds'1) = sigbinds'1 ()
|
||||
in (
|
||||
let val (def, sigbinds) = sigbinds'
|
||||
in {lhs = sigid, rhs = def}
|
||||
:: sigbinds
|
||||
end
|
||||
)
|
||||
end)
|
||||
in ( LrTable.NT 20, ( result, sigid1left, sigbinds'1right), rest671)
|
||||
|
||||
end
|
||||
| ( 22, ( ( _, ( MlyValue.sigbinds'' sigbinds''1, _, sigbinds''1right
|
||||
)) :: ( _, ( MlyValue.sigid sigid1, sigid1left, _)) :: rest671)) =>
|
||||
let val result = MlyValue.sigbinds (fn _ => let val (sigid as
|
||||
sigid1) = sigid1 ()
|
||||
val (sigbinds'' as sigbinds''1) = sigbinds''1 ()
|
||||
in ({lhs = sigid, rhs = sigid} :: sigbinds'')
|
||||
end)
|
||||
in ( LrTable.NT 20, ( result, sigid1left, sigbinds''1right), rest671)
|
||||
|
||||
end
|
||||
| ( 23, ( ( _, ( MlyValue.sigbinds'' sigbinds''1, _, sigbinds''1right
|
||||
)) :: ( _, ( MlyValue.sigid sigid1, sigid1left, _)) :: rest671)) =>
|
||||
let val result = MlyValue.sigbinds' (fn _ => let val (sigid as
|
||||
sigid1) = sigid1 ()
|
||||
val (sigbinds'' as sigbinds''1) = sigbinds''1 ()
|
||||
in (sigid, sigbinds'')
|
||||
end)
|
||||
in ( LrTable.NT 21, ( result, sigid1left, sigbinds''1right), rest671)
|
||||
|
||||
end
|
||||
| ( 24, ( rest671)) => let val result = MlyValue.sigbinds'' (fn _ =>
|
||||
([]))
|
||||
in ( LrTable.NT 22, ( result, defaultPos, defaultPos), rest671)
|
||||
end
|
||||
| ( 25, ( ( _, ( MlyValue.sigbinds sigbinds1, _, sigbinds1right)) ::
|
||||
( _, ( _, AND1left, _)) :: rest671)) => let val result =
|
||||
MlyValue.sigbinds'' (fn _ => let val (sigbinds as sigbinds1) =
|
||||
sigbinds1 ()
|
||||
in (sigbinds)
|
||||
end)
|
||||
in ( LrTable.NT 22, ( result, AND1left, sigbinds1right), rest671)
|
||||
end
|
||||
| ( 26, ( ( _, ( MlyValue.strbinds' strbinds'1, _, strbinds'1right))
|
||||
:: _ :: ( _, ( MlyValue.strid strid1, strid1left, _)) :: rest671)) =>
|
||||
let val result = MlyValue.strbinds (fn _ => let val (strid as
|
||||
strid1) = strid1 ()
|
||||
val (strbinds' as strbinds'1) = strbinds'1 ()
|
||||
in (
|
||||
let val (def, strbinds) = strbinds'
|
||||
in {lhs = strid, rhs = def}
|
||||
:: strbinds
|
||||
end
|
||||
)
|
||||
end)
|
||||
in ( LrTable.NT 24, ( result, strid1left, strbinds'1right), rest671)
|
||||
|
||||
end
|
||||
| ( 27, ( ( _, ( MlyValue.strbinds'' strbinds''1, _, strbinds''1right
|
||||
)) :: ( _, ( MlyValue.strid strid1, strid1left, _)) :: rest671)) =>
|
||||
let val result = MlyValue.strbinds (fn _ => let val (strid as
|
||||
strid1) = strid1 ()
|
||||
val (strbinds'' as strbinds''1) = strbinds''1 ()
|
||||
in ({lhs = strid, rhs = strid} :: strbinds'')
|
||||
end)
|
||||
in ( LrTable.NT 24, ( result, strid1left, strbinds''1right), rest671)
|
||||
|
||||
end
|
||||
| ( 28, ( ( _, ( MlyValue.strbinds'' strbinds''1, _, strbinds''1right
|
||||
)) :: ( _, ( MlyValue.strid strid1, strid1left, _)) :: rest671)) =>
|
||||
let val result = MlyValue.strbinds' (fn _ => let val (strid as
|
||||
strid1) = strid1 ()
|
||||
val (strbinds'' as strbinds''1) = strbinds''1 ()
|
||||
in (strid, strbinds'')
|
||||
end)
|
||||
in ( LrTable.NT 25, ( result, strid1left, strbinds''1right), rest671)
|
||||
|
||||
end
|
||||
| ( 29, ( rest671)) => let val result = MlyValue.strbinds'' (fn _ =>
|
||||
([]))
|
||||
in ( LrTable.NT 26, ( result, defaultPos, defaultPos), rest671)
|
||||
end
|
||||
| ( 30, ( ( _, ( MlyValue.strbinds strbinds1, _, strbinds1right)) ::
|
||||
( _, ( _, AND1left, _)) :: rest671)) => let val result =
|
||||
MlyValue.strbinds'' (fn _ => let val (strbinds as strbinds1) =
|
||||
strbinds1 ()
|
||||
in (strbinds)
|
||||
end)
|
||||
in ( LrTable.NT 26, ( result, AND1left, strbinds1right), rest671)
|
||||
end
|
||||
| ( 31, ( ( _, ( MlyValue.basbinds' basbinds'1, _, basbinds'1right))
|
||||
:: _ :: ( _, ( MlyValue.basid basid1, basid1left, _)) :: rest671)) =>
|
||||
let val result = MlyValue.basbinds (fn _ => let val (basid as
|
||||
basid1) = basid1 ()
|
||||
val (basbinds' as basbinds'1) = basbinds'1 ()
|
||||
in (
|
||||
let val (def, basbinds) = basbinds'
|
||||
in {name = basid, def = def}
|
||||
:: basbinds
|
||||
end
|
||||
)
|
||||
end)
|
||||
in ( LrTable.NT 3, ( result, basid1left, basbinds'1right), rest671)
|
||||
|
||||
end
|
||||
| ( 32, ( ( _, ( MlyValue.basbinds'' basbinds''1, _, basbinds''1right
|
||||
)) :: ( _, ( MlyValue.basexp basexp1, basexp1left, _)) :: rest671)) =>
|
||||
let val result = MlyValue.basbinds' (fn _ => let val (basexp as
|
||||
basexp1) = basexp1 ()
|
||||
val (basbinds'' as basbinds''1) = basbinds''1 ()
|
||||
in (basexp, basbinds'')
|
||||
end)
|
||||
in ( LrTable.NT 4, ( result, basexp1left, basbinds''1right), rest671)
|
||||
|
||||
end
|
||||
| ( 33, ( rest671)) => let val result = MlyValue.basbinds'' (fn _ =>
|
||||
([]))
|
||||
in ( LrTable.NT 5, ( result, defaultPos, defaultPos), rest671)
|
||||
end
|
||||
| ( 34, ( ( _, ( MlyValue.basbinds basbinds1, _, basbinds1right)) ::
|
||||
( _, ( _, AND1left, _)) :: rest671)) => let val result =
|
||||
MlyValue.basbinds'' (fn _ => let val (basbinds as basbinds1) =
|
||||
basbinds1 ()
|
||||
in (basbinds)
|
||||
end)
|
||||
in ( LrTable.NT 5, ( result, AND1left, basbinds1right), rest671)
|
||||
end
|
||||
| ( 35, ( ( _, ( MlyValue.basexpnode basexpnode1, (basexpnodeleft as
|
||||
basexpnode1left), (basexpnoderight as basexpnode1right))) :: rest671))
|
||||
=> let val result = MlyValue.basexp (fn _ => let val (basexpnode
|
||||
as basexpnode1) = basexpnode1 ()
|
||||
in (
|
||||
Basexp.makeRegion'
|
||||
(basexpnode, basexpnodeleft, basexpnoderight)
|
||||
)
|
||||
end)
|
||||
in ( LrTable.NT 10, ( result, basexpnode1left, basexpnode1right),
|
||||
rest671)
|
||||
end
|
||||
| ( 36, ( ( _, ( _, _, END1right)) :: ( _, ( MlyValue.basdecs
|
||||
basdecs1, _, _)) :: ( _, ( _, BAS1left, _)) :: rest671)) => let val
|
||||
result = MlyValue.basexpnode (fn _ => let val (basdecs as basdecs1) =
|
||||
basdecs1 ()
|
||||
in (Basexp.Bas basdecs)
|
||||
end)
|
||||
in ( LrTable.NT 11, ( result, BAS1left, END1right), rest671)
|
||||
end
|
||||
| ( 37, ( ( _, ( MlyValue.basid basid1, basid1left, basid1right)) ::
|
||||
rest671)) => let val result = MlyValue.basexpnode (fn _ => let val (
|
||||
basid as basid1) = basid1 ()
|
||||
in (Basexp.Var basid)
|
||||
end)
|
||||
in ( LrTable.NT 11, ( result, basid1left, basid1right), rest671)
|
||||
end
|
||||
| ( 38, ( ( _, ( _, _, END1right)) :: ( _, ( MlyValue.basexp basexp1,
|
||||
_, _)) :: _ :: ( _, ( MlyValue.basdecs basdecs1, _, _)) :: ( _, ( _,
|
||||
LET1left, _)) :: rest671)) => let val result = MlyValue.basexpnode
|
||||
(fn _ => let val (basdecs as basdecs1) = basdecs1 ()
|
||||
val (basexp as basexp1) = basexp1 ()
|
||||
in (Basexp.Let (basdecs, basexp))
|
||||
end)
|
||||
in ( LrTable.NT 11, ( result, LET1left, END1right), rest671)
|
||||
end
|
||||
| ( 39, ( ( _, ( MlyValue.id id1, id1left, id1right)) :: rest671)) =>
|
||||
let val result = MlyValue.basid (fn _ => let val (id as id1) = id1
|
||||
()
|
||||
in (Basid.fromSymbol id)
|
||||
end)
|
||||
in ( LrTable.NT 12, ( result, id1left, id1right), rest671)
|
||||
end
|
||||
| ( 40, ( ( _, ( MlyValue.basid basid1, basid1left, basid1right)) ::
|
||||
rest671)) => let val result = MlyValue.basids (fn _ => let val (
|
||||
basid as basid1) = basid1 ()
|
||||
in ([basid])
|
||||
end)
|
||||
in ( LrTable.NT 13, ( result, basid1left, basid1right), rest671)
|
||||
end
|
||||
| ( 41, ( ( _, ( MlyValue.basids basids1, _, basids1right)) :: ( _, (
|
||||
MlyValue.basid basid1, basid1left, _)) :: rest671)) => let val
|
||||
result = MlyValue.basids (fn _ => let val (basid as basid1) = basid1
|
||||
()
|
||||
val (basids as basids1) = basids1 ()
|
||||
in (basid :: basids)
|
||||
end)
|
||||
in ( LrTable.NT 13, ( result, basid1left, basids1right), rest671)
|
||||
end
|
||||
| ( 42, ( ( _, ( MlyValue.id id1, id1left, id1right)) :: rest671)) =>
|
||||
let val result = MlyValue.fctid (fn _ => let val (id as id1) = id1
|
||||
()
|
||||
in (Fctid.fromSymbol id)
|
||||
end)
|
||||
in ( LrTable.NT 17, ( result, id1left, id1right), rest671)
|
||||
end
|
||||
| ( 43, ( ( _, ( MlyValue.id id1, id1left, id1right)) :: rest671)) =>
|
||||
let val result = MlyValue.sigid (fn _ => let val (id as id1) = id1
|
||||
()
|
||||
in (Sigid.fromSymbol id)
|
||||
end)
|
||||
in ( LrTable.NT 23, ( result, id1left, id1right), rest671)
|
||||
end
|
||||
| ( 44, ( ( _, ( MlyValue.id id1, id1left, id1right)) :: rest671)) =>
|
||||
let val result = MlyValue.strid (fn _ => let val (id as id1) = id1
|
||||
()
|
||||
in (Strid.fromSymbol id)
|
||||
end)
|
||||
in ( LrTable.NT 27, ( result, id1left, id1right), rest671)
|
||||
end
|
||||
| ( 45, ( ( _, ( MlyValue.ID ID1, (IDleft as ID1left), (IDright as
|
||||
ID1right))) :: rest671)) => let val result = MlyValue.id (fn _ => let
|
||||
val (ID as ID1) = ID1 ()
|
||||
in (Symbol.fromString ID, reg (IDleft, IDright))
|
||||
end)
|
||||
in ( LrTable.NT 18, ( result, ID1left, ID1right), rest671)
|
||||
end
|
||||
| ( 46, ( ( _, ( MlyValue.STRING STRING1, (STRINGleft as STRING1left)
|
||||
, (STRINGright as STRING1right))) :: rest671)) => let val result =
|
||||
MlyValue.ann (fn _ => let val (STRING as STRING1) = STRING1 ()
|
||||
in (STRING, reg (STRINGleft, STRINGright))
|
||||
end)
|
||||
in ( LrTable.NT 0, ( result, STRING1left, STRING1right), rest671)
|
||||
end
|
||||
| ( 47, ( ( _, ( MlyValue.annStar annStar1, _, annStar1right)) :: ( _
|
||||
, ( MlyValue.ann ann1, ann1left, _)) :: rest671)) => let val result =
|
||||
MlyValue.annPlus (fn _ => let val (ann as ann1) = ann1 ()
|
||||
val (annStar as annStar1) = annStar1 ()
|
||||
in (ann::annStar)
|
||||
end)
|
||||
in ( LrTable.NT 1, ( result, ann1left, annStar1right), rest671)
|
||||
end
|
||||
| ( 48, ( rest671)) => let val result = MlyValue.annStar (fn _ => (
|
||||
[]))
|
||||
in ( LrTable.NT 2, ( result, defaultPos, defaultPos), rest671)
|
||||
end
|
||||
| ( 49, ( ( _, ( MlyValue.annPlus annPlus1, annPlus1left,
|
||||
annPlus1right)) :: rest671)) => let val result = MlyValue.annStar (fn
|
||||
_ => let val (annPlus as annPlus1) = annPlus1 ()
|
||||
in (annPlus)
|
||||
end)
|
||||
in ( LrTable.NT 2, ( result, annPlus1left, annPlus1right), rest671)
|
||||
|
||||
end
|
||||
| _ => raise (mlyAction i392)
|
||||
end
|
||||
val void = MlyValue.VOID
|
||||
val extract = fn a => (fn MlyValue.mlb x => x
|
||||
| _ => let exception ParseInternal
|
||||
in raise ParseInternal end) a ()
|
||||
end
|
||||
end
|
||||
structure Tokens : MLB_TOKENS =
|
||||
struct
|
||||
type svalue = ParserData.svalue
|
||||
type ('a,'b) token = ('a,'b) Token.token
|
||||
fun ID (i,p1,p2) = Token.TOKEN (ParserData.LrTable.T 0,(
|
||||
ParserData.MlyValue.ID (fn () => i),p1,p2))
|
||||
fun COMMA (p1,p2) = Token.TOKEN (ParserData.LrTable.T 1,(
|
||||
ParserData.MlyValue.VOID,p1,p2))
|
||||
fun SEMICOLON (p1,p2) = Token.TOKEN (ParserData.LrTable.T 2,(
|
||||
ParserData.MlyValue.VOID,p1,p2))
|
||||
fun EOF (p1,p2) = Token.TOKEN (ParserData.LrTable.T 3,(
|
||||
ParserData.MlyValue.VOID,p1,p2))
|
||||
fun AND (p1,p2) = Token.TOKEN (ParserData.LrTable.T 4,(
|
||||
ParserData.MlyValue.VOID,p1,p2))
|
||||
fun BAS (p1,p2) = Token.TOKEN (ParserData.LrTable.T 5,(
|
||||
ParserData.MlyValue.VOID,p1,p2))
|
||||
fun BASIS (p1,p2) = Token.TOKEN (ParserData.LrTable.T 6,(
|
||||
ParserData.MlyValue.VOID,p1,p2))
|
||||
fun END (p1,p2) = Token.TOKEN (ParserData.LrTable.T 7,(
|
||||
ParserData.MlyValue.VOID,p1,p2))
|
||||
fun EQUALOP (p1,p2) = Token.TOKEN (ParserData.LrTable.T 8,(
|
||||
ParserData.MlyValue.VOID,p1,p2))
|
||||
fun FUNCTOR (p1,p2) = Token.TOKEN (ParserData.LrTable.T 9,(
|
||||
ParserData.MlyValue.VOID,p1,p2))
|
||||
fun IN (p1,p2) = Token.TOKEN (ParserData.LrTable.T 10,(
|
||||
ParserData.MlyValue.VOID,p1,p2))
|
||||
fun LET (p1,p2) = Token.TOKEN (ParserData.LrTable.T 11,(
|
||||
ParserData.MlyValue.VOID,p1,p2))
|
||||
fun LOCAL (p1,p2) = Token.TOKEN (ParserData.LrTable.T 12,(
|
||||
ParserData.MlyValue.VOID,p1,p2))
|
||||
fun OPEN (p1,p2) = Token.TOKEN (ParserData.LrTable.T 13,(
|
||||
ParserData.MlyValue.VOID,p1,p2))
|
||||
fun SIGNATURE (p1,p2) = Token.TOKEN (ParserData.LrTable.T 14,(
|
||||
ParserData.MlyValue.VOID,p1,p2))
|
||||
fun STRUCTURE (p1,p2) = Token.TOKEN (ParserData.LrTable.T 15,(
|
||||
ParserData.MlyValue.VOID,p1,p2))
|
||||
fun ANN (p1,p2) = Token.TOKEN (ParserData.LrTable.T 16,(
|
||||
ParserData.MlyValue.VOID,p1,p2))
|
||||
fun PRIM (p1,p2) = Token.TOKEN (ParserData.LrTable.T 17,(
|
||||
ParserData.MlyValue.VOID,p1,p2))
|
||||
fun FILE (i,p1,p2) = Token.TOKEN (ParserData.LrTable.T 18,(
|
||||
ParserData.MlyValue.FILE (fn () => i),p1,p2))
|
||||
fun STRING (i,p1,p2) = Token.TOKEN (ParserData.LrTable.T 19,(
|
||||
ParserData.MlyValue.STRING (fn () => i),p1,p2))
|
||||
end
|
||||
end
|
1854
lang/mlton/files/mlb.lex.sml
Normal file
1854
lang/mlton/files/mlb.lex.sml
Normal file
File diff suppressed because it is too large
Load Diff
22
lang/mlton/files/patch-Makefile
Normal file
22
lang/mlton/files/patch-Makefile
Normal file
@ -0,0 +1,22 @@
|
||||
--- Makefile.orig 2007-08-27 07:04:14.000000000 +1000
|
||||
+++ Makefile 2008-04-28 10:23:28.000000000 +1000
|
||||
@@ -34,7 +34,11 @@
|
||||
PATH := $(BIN):$(SRC)/bin:$(shell echo $$PATH)
|
||||
CP := /bin/cp -fpR
|
||||
GZIP := gzip --force --best
|
||||
+ifeq ($(TARGET), mingw32)
|
||||
+RANLIB := $(TARGET)-ranlib
|
||||
+else
|
||||
RANLIB := ranlib
|
||||
+endif
|
||||
|
||||
# If we're compiling with another version of MLton, then we want to do
|
||||
# another round of compilation so that we get a MLton built without
|
||||
@@ -410,6 +414,7 @@
|
||||
install-no-docs:
|
||||
mkdir -p "$(TLIB)" "$(TBIN)" "$(TMAN)"
|
||||
$(CP) "$(LIB)/." "$(TLIB)/"
|
||||
+ -rm "$(TLIB)/mlton.x86-bsd"
|
||||
sed "/^lib=/s;.*;lib='$(prefix)/$(ULIB)';" \
|
||||
<"$(BIN)/mlton" >"$(TBIN)/mlton"
|
||||
chmod a+x "$(TBIN)/mlton"
|
18
lang/mlton/files/patch-bin-mlton_script
Normal file
18
lang/mlton/files/patch-bin-mlton_script
Normal file
@ -0,0 +1,18 @@
|
||||
--- bin/mlton-script.orig 2008-04-22 21:15:23.000000000 +1000
|
||||
+++ bin/mlton-script 2008-04-22 21:18:33.000000000 +1000
|
||||
@@ -19,14 +19,7 @@
|
||||
mlton="$lib/mlton-compile$exe"
|
||||
world="$lib/world.mlton"
|
||||
nj='sml'
|
||||
-# Try to use the SML/NJ .arch-n-opsys
|
||||
-if .arch-n-opsys >/dev/null 2>&1; then
|
||||
- eval `.arch-n-opsys`
|
||||
- njHeap="$lib/mlton.$HEAP_SUFFIX"
|
||||
- unset `.arch-n-opsys | sed 's#=[^ ]*##g'`
|
||||
-else
|
||||
- njHeap="$lib/mlton.$HOST_ARCH-$HOST_OS"
|
||||
-fi
|
||||
+njHeap="$lib/mlton.x86-bsd"
|
||||
|
||||
declare -a rargs
|
||||
case "$1" in
|
84
lang/mlton/files/patch-runtime-Makefile
Normal file
84
lang/mlton/files/patch-runtime-Makefile
Normal file
@ -0,0 +1,84 @@
|
||||
--- runtime/Makefile.orig 2007-08-27 07:03:54.000000000 +1000
|
||||
+++ runtime/Makefile 2008-04-28 10:19:06.000000000 +1000
|
||||
@@ -11,11 +11,24 @@
|
||||
TARGET := self
|
||||
TARGET_ARCH := $(shell ../bin/host-arch)
|
||||
TARGET_OS := $(shell ../bin/host-os)
|
||||
+
|
||||
+ifeq ($(TARGET), self)
|
||||
+GCC := gcc
|
||||
+else
|
||||
+GCC := $(TARGET)-gcc
|
||||
+endif
|
||||
+
|
||||
+ifeq ($(TARGET_OS), mingw)
|
||||
+RUN := wine
|
||||
+else
|
||||
+RUN :=
|
||||
+endif
|
||||
+
|
||||
GCC_MAJOR_VERSION := \
|
||||
- $(shell gcc -v 2>&1 | grep 'gcc version' | \
|
||||
+ $(shell $(GCC) -v 2>&1 | grep 'gcc version' | \
|
||||
sed 's/.*gcc version \([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\1/')
|
||||
GCC_MINOR_VERSION := \
|
||||
- $(shell gcc -v 2>&1 | grep 'gcc version' | \
|
||||
+ $(shell $(GCC) -v 2>&1 | grep 'gcc version' | \
|
||||
sed 's/.*gcc version \([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\2/')
|
||||
GCC_VERSION := $(GCC_MAJOR_VERSION).$(GCC_MINOR_VERSION)
|
||||
|
||||
@@ -96,10 +109,9 @@
|
||||
else
|
||||
AR := $(TARGET)-ar rc
|
||||
RANLIB := $(TARGET)-ranlib
|
||||
-FLAGS += -b $(TARGET)
|
||||
endif
|
||||
|
||||
-CC := gcc -std=gnu99
|
||||
+CC := $(GCC) -std=gnu99
|
||||
CPPFLAGS :=
|
||||
CFLAGS := -I. -Iplatform $(FLAGS)
|
||||
OPTCFLAGS := $(CFLAGS) $(CPPFLAGS) $(OPTFLAGS)
|
||||
@@ -247,7 +259,7 @@
|
||||
cd gdtoa && $(CC) -o arithchk.out arithchk.c
|
||||
|
||||
gdtoa/arith.h: gdtoa/arithchk.out
|
||||
- cd gdtoa && ./arithchk.out >arith.h
|
||||
+ cd gdtoa && $(RUN) ./arithchk.out >arith.h
|
||||
|
||||
libmlton.a: $(OBJS)
|
||||
$(AR) libmlton.a $(OBJS)
|
||||
@@ -265,7 +277,7 @@
|
||||
gen/c-types.h gen/c-types.sml gen/ml-types.h: gen/gen-types.c util.h util.o
|
||||
$(CC) $(OPTCFLAGS) $(WARNCFLAGS) -o gen/gen-types gen/gen-types.c util.o
|
||||
rm -f gen/c-types.h gen/c-types.sml gen/ml-types.h
|
||||
- cd gen && ./gen-types
|
||||
+ cd gen && $(RUN) ./gen-types
|
||||
rm -f gen/gen-types$(EXE)
|
||||
|
||||
c-types.h ml-types.h: gen/c-types.h gen/ml-types.h
|
||||
@@ -276,7 +288,7 @@
|
||||
gen/basis-ffi.h gen/basis-ffi.sml: gen/gen-basis-ffi.sml gen/basis-ffi.def
|
||||
mlton -output gen/gen-basis-ffi gen/gen-basis-ffi.sml
|
||||
rm -f gen/basis-ffi.h gen/basis-ffi.sml
|
||||
- cd gen && ./gen-basis-ffi
|
||||
+ cd gen && $(RUN) ./gen-basis-ffi
|
||||
rm -f gen/gen-basis-ffi
|
||||
|
||||
basis-ffi.h: gen/basis-ffi.h
|
||||
@@ -286,13 +298,13 @@
|
||||
gen/sizes: gen/gen-sizes.c libmlton.a
|
||||
$(CC) $(OPTCFLAGS) $(WARNCFLAGS) -o gen/gen-sizes -I. -L. -lmlton gen/gen-sizes.c util.o
|
||||
rm -f gen/sizes
|
||||
- cd gen && ./gen-sizes
|
||||
+ cd gen && $(RUN) ./gen-sizes
|
||||
rm -f gen/gen-sizes$(EXE)
|
||||
|
||||
bytecode/opcodes: bytecode/print-opcodes.c bytecode/opcode.h
|
||||
$(CC) $(OPTCFLAGS) $(WARNCFLAGS) -o bytecode/print-opcodes bytecode/print-opcodes.c
|
||||
rm -f bytecode/opcodes
|
||||
- cd bytecode && ./print-opcodes > opcodes
|
||||
+ cd bytecode && $(RUN) ./print-opcodes > opcodes
|
||||
rm -f bytecode/print-opcodes$(EXE)
|
||||
|
||||
|
11
lang/mlton/files/patch-runtime-cenv.h
Normal file
11
lang/mlton/files/patch-runtime-cenv.h
Normal file
@ -0,0 +1,11 @@
|
||||
--- runtime/cenv.h.orig 2008-04-27 10:56:05.000000000 +1000
|
||||
+++ runtime/cenv.h 2008-04-27 10:56:20.000000000 +1000
|
||||
@@ -116,7 +116,7 @@
|
||||
#error unknown platform arch
|
||||
#endif
|
||||
|
||||
-#include "gmp.h"
|
||||
+#include "/usr/local/include/gmp.h"
|
||||
|
||||
COMPILE_TIME_ASSERT(sizeof_uintptr_t__is__sizeof_voidStar,
|
||||
sizeof(uintptr_t) == sizeof(void*));
|
43
lang/mlton/files/patch-runtime-mingw.c
Normal file
43
lang/mlton/files/patch-runtime-mingw.c
Normal file
@ -0,0 +1,43 @@
|
||||
--- runtime/platform/mingw.c.orig 2008-04-27 11:10:10.000000000 +1000
|
||||
+++ runtime/platform/mingw.c 2008-04-27 11:10:33.000000000 +1000
|
||||
@@ -54,40 +54,6 @@
|
||||
}
|
||||
|
||||
/* ------------------------------------------------- */
|
||||
-/* Date */
|
||||
-/* ------------------------------------------------- */
|
||||
-
|
||||
-#ifndef __GNUC__
|
||||
-#define EPOCHFILETIME (116444736000000000i64)
|
||||
-#else
|
||||
-#define EPOCHFILETIME (116444736000000000LL)
|
||||
-#endif
|
||||
-
|
||||
-/* Based on notes by Wu Yongwei:
|
||||
- * http://mywebpage.netscape.com/yongweiwutime.htm
|
||||
- */
|
||||
-int gettimeofday (struct timeval *tv, struct timezone *tz) {
|
||||
- FILETIME ft;
|
||||
- LARGE_INTEGER li;
|
||||
- __int64 t;
|
||||
- static bool tzInit = FALSE;
|
||||
-
|
||||
- unless (tzInit) {
|
||||
- tzInit = TRUE;
|
||||
- _tzset();
|
||||
- }
|
||||
- GetSystemTimeAsFileTime (&ft);
|
||||
- li.LowPart = ft.dwLowDateTime;
|
||||
- li.HighPart = ft.dwHighDateTime;
|
||||
- t = li.QuadPart;
|
||||
- t -= EPOCHFILETIME;
|
||||
- t /= 10;
|
||||
- tv->tv_sec = (long)(t / 1000000);
|
||||
- tv->tv_usec = (long)(t % 1000000);
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-/* ------------------------------------------------- */
|
||||
/* MLton.Itimer */
|
||||
/* ------------------------------------------------- */
|
||||
|
20
lang/mlton/files/patch-runtime-mingw.h
Normal file
20
lang/mlton/files/patch-runtime-mingw.h
Normal file
@ -0,0 +1,20 @@
|
||||
--- runtime/platform/mingw.h.orig 2008-04-27 10:54:07.000000000 +1000
|
||||
+++ runtime/platform/mingw.h 2008-04-27 10:54:19.000000000 +1000
|
||||
@@ -85,17 +85,6 @@
|
||||
#define SHUT_RDWR SD_BOTH
|
||||
|
||||
/* ------------------------------------------------- */
|
||||
-/* Date */
|
||||
-/* ------------------------------------------------- */
|
||||
-
|
||||
-struct timezone {
|
||||
- int tz_dsttime;
|
||||
- int tz_minuteswest;
|
||||
-};
|
||||
-
|
||||
-int gettimeofday (struct timeval *tv, struct timezone *tz);
|
||||
-
|
||||
-/* ------------------------------------------------- */
|
||||
/* MLton.Itimer */
|
||||
/* ------------------------------------------------- */
|
||||
|
68
lang/mlton/files/upgrade-basis.sml
Normal file
68
lang/mlton/files/upgrade-basis.sml
Normal file
@ -0,0 +1,68 @@
|
||||
structure MLton =
|
||||
struct
|
||||
open MLton
|
||||
|
||||
structure Platform =
|
||||
struct
|
||||
fun peek (l, f) = List.find f l
|
||||
fun omap (opt, f) = Option.map f opt
|
||||
val toLower = String.translate (str o Char.toLower)
|
||||
|
||||
structure Arch =
|
||||
struct
|
||||
datatype t = Alpha | AMD64 | ARM | HPPA | IA64 | m68k |
|
||||
MIPS | PowerPC | S390 | Sparc | X86
|
||||
|
||||
val all = [(Alpha, "Alpha"),
|
||||
(AMD64, "AMD64"),
|
||||
(ARM, "ARM"),
|
||||
(HPPA, "HPPA"),
|
||||
(IA64, "IA64"),
|
||||
(m68k, "m68k"),
|
||||
(MIPS, "MIPS"),
|
||||
(PowerPC, "PowerPC"),
|
||||
(S390, "S390"),
|
||||
(Sparc, "Sparc"),
|
||||
(X86, "X86")]
|
||||
|
||||
fun fromString s =
|
||||
let
|
||||
val s = toLower s
|
||||
in
|
||||
omap (peek (all, fn (_, s') => s = toLower s'), #1)
|
||||
end
|
||||
|
||||
val host = X86
|
||||
|
||||
fun toString a = #2 (valOf (peek (all, fn (a', _) => a = a')))
|
||||
end
|
||||
|
||||
structure OS =
|
||||
struct
|
||||
datatype t = AIX | Cygwin | Darwin | FreeBSD | HPUX | Linux
|
||||
| MinGW | NetBSD | OpenBSD | Solaris
|
||||
|
||||
val all = [(AIX, "AIX"),
|
||||
(Cygwin, "Cygwin"),
|
||||
(Darwin, "Darwin"),
|
||||
(FreeBSD, "FreeBSD"),
|
||||
(HPUX, "HPUX"),
|
||||
(Linux, "Linux"),
|
||||
(MinGW, "MinGW"),
|
||||
(NetBSD, "NetBSD"),
|
||||
(OpenBSD, "OpenBSD"),
|
||||
(Solaris, "Solaris")]
|
||||
|
||||
fun fromString s =
|
||||
let
|
||||
val s = toLower s
|
||||
in
|
||||
omap (peek (all, fn (_, s') => s = toLower s'), #1)
|
||||
end
|
||||
|
||||
val host = FreeBSD
|
||||
|
||||
fun toString a = #2 (valOf (peek (all, fn (a', _) => a = a')))
|
||||
end
|
||||
end
|
||||
end
|
54
lang/mlton/files/yacc.grm.sig
Normal file
54
lang/mlton/files/yacc.grm.sig
Normal file
@ -0,0 +1,54 @@
|
||||
signature Mlyacc_TOKENS =
|
||||
sig
|
||||
type ('a,'b) token
|
||||
type svalue
|
||||
val BOGUS_VALUE: 'a * 'a -> (svalue,'a) token
|
||||
val UNKNOWN: (string) * 'a * 'a -> (svalue,'a) token
|
||||
val VALUE: 'a * 'a -> (svalue,'a) token
|
||||
val VERBOSE: 'a * 'a -> (svalue,'a) token
|
||||
val TYVAR: (string) * 'a * 'a -> (svalue,'a) token
|
||||
val TERM: 'a * 'a -> (svalue,'a) token
|
||||
val START: 'a * 'a -> (svalue,'a) token
|
||||
val SUBST: 'a * 'a -> (svalue,'a) token
|
||||
val RPAREN: 'a * 'a -> (svalue,'a) token
|
||||
val RBRACE: 'a * 'a -> (svalue,'a) token
|
||||
val PROG: (string) * 'a * 'a -> (svalue,'a) token
|
||||
val PREFER: 'a * 'a -> (svalue,'a) token
|
||||
val PREC_TAG: 'a * 'a -> (svalue,'a) token
|
||||
val PREC: (Header.prec) * 'a * 'a -> (svalue,'a) token
|
||||
val PERCENT_TOKEN_SIG_INFO: 'a * 'a -> (svalue,'a) token
|
||||
val PERCENT_ARG: 'a * 'a -> (svalue,'a) token
|
||||
val PERCENT_POS: 'a * 'a -> (svalue,'a) token
|
||||
val PERCENT_PURE: 'a * 'a -> (svalue,'a) token
|
||||
val PERCENT_EOP: 'a * 'a -> (svalue,'a) token
|
||||
val OF: 'a * 'a -> (svalue,'a) token
|
||||
val NOSHIFT: 'a * 'a -> (svalue,'a) token
|
||||
val NONTERM: 'a * 'a -> (svalue,'a) token
|
||||
val NODEFAULT: 'a * 'a -> (svalue,'a) token
|
||||
val NAME: 'a * 'a -> (svalue,'a) token
|
||||
val LPAREN: 'a * 'a -> (svalue,'a) token
|
||||
val LBRACE: 'a * 'a -> (svalue,'a) token
|
||||
val KEYWORD: 'a * 'a -> (svalue,'a) token
|
||||
val INT: (string) * 'a * 'a -> (svalue,'a) token
|
||||
val PERCENT_HEADER: 'a * 'a -> (svalue,'a) token
|
||||
val IDDOT: (string) * 'a * 'a -> (svalue,'a) token
|
||||
val ID: (string*int) * 'a * 'a -> (svalue,'a) token
|
||||
val HEADER: (string) * 'a * 'a -> (svalue,'a) token
|
||||
val FOR: 'a * 'a -> (svalue,'a) token
|
||||
val EOF: 'a * 'a -> (svalue,'a) token
|
||||
val DELIMITER: 'a * 'a -> (svalue,'a) token
|
||||
val COMMA: 'a * 'a -> (svalue,'a) token
|
||||
val COLON: 'a * 'a -> (svalue,'a) token
|
||||
val CHANGE: 'a * 'a -> (svalue,'a) token
|
||||
val BAR: 'a * 'a -> (svalue,'a) token
|
||||
val BLOCK: 'a * 'a -> (svalue,'a) token
|
||||
val ASTERISK: 'a * 'a -> (svalue,'a) token
|
||||
val ARROW: 'a * 'a -> (svalue,'a) token
|
||||
end
|
||||
signature Mlyacc_LRVALS=
|
||||
sig
|
||||
structure Tokens : Mlyacc_TOKENS
|
||||
structure ParserData:PARSER_DATA
|
||||
sharing type ParserData.Token.token = Tokens.token
|
||||
sharing type ParserData.svalue = Tokens.svalue
|
||||
end
|
1053
lang/mlton/files/yacc.grm.sml
Normal file
1053
lang/mlton/files/yacc.grm.sml
Normal file
File diff suppressed because it is too large
Load Diff
901
lang/mlton/files/yacc.lex.sml
Normal file
901
lang/mlton/files/yacc.lex.sml
Normal file
@ -0,0 +1,901 @@
|
||||
type int = Int.int
|
||||
|
||||
functor LexMLYACC(structure Tokens : Mlyacc_TOKENS
|
||||
structure Hdr : HEADER (* = Header *)
|
||||
where type prec = Header.prec
|
||||
and type inputSource = Header.inputSource) : ARG_LEXER
|
||||
=
|
||||
struct
|
||||
structure UserDeclarations =
|
||||
struct
|
||||
(* Modified by mfluet@acm.org on 2005-8-01.
|
||||
* Update with SML/NJ 110.55+.
|
||||
*)
|
||||
(* Modified by sweeks@acm.org on 2000-8-24.
|
||||
* Ported to MLton.
|
||||
*)
|
||||
|
||||
(* ML-Yacc Parser Generator (c) 1989 Andrew W. Appel, David R. Tarditi
|
||||
|
||||
yacc.lex: Lexer specification
|
||||
*)
|
||||
|
||||
structure Tokens = Tokens
|
||||
type svalue = Tokens.svalue
|
||||
type pos = int
|
||||
type ('a,'b) token = ('a,'b) Tokens.token
|
||||
type lexresult = (svalue,pos) token
|
||||
|
||||
type lexarg = Hdr.inputSource
|
||||
type arg = lexarg
|
||||
|
||||
open Tokens
|
||||
val error = Hdr.error
|
||||
val lineno = Hdr.lineno
|
||||
val text = Hdr.text
|
||||
|
||||
val pcount: int ref = ref 0
|
||||
val commentLevel: int ref = ref 0
|
||||
val actionstart: int ref = ref 0
|
||||
|
||||
val eof = fn i => (if (!pcount)>0 then
|
||||
error i (!actionstart)
|
||||
" eof encountered in action beginning here !"
|
||||
else (); EOF(!lineno,!lineno))
|
||||
|
||||
val Add = fn s => (text := s::(!text))
|
||||
|
||||
|
||||
local val dict = [("%prec",PREC_TAG),("%term",TERM),
|
||||
("%nonterm",NONTERM), ("%eop",PERCENT_EOP),("%start",START),
|
||||
("%prefer",PREFER),("%subst",SUBST),("%change",CHANGE),
|
||||
("%keyword",KEYWORD),("%name",NAME),
|
||||
("%verbose",VERBOSE), ("%nodefault",NODEFAULT),
|
||||
("%value",VALUE), ("%noshift",NOSHIFT),
|
||||
("%header",PERCENT_HEADER),("%pure",PERCENT_PURE),
|
||||
("%token_sig_info",PERCENT_TOKEN_SIG_INFO),
|
||||
("%arg",PERCENT_ARG),
|
||||
("%pos",PERCENT_POS)]
|
||||
in
|
||||
fun lookup (s,left,right) = let
|
||||
fun f ((a,d)::b) = if a=s then d(left,right) else f b
|
||||
| f nil = UNKNOWN(s,left,right)
|
||||
in
|
||||
f dict
|
||||
end
|
||||
end
|
||||
|
||||
fun inc (ri as ref i : int ref) = (ri := i+1)
|
||||
fun dec (ri as ref i : int ref) = (ri := i-1)
|
||||
|
||||
end (* end of user routines *)
|
||||
exception LexError (* raised if illegal leaf action tried *)
|
||||
structure Internal =
|
||||
struct
|
||||
|
||||
datatype yyfinstate = N of int
|
||||
type statedata = {fin : yyfinstate list, trans: string}
|
||||
(* transition & final state table *)
|
||||
val tab = let
|
||||
val s = [
|
||||
(0,
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(1,
|
||||
"\015\015\015\015\015\015\015\015\015\015\022\015\015\021\015\015\
|
||||
\\015\015\015\015\015\015\015\015\015\015\015\015\015\015\015\015\
|
||||
\\015\015\015\015\015\019\015\015\017\015\015\015\015\015\015\015\
|
||||
\\015\015\015\015\015\015\015\015\015\015\015\015\015\015\015\015\
|
||||
\\015\015\015\015\015\015\015\015\015\015\015\015\015\015\015\015\
|
||||
\\015\015\015\015\015\015\015\015\015\015\015\015\015\015\015\015\
|
||||
\\015\015\015\015\015\015\015\015\015\015\015\015\015\015\015\015\
|
||||
\\015\015\015\015\015\015\015\015\015\015\015\015\015\015\015\015\
|
||||
\\015"
|
||||
),
|
||||
(3,
|
||||
"\023\023\023\023\023\023\023\023\023\066\069\023\023\068\023\023\
|
||||
\\023\023\023\023\023\023\023\023\023\023\023\023\023\023\023\023\
|
||||
\\066\023\023\023\023\046\023\044\042\023\041\023\040\038\023\023\
|
||||
\\036\036\036\036\036\036\036\036\036\036\035\023\023\023\023\023\
|
||||
\\023\027\027\027\027\027\027\027\027\027\027\027\027\027\027\027\
|
||||
\\027\027\027\027\027\027\027\027\027\027\027\023\023\023\023\023\
|
||||
\\023\027\027\027\027\027\032\027\027\027\027\027\027\027\027\030\
|
||||
\\027\027\027\027\027\027\027\027\027\027\027\026\025\024\023\023\
|
||||
\\023"
|
||||
),
|
||||
(5,
|
||||
"\070\070\070\070\070\070\070\070\070\070\022\070\070\075\070\070\
|
||||
\\070\070\070\070\070\070\070\070\070\070\070\070\070\070\070\070\
|
||||
\\070\070\074\070\070\070\070\070\072\071\070\070\070\070\070\070\
|
||||
\\070\070\070\070\070\070\070\070\070\070\070\070\070\070\070\070\
|
||||
\\070\070\070\070\070\070\070\070\070\070\070\070\070\070\070\070\
|
||||
\\070\070\070\070\070\070\070\070\070\070\070\070\070\070\070\070\
|
||||
\\070\070\070\070\070\070\070\070\070\070\070\070\070\070\070\070\
|
||||
\\070\070\070\070\070\070\070\070\070\070\070\070\070\070\070\070\
|
||||
\\070"
|
||||
),
|
||||
(7,
|
||||
"\076\076\076\076\076\076\076\076\076\078\022\076\076\080\076\076\
|
||||
\\076\076\076\076\076\076\076\076\076\076\076\076\076\076\076\076\
|
||||
\\078\076\076\076\076\076\076\076\076\076\076\076\076\076\076\076\
|
||||
\\076\076\076\076\076\076\076\076\076\076\076\076\076\076\076\076\
|
||||
\\076\076\076\076\076\076\076\076\076\076\076\076\076\076\076\076\
|
||||
\\076\076\076\076\076\076\076\076\076\076\076\076\077\076\076\076\
|
||||
\\076\076\076\076\076\076\076\076\076\076\076\076\076\076\076\076\
|
||||
\\076\076\076\076\076\076\076\076\076\076\076\076\076\076\076\076\
|
||||
\\076"
|
||||
),
|
||||
(9,
|
||||
"\081\081\081\081\081\081\081\081\081\081\022\081\081\075\081\081\
|
||||
\\081\081\081\081\081\081\081\081\081\081\081\081\081\081\081\081\
|
||||
\\081\081\081\081\081\081\081\081\085\084\082\081\081\081\081\081\
|
||||
\\081\081\081\081\081\081\081\081\081\081\081\081\081\081\081\081\
|
||||
\\081\081\081\081\081\081\081\081\081\081\081\081\081\081\081\081\
|
||||
\\081\081\081\081\081\081\081\081\081\081\081\081\081\081\081\081\
|
||||
\\081\081\081\081\081\081\081\081\081\081\081\081\081\081\081\081\
|
||||
\\081\081\081\081\081\081\081\081\081\081\081\081\081\081\081\081\
|
||||
\\081"
|
||||
),
|
||||
(11,
|
||||
"\087\087\087\087\087\087\087\087\087\087\095\087\087\094\087\087\
|
||||
\\087\087\087\087\087\087\087\087\087\087\087\087\087\087\087\087\
|
||||
\\087\087\093\087\087\087\087\087\087\087\087\087\087\087\087\087\
|
||||
\\087\087\087\087\087\087\087\087\087\087\087\087\087\087\087\087\
|
||||
\\087\087\087\087\087\087\087\087\087\087\087\087\087\087\087\087\
|
||||
\\087\087\087\087\087\087\087\087\087\087\087\087\088\087\087\087\
|
||||
\\087\087\087\087\087\087\087\087\087\087\087\087\087\087\087\087\
|
||||
\\087\087\087\087\087\087\087\087\087\087\087\087\087\087\087\087\
|
||||
\\087"
|
||||
),
|
||||
(13,
|
||||
"\096\096\096\096\096\096\096\096\096\096\022\096\096\075\096\096\
|
||||
\\096\096\096\096\096\096\096\096\096\096\096\096\096\096\096\096\
|
||||
\\096\096\096\096\096\096\096\096\100\099\097\096\096\096\096\096\
|
||||
\\096\096\096\096\096\096\096\096\096\096\096\096\096\096\096\096\
|
||||
\\096\096\096\096\096\096\096\096\096\096\096\096\096\096\096\096\
|
||||
\\096\096\096\096\096\096\096\096\096\096\096\096\096\096\096\096\
|
||||
\\096\096\096\096\096\096\096\096\096\096\096\096\096\096\096\096\
|
||||
\\096\096\096\096\096\096\096\096\096\096\096\096\096\096\096\096\
|
||||
\\096"
|
||||
),
|
||||
(15,
|
||||
"\016\016\016\016\016\016\016\016\016\016\000\016\016\000\016\016\
|
||||
\\016\016\016\016\016\016\016\016\016\016\016\016\016\016\016\016\
|
||||
\\016\016\016\016\016\000\016\016\016\016\016\016\016\016\016\016\
|
||||
\\016\016\016\016\016\016\016\016\016\016\016\016\016\016\016\016\
|
||||
\\016\016\016\016\016\016\016\016\016\016\016\016\016\016\016\016\
|
||||
\\016\016\016\016\016\016\016\016\016\016\016\016\016\016\016\016\
|
||||
\\016\016\016\016\016\016\016\016\016\016\016\016\016\016\016\016\
|
||||
\\016\016\016\016\016\016\016\016\016\016\016\016\016\016\016\016\
|
||||
\\016"
|
||||
),
|
||||
(17,
|
||||
"\016\016\016\016\016\016\016\016\016\016\000\016\016\000\016\016\
|
||||
\\016\016\016\016\016\016\016\016\016\016\016\016\016\016\016\016\
|
||||
\\016\016\016\016\016\000\016\016\016\016\018\016\016\016\016\016\
|
||||
\\016\016\016\016\016\016\016\016\016\016\016\016\016\016\016\016\
|
||||
\\016\016\016\016\016\016\016\016\016\016\016\016\016\016\016\016\
|
||||
\\016\016\016\016\016\016\016\016\016\016\016\016\016\016\016\016\
|
||||
\\016\016\016\016\016\016\016\016\016\016\016\016\016\016\016\016\
|
||||
\\016\016\016\016\016\016\016\016\016\016\016\016\016\016\016\016\
|
||||
\\016"
|
||||
),
|
||||
(19,
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(21,
|
||||
"\000\000\000\000\000\000\000\000\000\000\022\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(27,
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\028\000\000\000\000\000\000\029\000\
|
||||
\\028\028\028\028\028\028\028\028\028\028\000\000\000\000\000\000\
|
||||
\\000\028\028\028\028\028\028\028\028\028\028\028\028\028\028\028\
|
||||
\\028\028\028\028\028\028\028\028\028\028\028\000\000\000\000\028\
|
||||
\\000\028\028\028\028\028\028\028\028\028\028\028\028\028\028\028\
|
||||
\\028\028\028\028\028\028\028\028\028\028\028\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(30,
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\028\000\000\000\000\000\000\029\000\
|
||||
\\028\028\028\028\028\028\028\028\028\028\000\000\000\000\000\000\
|
||||
\\000\028\028\028\028\028\028\028\028\028\028\028\028\028\028\028\
|
||||
\\028\028\028\028\028\028\028\028\028\028\028\000\000\000\000\028\
|
||||
\\000\028\028\028\028\028\031\028\028\028\028\028\028\028\028\028\
|
||||
\\028\028\028\028\028\028\028\028\028\028\028\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(32,
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\028\000\000\000\000\000\000\029\000\
|
||||
\\028\028\028\028\028\028\028\028\028\028\000\000\000\000\000\000\
|
||||
\\000\028\028\028\028\028\028\028\028\028\028\028\028\028\028\028\
|
||||
\\028\028\028\028\028\028\028\028\028\028\028\000\000\000\000\028\
|
||||
\\000\028\028\028\028\028\028\028\028\028\028\028\028\028\028\033\
|
||||
\\028\028\028\028\028\028\028\028\028\028\028\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(33,
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\028\000\000\000\000\000\000\029\000\
|
||||
\\028\028\028\028\028\028\028\028\028\028\000\000\000\000\000\000\
|
||||
\\000\028\028\028\028\028\028\028\028\028\028\028\028\028\028\028\
|
||||
\\028\028\028\028\028\028\028\028\028\028\028\000\000\000\000\028\
|
||||
\\000\028\028\028\028\028\028\028\028\028\028\028\028\028\028\028\
|
||||
\\028\028\034\028\028\028\028\028\028\028\028\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(36,
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\037\037\037\037\037\037\037\037\037\037\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(38,
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\039\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(42,
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\043\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(44,
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\045\000\000\000\000\000\000\000\000\
|
||||
\\045\045\045\045\045\045\045\045\045\045\000\000\000\000\000\000\
|
||||
\\000\045\045\045\045\045\045\045\045\045\045\045\045\045\045\045\
|
||||
\\045\045\045\045\045\045\045\045\045\045\045\000\000\000\000\045\
|
||||
\\000\045\045\045\045\045\045\045\045\045\045\045\045\045\045\045\
|
||||
\\045\045\045\045\045\045\045\045\045\045\045\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(46,
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\065\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\047\
|
||||
\\000\047\047\047\047\047\047\047\047\047\047\047\061\047\053\047\
|
||||
\\047\047\048\047\047\047\047\047\047\047\047\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(47,
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\047\
|
||||
\\000\047\047\047\047\047\047\047\047\047\047\047\047\047\047\047\
|
||||
\\047\047\047\047\047\047\047\047\047\047\047\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(48,
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\047\
|
||||
\\000\047\047\047\047\047\047\047\047\049\047\047\047\047\047\047\
|
||||
\\047\047\047\047\047\047\047\047\047\047\047\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(49,
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\047\
|
||||
\\000\047\047\047\047\047\047\050\047\047\047\047\047\047\047\047\
|
||||
\\047\047\047\047\047\047\047\047\047\047\047\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(50,
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\047\
|
||||
\\000\047\047\047\047\047\047\047\051\047\047\047\047\047\047\047\
|
||||
\\047\047\047\047\047\047\047\047\047\047\047\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(51,
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\047\
|
||||
\\000\047\047\047\047\047\047\047\047\047\047\047\047\047\047\047\
|
||||
\\047\047\047\047\052\047\047\047\047\047\047\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(53,
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\047\
|
||||
\\000\047\047\047\047\047\047\047\047\047\047\047\047\047\047\054\
|
||||
\\047\047\047\047\047\047\047\047\047\047\047\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(54,
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\047\
|
||||
\\000\047\047\047\047\047\047\047\047\047\047\047\047\047\055\047\
|
||||
\\047\047\047\047\047\047\047\047\047\047\047\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(55,
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\047\
|
||||
\\000\056\047\047\047\047\047\047\047\047\047\047\047\047\047\047\
|
||||
\\047\047\047\047\047\047\047\047\047\047\047\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(56,
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\047\
|
||||
\\000\047\047\047\047\047\047\047\047\047\047\047\047\047\047\047\
|
||||
\\047\047\047\057\047\047\047\047\047\047\047\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(57,
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\047\
|
||||
\\000\047\047\047\047\047\047\047\047\047\047\047\047\047\047\047\
|
||||
\\047\047\047\058\047\047\047\047\047\047\047\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(58,
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\047\
|
||||
\\000\047\047\047\047\047\047\047\047\047\047\047\047\047\047\059\
|
||||
\\047\047\047\047\047\047\047\047\047\047\047\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(59,
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\047\
|
||||
\\000\047\047\060\047\047\047\047\047\047\047\047\047\047\047\047\
|
||||
\\047\047\047\047\047\047\047\047\047\047\047\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(61,
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\047\
|
||||
\\000\047\047\047\047\062\047\047\047\047\047\047\047\047\047\047\
|
||||
\\047\047\047\047\047\047\047\047\047\047\047\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(62,
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\047\
|
||||
\\000\047\047\047\047\047\063\047\047\047\047\047\047\047\047\047\
|
||||
\\047\047\047\047\047\047\047\047\047\047\047\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(63,
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\047\
|
||||
\\000\047\047\047\047\047\047\047\047\047\047\047\047\047\047\047\
|
||||
\\047\047\047\047\064\047\047\047\047\047\047\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(66,
|
||||
"\000\000\000\000\000\000\000\000\000\067\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\067\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(68,
|
||||
"\000\000\000\000\000\000\000\000\000\000\069\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(70,
|
||||
"\070\070\070\070\070\070\070\070\070\070\000\070\070\000\070\070\
|
||||
\\070\070\070\070\070\070\070\070\070\070\070\070\070\070\070\070\
|
||||
\\070\070\000\070\070\070\070\070\000\000\070\070\070\070\070\070\
|
||||
\\070\070\070\070\070\070\070\070\070\070\070\070\070\070\070\070\
|
||||
\\070\070\070\070\070\070\070\070\070\070\070\070\070\070\070\070\
|
||||
\\070\070\070\070\070\070\070\070\070\070\070\070\070\070\070\070\
|
||||
\\070\070\070\070\070\070\070\070\070\070\070\070\070\070\070\070\
|
||||
\\070\070\070\070\070\070\070\070\070\070\070\070\070\070\070\070\
|
||||
\\070"
|
||||
),
|
||||
(72,
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\073\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(78,
|
||||
"\000\000\000\000\000\000\000\000\000\079\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\079\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(81,
|
||||
"\081\081\081\081\081\081\081\081\081\081\000\081\081\000\081\081\
|
||||
\\081\081\081\081\081\081\081\081\081\081\081\081\081\081\081\081\
|
||||
\\081\081\081\081\081\081\081\081\000\000\000\081\081\081\081\081\
|
||||
\\081\081\081\081\081\081\081\081\081\081\081\081\081\081\081\081\
|
||||
\\081\081\081\081\081\081\081\081\081\081\081\081\081\081\081\081\
|
||||
\\081\081\081\081\081\081\081\081\081\081\081\081\081\081\081\081\
|
||||
\\081\081\081\081\081\081\081\081\081\081\081\081\081\081\081\081\
|
||||
\\081\081\081\081\081\081\081\081\081\081\081\081\081\081\081\081\
|
||||
\\081"
|
||||
),
|
||||
(82,
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\083\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(85,
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\086\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(87,
|
||||
"\087\087\087\087\087\087\087\087\087\087\000\087\087\000\087\087\
|
||||
\\087\087\087\087\087\087\087\087\087\087\087\087\087\087\087\087\
|
||||
\\087\087\000\087\087\087\087\087\087\087\087\087\087\087\087\087\
|
||||
\\087\087\087\087\087\087\087\087\087\087\087\087\087\087\087\087\
|
||||
\\087\087\087\087\087\087\087\087\087\087\087\087\087\087\087\087\
|
||||
\\087\087\087\087\087\087\087\087\087\087\087\087\000\087\087\087\
|
||||
\\087\087\087\087\087\087\087\087\087\087\087\087\087\087\087\087\
|
||||
\\087\087\087\087\087\087\087\087\087\087\087\087\087\087\087\087\
|
||||
\\087"
|
||||
),
|
||||
(88,
|
||||
"\000\000\000\000\000\000\000\000\000\090\092\000\000\091\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\090\000\089\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(91,
|
||||
"\000\000\000\000\000\000\000\000\000\000\092\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(94,
|
||||
"\000\000\000\000\000\000\000\000\000\000\095\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(96,
|
||||
"\096\096\096\096\096\096\096\096\096\096\000\096\096\000\096\096\
|
||||
\\096\096\096\096\096\096\096\096\096\096\096\096\096\096\096\096\
|
||||
\\096\096\096\096\096\096\096\096\000\000\000\096\096\096\096\096\
|
||||
\\096\096\096\096\096\096\096\096\096\096\096\096\096\096\096\096\
|
||||
\\096\096\096\096\096\096\096\096\096\096\096\096\096\096\096\096\
|
||||
\\096\096\096\096\096\096\096\096\096\096\096\096\096\096\096\096\
|
||||
\\096\096\096\096\096\096\096\096\096\096\096\096\096\096\096\096\
|
||||
\\096\096\096\096\096\096\096\096\096\096\096\096\096\096\096\096\
|
||||
\\096"
|
||||
),
|
||||
(97,
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\098\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(100,
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\101\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
|
||||
\\000"
|
||||
),
|
||||
(0, "")]
|
||||
fun f x = x
|
||||
val s = map f (rev (tl (rev s)))
|
||||
exception LexHackingError
|
||||
fun look ((j,x)::r, i) = if i = j then x else look(r, i)
|
||||
| look ([], i) = raise LexHackingError
|
||||
fun g {fin=x, trans=i} = {fin=x, trans=look(s,i)}
|
||||
in Vector.fromList(map g
|
||||
[{fin = [], trans = 0},
|
||||
{fin = [], trans = 1},
|
||||
{fin = [], trans = 1},
|
||||
{fin = [], trans = 3},
|
||||
{fin = [], trans = 3},
|
||||
{fin = [], trans = 5},
|
||||
{fin = [], trans = 5},
|
||||
{fin = [], trans = 7},
|
||||
{fin = [], trans = 7},
|
||||
{fin = [], trans = 9},
|
||||
{fin = [], trans = 9},
|
||||
{fin = [], trans = 11},
|
||||
{fin = [], trans = 11},
|
||||
{fin = [], trans = 13},
|
||||
{fin = [], trans = 13},
|
||||
{fin = [(N 11),(N 21)], trans = 15},
|
||||
{fin = [(N 11)], trans = 15},
|
||||
{fin = [(N 11),(N 21)], trans = 17},
|
||||
{fin = [(N 2),(N 11)], trans = 15},
|
||||
{fin = [(N 21)], trans = 19},
|
||||
{fin = [(N 14)], trans = 0},
|
||||
{fin = [(N 19),(N 21)], trans = 21},
|
||||
{fin = [(N 19)], trans = 0},
|
||||
{fin = [(N 100)], trans = 0},
|
||||
{fin = [(N 42),(N 100)], trans = 0},
|
||||
{fin = [(N 93),(N 100)], trans = 0},
|
||||
{fin = [(N 40),(N 100)], trans = 0},
|
||||
{fin = [(N 96),(N 100)], trans = 27},
|
||||
{fin = [(N 96)], trans = 27},
|
||||
{fin = [(N 83)], trans = 0},
|
||||
{fin = [(N 96),(N 100)], trans = 30},
|
||||
{fin = [(N 34),(N 96)], trans = 27},
|
||||
{fin = [(N 96),(N 100)], trans = 32},
|
||||
{fin = [(N 96)], trans = 33},
|
||||
{fin = [(N 38),(N 96)], trans = 27},
|
||||
{fin = [(N 91),(N 100)], trans = 0},
|
||||
{fin = [(N 86),(N 100)], trans = 36},
|
||||
{fin = [(N 86)], trans = 36},
|
||||
{fin = [(N 100)], trans = 38},
|
||||
{fin = [(N 49)], trans = 0},
|
||||
{fin = [(N 44),(N 100)], trans = 0},
|
||||
{fin = [(N 46),(N 100)], trans = 0},
|
||||
{fin = [(N 98),(N 100)], trans = 42},
|
||||
{fin = [(N 5)], trans = 0},
|
||||
{fin = [(N 79),(N 100)], trans = 44},
|
||||
{fin = [(N 79)], trans = 44},
|
||||
{fin = [(N 100)], trans = 46},
|
||||
{fin = [(N 76)], trans = 47},
|
||||
{fin = [(N 76)], trans = 48},
|
||||
{fin = [(N 76)], trans = 49},
|
||||
{fin = [(N 76)], trans = 50},
|
||||
{fin = [(N 76)], trans = 51},
|
||||
{fin = [(N 62),(N 76)], trans = 47},
|
||||
{fin = [(N 76)], trans = 53},
|
||||
{fin = [(N 76)], trans = 54},
|
||||
{fin = [(N 76)], trans = 55},
|
||||
{fin = [(N 76)], trans = 56},
|
||||
{fin = [(N 76)], trans = 57},
|
||||
{fin = [(N 76)], trans = 58},
|
||||
{fin = [(N 76)], trans = 59},
|
||||
{fin = [(N 72),(N 76)], trans = 47},
|
||||
{fin = [(N 76)], trans = 61},
|
||||
{fin = [(N 76)], trans = 62},
|
||||
{fin = [(N 76)], trans = 63},
|
||||
{fin = [(N 55),(N 76)], trans = 47},
|
||||
{fin = [(N 89)], trans = 0},
|
||||
{fin = [(N 31),(N 100)], trans = 66},
|
||||
{fin = [(N 31)], trans = 66},
|
||||
{fin = [(N 26),(N 100)], trans = 68},
|
||||
{fin = [(N 26)], trans = 0},
|
||||
{fin = [(N 109)], trans = 70},
|
||||
{fin = [(N 104)], trans = 0},
|
||||
{fin = [(N 102)], trans = 72},
|
||||
{fin = [(N 8)], trans = 0},
|
||||
{fin = [(N 106)], trans = 0},
|
||||
{fin = [(N 19)], trans = 21},
|
||||
{fin = [(N 162)], trans = 0},
|
||||
{fin = [(N 160),(N 162)], trans = 0},
|
||||
{fin = [(N 158),(N 162)], trans = 78},
|
||||
{fin = [(N 158)], trans = 78},
|
||||
{fin = [(N 19),(N 162)], trans = 21},
|
||||
{fin = [(N 120)], trans = 81},
|
||||
{fin = [(N 111)], trans = 82},
|
||||
{fin = [(N 114)], trans = 0},
|
||||
{fin = [(N 111)], trans = 0},
|
||||
{fin = [(N 111)], trans = 85},
|
||||
{fin = [(N 117)], trans = 0},
|
||||
{fin = [(N 143)], trans = 87},
|
||||
{fin = [(N 135)], trans = 88},
|
||||
{fin = [(N 146)], trans = 0},
|
||||
{fin = [(N 155)], trans = 0},
|
||||
{fin = [(N 152)], trans = 91},
|
||||
{fin = [(N 152)], trans = 0},
|
||||
{fin = [(N 133)], trans = 0},
|
||||
{fin = [(N 140)], trans = 94},
|
||||
{fin = [(N 140)], trans = 0},
|
||||
{fin = [(N 131)], trans = 96},
|
||||
{fin = [(N 122)], trans = 97},
|
||||
{fin = [(N 125)], trans = 0},
|
||||
{fin = [(N 122)], trans = 0},
|
||||
{fin = [(N 122)], trans = 100},
|
||||
{fin = [(N 128)], trans = 0}])
|
||||
end
|
||||
structure StartStates =
|
||||
struct
|
||||
datatype yystartstate = STARTSTATE of int
|
||||
|
||||
(* start state definitions *)
|
||||
|
||||
val A = STARTSTATE 3;
|
||||
val CODE = STARTSTATE 5;
|
||||
val COMMENT = STARTSTATE 9;
|
||||
val EMPTYCOMMENT = STARTSTATE 13;
|
||||
val F = STARTSTATE 7;
|
||||
val INITIAL = STARTSTATE 1;
|
||||
val STRING = STARTSTATE 11;
|
||||
|
||||
end
|
||||
type result = UserDeclarations.lexresult
|
||||
exception LexerError (* raised if illegal leaf action tried *)
|
||||
end
|
||||
|
||||
type int = Int.int
|
||||
fun makeLexer (yyinput: int -> string) =
|
||||
let val yygone0:int= ~1
|
||||
val yyb = ref "\n" (* buffer *)
|
||||
val yybl: int ref = ref 1 (*buffer length *)
|
||||
val yybufpos: int ref = ref 1 (* location of next character to use *)
|
||||
val yygone: int ref = ref yygone0 (* position in file of beginning of buffer *)
|
||||
val yydone = ref false (* eof found yet? *)
|
||||
val yybegin: int ref = ref 1 (*Current 'start state' for lexer *)
|
||||
|
||||
val YYBEGIN = fn (Internal.StartStates.STARTSTATE x) =>
|
||||
yybegin := x
|
||||
|
||||
fun lex (yyarg as (inputSource)) =
|
||||
let fun continue() : Internal.result =
|
||||
let fun scan (s,AcceptingLeaves : Internal.yyfinstate list list,l,i0: int) =
|
||||
let fun action (i: int,nil) = raise LexError
|
||||
| action (i,nil::l) = action (i-1,l)
|
||||
| action (i,(node::acts)::l) =
|
||||
case node of
|
||||
Internal.N yyk =>
|
||||
(let fun yymktext() = String.substring(!yyb,i0,i-i0)
|
||||
val yypos: int = i0+ !yygone
|
||||
open UserDeclarations Internal.StartStates
|
||||
in (yybufpos := i; case yyk of
|
||||
|
||||
(* Application actions *)
|
||||
|
||||
100 => let val yytext=yymktext() in UNKNOWN(yytext,!lineno,!lineno) end
|
||||
| 102 => let val yytext=yymktext() in inc pcount; Add yytext; continue() end
|
||||
| 104 => let val yytext=yymktext() in dec pcount;
|
||||
if !pcount = 0 then
|
||||
PROG (concat (rev (!text)),!lineno,!lineno)
|
||||
else (Add yytext; continue()) end
|
||||
| 106 => let val yytext=yymktext() in Add yytext; YYBEGIN STRING; continue() end
|
||||
| 109 => let val yytext=yymktext() in Add yytext; continue() end
|
||||
| 11 => let val yytext=yymktext() in Add yytext; continue() end
|
||||
| 111 => let val yytext=yymktext() in Add yytext; continue() end
|
||||
| 114 => let val yytext=yymktext() in Add yytext; dec commentLevel;
|
||||
if !commentLevel=0
|
||||
then BOGUS_VALUE(!lineno,!lineno)
|
||||
else continue()
|
||||
end
|
||||
| 117 => let val yytext=yymktext() in Add yytext; inc commentLevel; continue() end
|
||||
| 120 => let val yytext=yymktext() in Add yytext; continue() end
|
||||
| 122 => (continue())
|
||||
| 125 => (dec commentLevel;
|
||||
if !commentLevel=0 then YYBEGIN A else ();
|
||||
continue ())
|
||||
| 128 => (inc commentLevel; continue())
|
||||
| 131 => (continue())
|
||||
| 133 => let val yytext=yymktext() in Add yytext; YYBEGIN CODE; continue() end
|
||||
| 135 => let val yytext=yymktext() in Add yytext; continue() end
|
||||
| 14 => (YYBEGIN A; HEADER (concat (rev (!text)),!lineno,!lineno))
|
||||
| 140 => let val yytext=yymktext() in Add yytext; error inputSource (!lineno) "unclosed string";
|
||||
inc lineno; YYBEGIN CODE; continue() end
|
||||
| 143 => let val yytext=yymktext() in Add yytext; continue() end
|
||||
| 146 => let val yytext=yymktext() in Add yytext; continue() end
|
||||
| 152 => let val yytext=yymktext() in Add yytext; inc lineno; YYBEGIN F; continue() end
|
||||
| 155 => let val yytext=yymktext() in Add yytext; YYBEGIN F; continue() end
|
||||
| 158 => let val yytext=yymktext() in Add yytext; continue() end
|
||||
| 160 => let val yytext=yymktext() in Add yytext; YYBEGIN STRING; continue() end
|
||||
| 162 => let val yytext=yymktext() in Add yytext; error inputSource (!lineno) "unclosed string";
|
||||
YYBEGIN CODE; continue() end
|
||||
| 19 => let val yytext=yymktext() in Add yytext; inc lineno; continue() end
|
||||
| 2 => let val yytext=yymktext() in Add yytext; YYBEGIN COMMENT; commentLevel := 1;
|
||||
continue() before YYBEGIN INITIAL end
|
||||
| 21 => let val yytext=yymktext() in Add yytext; continue() end
|
||||
| 26 => (inc lineno; continue ())
|
||||
| 31 => (continue())
|
||||
| 34 => (OF(!lineno,!lineno))
|
||||
| 38 => (FOR(!lineno,!lineno))
|
||||
| 40 => (LBRACE(!lineno,!lineno))
|
||||
| 42 => (RBRACE(!lineno,!lineno))
|
||||
| 44 => (COMMA(!lineno,!lineno))
|
||||
| 46 => (ASTERISK(!lineno,!lineno))
|
||||
| 49 => (ARROW(!lineno,!lineno))
|
||||
| 5 => (YYBEGIN EMPTYCOMMENT; commentLevel := 1; continue())
|
||||
| 55 => (PREC(Hdr.LEFT,!lineno,!lineno))
|
||||
| 62 => (PREC(Hdr.RIGHT,!lineno,!lineno))
|
||||
| 72 => (PREC(Hdr.NONASSOC,!lineno,!lineno))
|
||||
| 76 => let val yytext=yymktext() in lookup(yytext,!lineno,!lineno) end
|
||||
| 79 => let val yytext=yymktext() in TYVAR(yytext,!lineno,!lineno) end
|
||||
| 8 => let val yytext=yymktext() in Add yytext; YYBEGIN COMMENT; commentLevel := 1;
|
||||
continue() before YYBEGIN CODE end
|
||||
| 83 => let val yytext=yymktext() in IDDOT(yytext,!lineno,!lineno) end
|
||||
| 86 => let val yytext=yymktext() in INT (yytext,!lineno,!lineno) end
|
||||
| 89 => (DELIMITER(!lineno,!lineno))
|
||||
| 91 => (COLON(!lineno,!lineno))
|
||||
| 93 => (BAR(!lineno,!lineno))
|
||||
| 96 => let val yytext=yymktext() in ID ((yytext,!lineno),!lineno,!lineno) end
|
||||
| 98 => (pcount := 1; actionstart := (!lineno);
|
||||
text := nil; YYBEGIN CODE; continue() before YYBEGIN A)
|
||||
| _ => raise Internal.LexerError
|
||||
|
||||
) end )
|
||||
|
||||
val {fin,trans} = Vector.sub (Internal.tab, s)
|
||||
val NewAcceptingLeaves = fin::AcceptingLeaves
|
||||
in if l = !yybl then
|
||||
if trans = #trans(Vector.sub(Internal.tab,0))
|
||||
then action(l,NewAcceptingLeaves
|
||||
) else let val newchars= if !yydone then "" else yyinput 1024
|
||||
in if (String.size newchars)=0
|
||||
then (yydone := true;
|
||||
if (l=i0) then UserDeclarations.eof yyarg
|
||||
else action(l,NewAcceptingLeaves))
|
||||
else (if i0=l then yyb := newchars
|
||||
else yyb := String.substring(!yyb,i0,l-i0)^newchars;
|
||||
yygone := !yygone+i0;
|
||||
yybl := String.size (!yyb);
|
||||
scan (s,AcceptingLeaves,l-i0,0))
|
||||
end
|
||||
else let val NewChar = Char.ord (CharVector.sub (!yyb,l))
|
||||
val NewChar = if NewChar<128 then NewChar else 128
|
||||
val NewState = Char.ord (CharVector.sub (trans,NewChar))
|
||||
in if NewState=0 then action(l,NewAcceptingLeaves)
|
||||
else scan(NewState,NewAcceptingLeaves,l+1,i0)
|
||||
end
|
||||
end
|
||||
(*
|
||||
val start= if String.substring(!yyb,!yybufpos-1,1)="\n"
|
||||
then !yybegin+1 else !yybegin
|
||||
*)
|
||||
in scan(!yybegin (* start *),nil,!yybufpos,!yybufpos)
|
||||
end
|
||||
in continue end
|
||||
in lex
|
||||
end
|
||||
end
|
@ -116,6 +116,12 @@ lib/mlton/self/libgdtoa.a
|
||||
lib/mlton/self/libmlton-gdb.a
|
||||
lib/mlton/self/libmlton.a
|
||||
lib/mlton/self/sizes
|
||||
%%MINGW32CROSS%%lib/mlton/mingw32/constants
|
||||
%%MINGW32CROSS%%lib/mlton/mingw32/include/c-types.h
|
||||
%%MINGW32CROSS%%lib/mlton/mingw32/libgdtoa.a
|
||||
%%MINGW32CROSS%%lib/mlton/mingw32/libmlton-gdb.a
|
||||
%%MINGW32CROSS%%lib/mlton/mingw32/libmlton.a
|
||||
%%MINGW32CROSS%%lib/mlton/mingw32/sizes
|
||||
lib/mlton/sml/basis/Makefile
|
||||
lib/mlton/sml/basis/README
|
||||
lib/mlton/sml/basis/arrays-and-vectors/array-slice.sig
|
||||
@ -162,6 +168,7 @@ lib/mlton/sml/basis/config/c/sys-types.sml
|
||||
lib/mlton/sml/basis/config/c/sys-word.sml
|
||||
lib/mlton/sml/basis/config/c/word-to-bool.sml
|
||||
lib/mlton/sml/basis/config/c/x86-freebsd/c-types.sml
|
||||
%%MINGW32CROSS%%lib/mlton/sml/basis/config/c/x86-mingw/c-types.sml
|
||||
lib/mlton/sml/basis/config/choose-char.sml
|
||||
lib/mlton/sml/basis/config/choose-int.sml
|
||||
lib/mlton/sml/basis/config/choose-real.sml
|
||||
@ -3102,6 +3109,7 @@ lib/mlton/world.mlton
|
||||
@dirrm lib/mlton/sml/basis/config/header
|
||||
@dirrm lib/mlton/sml/basis/config/default
|
||||
@dirrm lib/mlton/sml/basis/config/c/x86-freebsd
|
||||
%%MINGW32CROSS%%@dirrm lib/mlton/sml/basis/config/c/x86-mingw
|
||||
@dirrm lib/mlton/sml/basis/config/c
|
||||
@dirrm lib/mlton/sml/basis/config/bind
|
||||
@dirrm lib/mlton/sml/basis/config
|
||||
@ -3111,6 +3119,8 @@ lib/mlton/world.mlton
|
||||
@dirrm lib/mlton/sml
|
||||
@dirrm lib/mlton/self/include
|
||||
@dirrm lib/mlton/self
|
||||
%%MINGW32CROSS%%@dirrm lib/mlton/mingw32/include
|
||||
%%MINGW32CROSS%%@dirrm lib/mlton/mingw32
|
||||
@dirrm lib/mlton/include/util
|
||||
@dirrm lib/mlton/include/platform
|
||||
@dirrm lib/mlton/include/gc
|
||||
|
Loading…
Reference in New Issue
Block a user