����; � TeX output 1992.09.17:0837� �����l ���� �' �������� �U��9D��t G� G� cmr17�Standard�7tML�Reference�Man��qual�� �� �}�(PRELIMINAR���VY)��, � �� �<��+X�Q cmr12�Septem��rb�S�er��17,�1992����� *�l ���� �' ����UU�� ����"V
cmbx10�Abstract�� ��R �K�`y
cmr10�This�:man���ual�is�a�ma� �8jor�revision�b�y�Andrew�W.�App�Gel�and�Da�vid�B.�MacQueen�� ��R of���the��� ':
cmti10�Standar��}'d��PML����reference�man���ual�(ECS-LF�CS-86-2).���That�do�Gcumen�t�is����R divided�&in���to�three�parts:��hthe�Core�language�description�b�y�Robin�Milner,�,the����R standard��8I/O��library�b���y�Rob�Gert�W.�Harp�er,��rand�the�Mo�dule�system�b���y�Da�vid�B.����R MacQueen.�RThis��Tnew�man���ual�re
ects�a�sligh�tly�ev�olv�ed�language,� Tand�describ�Ges����R the��/library�functions�(initial�en���vironmen�t)��/built�in���to�the�Standard�ML��of�New����R Jersey� zsystem,�rdev���elop�Ged�at�A��*�T&T� dBell�Lab�oratories�and�Princeton�Univ���ersit�y��*�.����a A���t���presen�t�the�man�ual�is�in�a�v�ery�rough�form,���and�should�b�Ge�considered�a����R preliminary��tdraft.�D�This�v���ersion�is�distributed�primarily�as�do�Gcumen�tation�of�the����R mid-1989�UUdistribution�of�the��Standar��}'d���ML�of�New�Jersey�UU�compiler.����� �l ���� �' ���G ��, �H�"V �p
cmbx10�HChapter��F1��2 ��, �I�"V �G
cmbx10�IIn��4�tro� �vduction��4 ��, �This�x�is�a�preliminary�draft�of�a�reference�man���ual�for�Standard�ML�x�of�New�Jersey��*�,�� ��, an�*�implemen���tation�of�the�Standard�ML�*�language.�c�Our�implemen�tation�adheres����, closely��to�the�Standard�ML���language�denition�����^��ٓ�R cmr7�1���
�{�except�that�the�library�of����, built-in�UUfunctions�is�larger�and�b�Getter�organized.����; The�)�do�Gcumen���t�at�presen�t�has�man�y�gaps.�c2It�should�b�Ge�treated�as�a�guide�to����, the�UU1989�pre-release,�rather�than�as�a�complete�reference�man���ual.��, � ��É ff ��v� J=����"5��-:��Aa� cmr6�1���L��
|{Y cmr8�see�}�#�f� cmti8�The�_ADenition�of�Standar���d�ML,�version�3�,�;b�Îy�Rob�<rert�Harp�er,�;Robin�Milner,�and�Mads�� � �T��J�ofte,��$tec�Îhnical�k�rep�<rort�ECS-LF�CS-89-81,��$Dept.���of�Computer�Science,�Univ.���of�Edin�Îburgh,���Edin�Îburgh��XEH9�3JZ�Scotland.��� �� � �1���� ��l ���� �' ���I؍�R �HChapter��F2��4؍�R �ILexical� ��analysis��<؍��R �7�"V ff
cmbx10�2.1��w�@Reserv��=ed��w�ords���͍�R �The�kfollo���wing�are�reserv�ed�w�ords.��DThey�ma�y�not�b�Ge�used�as�iden�tiers.��DIn�this�� ��R do�Gcumen���t�UUthe�alphab�etic�reserv���ed�w�ords�are�alw�a�ys�sho�wn�in�b�Goldface.��S���k ���<x
cmtt10�abstraction�?�abstype�and�andalso�as�case�datatype�else����k end�?�exception�do�fn�fun�functor�handle�if�in�infix����k infixr�?�let�local�nonfix�of�op�open�overload�raise�rec����k sharing�?�sig�signature�struct�structure�then�type�val����k while�?�with�withtype�orelse��7���k {�
�}�[�]�,�;�(�)�->�*�|�:�...�=�=>�#�_��,AR �2.2��w�@Sp�u�ecial��constan��=ts����R �An�� in���teger�constan�t�is�an�y�non-empt�y�sequence�of�digits,��+p�Gossibly�preceded�b�y����R a�UUnegation�sym���b�Gol�(�~�).��؍�a A���real��constan���t�is�an�in�teger�constan�t,��rp�Gossibly�follo�w�ed�b�y�a�p�Goin�t�(.)���and����R one�K�or�more�digits,�M�p�Gossibly�follo���w�ed�K�b�y�an�exp�Gonen�t�sym�b�Gol(E)�K�and�an�in�teger����R constan���t;��Fat�i�least�one�of�the�optional�parts�m�ust�o�Gccur,���hence�no�in�teger�constan�t����R is�� a�real�constan���t.�9�Examples:��/�0.7��,����~3.32E5��,��3E~7��.�9�Non-examples:��/�23��,��.3��,����R �4.E5�UU�,��1E2.0��.����a A��)string��<constan���t�is�a�sequence,��vb�Get�w�een�quotes�(�"�),��vof�zero�or�more�prin�t-����R able��;c���haracters,��uspaces,�or�escap�Ge�sequences.�zEac���h�escap�e�sequence�is�in���tro-����R duced���b���y�the�escap�Ge�c�haracter��\�,��and�stands�for�a�c�haracter�sequence.�;�The����R allo���w�ed�yyescap�Ge�sequences�are�as�follo���ws�(all�other�uses�of��\��b�eing�incorrect):��� �� � 2���� ؠl ���� �' ���6� ������d���2 �\n�����b���A�UUsingle�c���haracter�in�terpreted�b�y�the�system�as�end-of-line.����� ���2 �\t�����b���T��*�ab.��������2 �\^c�����b���The�UUcon���trol�c�haracter�c,�for�an�y�appropriate�c.��������2 �\ddd�����b���The�UUsingle�c���haracter�with�ASCI�GI�co�de�ddd�(3�decimal�digits).��������2 �\"�����b���The�UUdouble-quote�c���haracter�(�"�).��������2 �\\�����b���The�UUbac���kslash�c�haracter�(�\�).��������2 �\f___f\�����b���This���sequence�is�ignored,�=wwhere�f�� ��� ff ���32� ff ����̉ ff ��
��f�stands�for�a�sequence�of����b��one�1�or�more�formatting�c���haracters�(a�subset�of�the�non-prin�table����b��c���haracters��including�at�least�space,��tab,�newline,�formfeed).�W�This����b��allo���ws���one�to�write�long�strings�on�more�than�one�line,��!b�y�writing����b���\�UU�at�the�end�of�one�line�and�at�the�start�of�the�next.��������Y�����, �2.3��Q�@Iden��=tiers�����, �An�=iden���tier�is�either��alphanumeric�:�e�an�y�sequence�of�letters,�A�digits,�primes�=(�'�),�� ��, and��punderbars�(�_�)�starting�with�a�letter�or�a�prime,���or��symb��}'olic�:���an���y�sequence����, of�UUthe�follo���wing�sym�b�Gols���Ѝ�E �!�?�%�&�$�+�-�/�:�<�=�>�?�@�\�~�\^�|�#�*�`���э�, �In��Neither�case,�fho���w�ev�er,�reserv�ed��Nw�ords�are�excluded.� f�This�means�that�for����, example�UU�_��and��|��are�not�iden���tiers,�but��also_ran��and��|=|��are�iden�tiers.����; Iden���tiers�are�used�to�stand�for�9�dieren�t�classes�of�ob� �8jects,���whic�h�o�Gccup�y����, 6�UUdieren���t�name�spaces,�as�follo�ws:�������88�1.����E v��q�alue�UUv�ariables�(�var�),�v�alue�constructors�(�c��}'on�),����E exception�UUconstructors�(�exnc��}'on�)���h�����88�2.����E t���yp�Ge�UUv��q�ariables�(�tyvar�)�������88�3.����E t���yp�Ge�UUconstructors�(�tyc��}'on�)�������88�4.����E record�UUlab�Gels�(�lab�)�������88�5.����E structures�UU(�str�),�functors�(�fct�)�������88�6.����E signatures�UU(�sgn�)���э�, Th���us,�m�an�h�iden�tier�could�not�in�the�same�scop�Ge�stand�for�b�oth�a�v��q�alue�v�ariable�� ��, and��a�constructor,��but�an�iden���tier�can�b�Ge�b�ound�sim���ultaneously�to�a�t�yp�Ge����, constructor�UUand�a�signature.����; T��*�o��jremo���v�e�some�am�biguit�y��*�,���it�is�recommended�that�constructors�start�with����, an�DBupp�Gercase�letter,��and�v��q�ariables�start�with�a�lo���w�ercase�DBletter;���but�this�is�a����, con���v�en�tion,��Pnot�UQan�enforced�rule�(it�is�confounded,�for�example,�b���y�sym�b�Golic����, iden���tiers).����; A���t���yp�Ge���v��q�ariable�(�tyvar�)�ma�y�b�Ge�an�y�alphan�umeric�iden�tier�starting�with�a����, prime.��The�S�other�eigh���t�classes�(�var,��Ec��}'on,�tyc�on,�...�)��are�S�represen���ted�b�y�iden�tiers��� �� � 3���� �l ���� �' ���� ��R �not��cstarting�with�a�prime.�OwThe�class�lab�is�also�extended�to�include�the�n���umeric�� ��R lab�Gels�UU1,�2,�3,�...�q�.����a T���yp�Ge�x�v��q�ariables�are�therefore�disjoin�t�from�the�other�classes.���Otherwise,���the����R class�UUof�an�o�Gccurrence�of�an�iden���tier�is�determined�from�con�text.����a Spaces�
kor�paren���theses�are�sometimes�needed�to�separate�sym�b�Golic�iden�tiers����R and�UUreserv���ed�w�ords.�q�Tw�o�examples�are��qǍ�����d���t��a:=�?�!b��� ����or��� �ʄ�a:=(!b)����g�but�UUnot���F���a:=!b������g ~�?�:int->int��� ����or��� ����(~):int->int����g�but�UUnot���9q��~:int->int��������a �These���punctuation�c���haracters�cannot�b�Ge�constituen�ts�of�iden�tiers�and�there-����R fore�UUnev���er�need�spaces�around�them:�� ��?��"�?�(�)�,�.�;�[�]�{�}��!č��R �2.4��w�@Commen��=ts�����R �A�Bcommen���t�Bais�a�c�haracter�sequence�(outside�of�a�string)�within�commen�t�brac�k�ets����R (*�UU*)�in�whic���h�commen�t�brac�k�ets�are�prop�Gerly�nested.�����R �2.5��w�@The��bare�syn��=tax�����R �The��^Standard�ML��9bare�language�is�obtained�b���y�stripping�the�full�language�of����R an���y�[�derive��}'d��forms�(those�that�ma�y�b�Ge�dened�in�terms�of�other�constructs�in����R the�֒language),���and�of�an���y�constructs�related�to�the�mo�Gdule�system.��}The�bare����R language���will�b�Ge�explained�in�Chapters�3�and�4,��and�successiv���e�c�hapters�describ�Ge����R augmen���tations�UUof�it�that�yield�the�full�language.����a Figure�UU2.5�sho���ws�the�syn�tax�of�the�bare�language.�q�The�notation�� ��z phrase�UUx������k������ fe |u��'�x�phrase����R indicates��the�rep�Getition�of�the��phr��}'ase��at�least���b>