parser.tar.gz
$ gzip -cd parser.tar.gz | tar xvf - $ cd parser
parser.yy
parser.yy
to verify
your PS2.
Makefile.am
bin_PROGRAMS = parser parser_SOURCES = parser.yy scanner.ll AM_YFLAGS = -d
autoscan
to create configure.scan
configure.scan
to configure.in
configure.in
, fill in AC_INIT
,
added AM_INIT_AUTOMAKE
after AC_INIT
, and
add AM_PROG_LEX
and AC_PROG_YACC
after
AC_PROG_CC
.
autoheader
to create config.h.in
aclocal
to create aclocal.m4
$ touch NEWS README AUTHORS ChangeLog
AUTHORS
WeeSan Lee <weesan@cs.ucr.edu>
automake -a
autoconf
configure
make
make dist
, which will
generate parser-0.0.1.tar.gz
in this case.
/usr/csshare/bin/sml
/usr/csshare/bin
to your path and run
sml
lab2.sml
sml
use "lab2.sml"
$ mkdir -p ~/share/emacs
$ cd ~/share/emacs
$ gzip -cd ~/sml-mode-4.0.tar.gz | tar xvf -
; load sml-mode setup code (load "~/share/emacs/sml-mode-4.0/sml-mode-startup") (add-hook 'sml-mode-hook 'turn-on-font-lock)
$ emacs lab2.sml
max
of type int list -> int that
returns the largest element of a list of integers. Your function
need not behave well if the list is empty. Hint: Write a
helper function maxhelper
that takes as a second
parameter the largest element seen so far. Then you can complete
the exercise by defining fun max x = maxhelper(tl x, hd
x);
isMember(x, l)
would return true if
x
is an element in the list l
, and false
otherwise.
union(x, y)
where both x
and
y
are lists, and union(x, y)
would return
a list of unique elements, each of which belongs to either list
x
or y
.
intersect(x, y)
where both x
and
y
are lists, and intersect(x, y)
would
return a list of unique elements, each of which belongs to both list
x
and y
.