• A
  • A
  • A
  • ABC
  • ABC
  • ABC
  • А
  • А
  • А
  • А
  • А
Regular version of the site
For visually-impairedUser profile (HSE staff only)SearchMenu

Automatic Generation of Typesafe Interfaces for C++/WebAssembly from TypeScript Interfaces

Student: Egor Suvorov

Supervisor: Timofey Bryksin

Faculty: St. Petersburg School of Physics, Mathematics, and Computer Science

Educational Programme: Big Data Analysis for Business, Economy, and Society (Master)

Year of Graduation: 2020

Web applications are on the rise. They enable users to run programs on arbitrary devices with a web browser. Program interfaces in the web are designed for the JavaScript programming language first. Existing solutions for developing web applications in the C++ programming language (Emscripten, Cheerp) do not allow precise and automatic compile-time checks of complex calls to JavaScript interfaces from C++ programs. This dissertation presents a system that simplifies web application development in C++. It is based on the Emscripten project which compiles C++ programs to a WebAssembly virtual machine’s bytecode. The system consists of two parts: (a) helper library which enables users to describe JavaScript entities in C++ and call their methods with compile-time type checks; and (b) automatic generator of C++ header files which describe arbitrary JavaScript interfaces based on an existing description in the TypeScript programming language. The helper library emulates the type system of TypeScript via template metaprogramming in C++. The automatic generator enables the reuse of existing JavaScript libraries’ descriptions from the DefinitelyTyped project, which significantly simplifies the integration of C++ applications into the web ecosystem. The system developed enables C++ application to transparently interoperate with arbitrary JavaScript libraries having their program interface described in a popular TypeScript language. Compilation of C++ to WebAssembly is performed with a standard Clang compiler which allows usage of the latest C++ standards and any third-party libraries. The implementation of the system is made public at github.com/think-cell/tcjs. The system is covered with automatic unit-tests and is successfully used for developing a testing C++ application which uses HTML DOM API. Keywords: emscripten, webassembly, javascript, typescript, c++, foreign function interface

Student Theses at HSE must be completed in accordance with the University Rules and regulations specified by each educational programme.

Summaries of all theses must be published and made freely available on the HSE website.

The full text of a thesis can be published in open access on the HSE website only if the authoring student (copyright holder) agrees, or, if the thesis was written by a team of students, if all the co-authors (copyright holders) agree. After a thesis is published on the HSE website, it obtains the status of an online publication.

Student theses are objects of copyright and their use is subject to limitations in accordance with the Russian Federation’s law on intellectual property.

In the event that a thesis is quoted or otherwise used, reference to the author’s name and the source of quotation is required.

Search all student theses