Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Languages and Compilers (SProg og Oversættere) Bent Thomsen Department of Computer Science Aalborg University.

Similar presentations


Presentation on theme: "1 Languages and Compilers (SProg og Oversættere) Bent Thomsen Department of Computer Science Aalborg University."— Presentation transcript:

1 1 Languages and Compilers (SProg og Oversættere) Bent Thomsen Department of Computer Science Aalborg University

2 2 What is Microsoft.NET?.NET is Microsoft’s vision of a world connected using open standards.NET is the name given to the latest Microsoft technology, products and development framework.NET is the basis for Microsoft’s current and future roadmap ‘.NET is Microsoft’s platform for a new computing model built around XML Web Services’ Microsoft Corporation Annual Report, 2001.Net is Microsoft’s core business Strategy

3 3 What does.NET encompass? Clients –Software for PC and mobile devices e.g. Windows XP, WinCE –New devices such as Stinger phone and Xbox Services –Microsoft’s software for creating and consuming web services –New user services such as Passport, Alert and Instant Messenger –(Microsoft branded web services for use by consumers a.k.a. Hailstorm a.k.a. MyServices) Servers –Current product range such as Windows 2000, Commerce Server 2000, BizTalk Server 2000 and Content Management Server 2001 –much of this will be merged into.Net Server2003 Tools –A new development framework for solution developers Common Language Runtime and Class Libraries Visual Studio.Net

4 4 Microsoft’s picture that explains.NET

5 5 What is a “Web Service”? A Web service is like a Web site without a user interface, that serves programs instead of people. Instead of getting requests from browsers and returning web pages in response, a web service: –receives a request formatted in XML from an application, –performs a task, –and returns an XML-formatted response. Web Services are delivered using open industry standards –Services to be described in WSDL –Services to located via UDDI –Data to be exchanged via XML –Protocols are HTTP and SOAP –Back-end systems developed in “traditional” programming languages, such as C++, VB, C#,…

6 6 Company A Consumers, Partners MobileEmployees Company B Customers Partners Suppliers Consumers, Partners MobileEmployees The ultimate application The Virtual Enterprise

7 7 Such applications are hard to develop Developers need to master –Web programming (and mobile – WAP, iMode,..) –Client/server –Database integration –Legacy system integration All with different and incoherent programming models

8 8 Common Programming Model -.NET

9 9 Execution model COBOL VB.NET MC++ C# MSIL code (plus metadata ) Loader/verifier Managed code Uncompiled method call Execution Language compilers.NET languages JIT compiler

10 10 Compiling and Executing Managed Code Source Code Language Compiler Microsoft Intermediate Language (MSIL) Compilation JIT Compiler Native Code The first time each method is called Execution

11 11 What is in CLR? In.Net Programming Languages share a common higher-level infrastructure, the Common Language Runtime (CLR): –High level code is compiled to MIL (Microsoft Intermediate Language) –MIL is compiled to machine code using JIT –CLR has shared heap, which means no tricky cross-heap pointers (cf reference counting in COM) –CLR has a shared type system which means no marshalling (cf string char* marshalling for Java C) –CLR has a shared exception model which supports cross-language exception handling –CLR checks and enforces security restrictions on running code –CLR handles loading and version control –Libraries are organised into assemblies

12 12 Programming for.Net Common Language Runtime + class libraries ADO.NET ASP.NET Web services – XML, SOAP, UDDI, WSDL … Programming languages –C++, VB, C#, (J#) –APL, COBOL, Eiffel, Forth, Fortran, Haskel, SML, Mercury, Mondrian, Oberon, Pascal, Perl, Python, RPG, Scheme, SmallScript, … Visual Studio.Net –Professional –Server Edition –Mobile Internet Toolkit –Academic

13 13 Advanced Programming Language Research on.Net and the CLR.NET and the CLR provide a great opportunity for programming language designers and implementers: –The runtime provides services (execution engine, garbage collection,…) which make producing a good implementation of new languages easier –The frameworks & libraries mean you can actually do useful things with your new language (graphics, networking, database access, web services,…) –Multi-language component-based programming makes it much more practical for other people to use your language in their own projects

14 14 An example - SML.NET by Nick Benton Compiler for SML that targets verifiable CIL Research Issues: –Can we compile a polymorphic functional language to a monomorphic, object- oriented runtime? Yes –How can we make it produce fast, compact code? Whole-program optimising compiler. Monomorphisation. Representation tricks. Novel typed intermediate language using monads to track side- effects. –How can we make cross-language working easy? We extend SML to support all of the.NET CLS (Common Language Specification), providing smooth bidirectional interoperability with.NET framework libraries & other.NET languages

15 15 SML.NET interoperability Sounds great, but SML is not object-oriented –So we are going to have to do some work… Possible approaches to interop: –do not extend language; instead provide wrappers that give a functional view of a CLS library (Haskell, Mercury). Powerful functional type systems can go a very long way towards modelling OO type systems –redesign the language (OO-SML?) Our approach – a middle way: –re-use existing features where appropriate (non-object-oriented subset) –extend language for convenient interop when “fit” is bad (object-oriented features) –live with the CLS at boundaries: don’t try to export complex ML types to other languages (what would they do with them?)

16 16 Re-use SML features static field static method namespace void null multiple args mutabilityref open unit structure NONE val binding fun binding tuple CLS SML using private fieldslocal decls delegatefirst-class function

17 17 Extend language instance method invocation instance field access custom attributes casts class definitions type test exp :> ty attributes in classtype classtype obj.#meth obj.#fld cast patterns CLS SML

18 18 open System.Windows.Forms System.Drawing System.ComponentModel fun selectXML () = let val fileDialog = OpenFileDialog() in fileDialog.#set_DefaultExt("XML"); fileDialog.#set_Filter("XML files (*.xml) |*.xml"); if fileDialog.#ShowDialog() = DialogResult.OK then case fileDialog.#get_FileName() of NONE => () | SOME name => replaceTree (ReadXML.make name, "XML file '" ^ name ^ "'") else () end Extract from WinForms interop instance method invocation CLS Namespace = ML structure static method = ML function null value = NONE static constant field = ML value no args = ML unit value CLS string = ML string And note that there are no explicit types in this code

19 19 To come - Visual Studio Integration Bootstrap the compiler to produce a.NET component for parsing, typechecking, etc. of SML Use interlanguage working extensions to expose that as a COM component which can be glued into Visual Studio Write new ML code to handle syntax highlighting, tooltips, error reporting, etc.


Download ppt "1 Languages and Compilers (SProg og Oversættere) Bent Thomsen Department of Computer Science Aalborg University."

Similar presentations


Ads by Google