-
21
pages
-
English
-
Documents
Description
Standard ML Mini tutorial(in particular SML/NJ)Programming Languages CS442David TomanSchool of Computer ScienceUniversity of WaterlooDavid Toman (University of Waterloo) Standard ML 1 / 21Introduction• SML (Standard Meta Language)⇒ originally part of the LCF project (Gordon et al.)• Industrial strength PL (SML’90, SML’97)⇒ based formal semantics (Milner et al.)• SML “Basis Library” (all you ever wanted)⇒ based on advanced module system• Quality compilers:⇒ SML/NJ (Bell Labs)⇒ Moscow MLDavid Toman (University of Waterloo) Standard ML 2 / 21Features• Everything is built from expressions⇒ functions are first class citizens⇒ pretty much extension of our simple functional PL• Support for structured values: lists, trees, . . .• Strong type system⇒ let polymorphicfunctions⇒ type inference• Powerful module system⇒ signatures, implementations, ADTs,. . .• Imperative features (e.g., I/O)David Toman (University of Waterloo) Standard ML 3 / 21Tutorial Goals1 Make link from our functional language to SML2 Provide enough SML syntax and examples for A2• How to use SML/NJ interactive environment• How to write simple functional programs• How to define new data types• How to understand compiler errors• Where to find more information3 Show type inference in action (so we understand what’s coming)David Toman (University of Waterloo) Standard ML 4 / 21Getting started• Starting it up: sml in UNIX (click somewhere in W/XP)ExampleStandard ML of New Jersey ...
-
Publié par
-
Langue
English