download 2021 site
11
README.md
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
In 2022 I followed this course, compiler construction, by professor Eelco Visser.
|
||||
I may not have always agreed with him, but that is normal in academics.
|
||||
I still remember his teaching well,
|
||||
and I periodically come back to these slides since they're super instructive even when not using Spoofax,
|
||||
his language workbench research project in which he poored a large part of his life.
|
||||
[In 2022, only days after my final exam of this course, he unfortunately passed away far too early.](https://www.tudelft.nl/2022/ewi/in-memoriam-eelco-visser-1966-2022)
|
||||
These are the slides and course website for 2021, since the version of 2022 is no longer online.
|
||||
As such I wanted to preserve this information, since it looks like it might be lost to time otherwise.
|
||||
Just to say this again, I only do this to preserve invaluable knowledgethat may otherwise be lost.
|
||||
I do not mean to infringe on copyright otherwise.
|
||||
448
blog/2020/08/31/a-new-compiler-course.html
Normal file
|
|
@ -0,0 +1,448 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>A New Compiler Construction Course</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../../../../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../../../../css/main.css" rel="stylesheet">
|
||||
<link href="../../../../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../../../../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../../../../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../../../../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../../../../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../../../../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../../../../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../../../index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container blog">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-sm-12 col-md-12 col-lg-1 col-xl-1">
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="col-sm-12 col-md-12 col-lg-10 col-xl-10 border-grey">
|
||||
<h1 class="border-top border-grey pt-3 pb-3">
|
||||
A New Compiler Construction Course
|
||||
</h1>
|
||||
<div class="datebox mb-3 text-secondary">
|
||||
August 31, 2020
|
||||
</div>
|
||||
<p>We’re changing things this year.
|
||||
Of course, due to Corona the course takes place mostly online.
|
||||
But we’re also changing things to the contents of the course.</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p>The course used to be split in a theory part and a practical part. This year, we have split the course in a front-end part (CS4200-A) in Q1 and a back-end part (CS4200-B) in Q2. Each course includes theory and practice of that part of the compiler. So the complete course is still 10 ECTS.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>We’re introducing a new website.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Most documentation is on the <a href="http://metaborg.org">MetaBorg</a> website.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>The project changes from MiniJava, a Java subset, to ChocoPy, a Python subset.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>There will be less emphasis in the project on testing.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>We will not provide a template project (for the front-end course). You set up the language project in Spoofax from scratch.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>We will have programming exercises in WebLab.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../../../2021/08/27/a-new-language-workbench.html">Next</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../../../2021/08/27/a-new-language-workbench.html">
|
||||
Latest
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="https://tudelft-cs4200.github.io/2021/blog/index/">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12 col-md-12 col-lg-1 col-xl-1">
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
440
blog/2021/08/27/a-new-language-workbench.html
Normal file
|
|
@ -0,0 +1,440 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>A New Language Workbench</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../../../../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../../../../css/main.css" rel="stylesheet">
|
||||
<link href="../../../../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../../../../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../../../../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../../../../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../../../../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../../../../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../../../../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../../../index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container blog">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-sm-12 col-md-12 col-lg-1 col-xl-1">
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="col-sm-12 col-md-12 col-lg-10 col-xl-10 border-grey">
|
||||
<h1 class="border-top border-grey pt-3 pb-3">
|
||||
A New Language Workbench
|
||||
</h1>
|
||||
<div class="datebox mb-3 text-secondary">
|
||||
August 27, 2021
|
||||
</div>
|
||||
<p>This year will adopt last year’s structure of the course, and adapt it.
|
||||
In particular, we will keep the ChocoPy project.
|
||||
Major changes to the course are</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p>We introduce <a href="https://www.spoofax.dev/spoofax-pie/develop/">Spoofax 3</a> (aka Spoofax-PIE), a redesign of the guts of the workbench recombining the familiar meta languages.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>We introduce a new website for the Spoofax meta languages at <a href="https://www.spoofax.dev/">https://www.spoofax.dev/</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p>For the back-end of the compiler (that you develop in Q2) we adopt the nanopass compiler architecture approach.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>We introduce Stratego 2, a <a href="https://researchr.org/publication/SmitsV20">gradually typed</a> version of the Stratego transformation language.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../../../2020/08/31/a-new-compiler-course.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="a-new-language-workbench.html">
|
||||
Latest
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="https://tudelft-cs4200.github.io/2021/blog/index/">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12 col-md-12 col-lg-1 col-xl-1">
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
230
blog/index.html
Normal file
|
|
@ -0,0 +1,230 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>The CS4200 Blog</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<main role="main" >
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
<div class="ml-3 mr-3 mb-3 pb-3 border-bottom border-dark">
|
||||
<h2>The CS4200 Blog</h2>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row ml-3 mr-3 mb-3 border-bottom border-secondary">
|
||||
<div class="col-md-2 ml-0 pl-0 pr-0">
|
||||
<div class="">
|
||||
<h3 id="y2021">2021</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-10 pl-0 pr-0 mr-0">
|
||||
<ul class="list-group list-group-flush">
|
||||
|
||||
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pt-0 mb-0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-dark pl-3">
|
||||
<div class="font-weight-bold text-dark" >
|
||||
<a class="text-dark" href="https://tudelft-cs4200.github.io/2021/blog/2021/08/27/a-new-language-workbench.html">A New Language Workbench</a>
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
August 27, 2021
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul> </div> </div>
|
||||
|
||||
<div class="row ml-3 mr-3 mb-3 border-bottom border-secondary">
|
||||
<div class="col-md-2 ml-0 pl-0 pr-0">
|
||||
<div class="">
|
||||
<h3 id="y2020">2020</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-10 pl-0 pr-0 mr-0">
|
||||
<ul class="list-group list-group-flush">
|
||||
|
||||
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pt-0 mb-0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-dark pl-3">
|
||||
<div class="font-weight-bold text-dark" >
|
||||
<a class="text-dark" href="https://tudelft-cs4200.github.io/2021/blog/2020/08/31/a-new-compiler-course.html">A New Compiler Construction Course</a>
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
August 31, 2020
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
</ul> </div> </div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</main>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
172
contact/index.html
Normal file
|
|
@ -0,0 +1,172 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Contact</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<main role="main" >
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
<div class="col-sm-12 col-md-12 col-lg-6 col-xl-6">
|
||||
<div class="card border-dark mb-3" >
|
||||
<div class="card-header">
|
||||
<h5>Lecturer</h5>
|
||||
</div>
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item">
|
||||
<a href="http://eelcovisser.org/">
|
||||
Prof. Dr. Eelco Visser</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12 col-md-12 col-lg-6 col-xl-6">
|
||||
<div class="card border-dark mb-3" >
|
||||
<div class="card-header">
|
||||
<h5>Teaching Assistants</h5>
|
||||
</div>
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item">
|
||||
<a href="index.html">
|
||||
Ruben van Baarle</a>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<a href="index.html">
|
||||
Thijs Molendijk</a>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<a href="index.html">
|
||||
Aron Zwaan</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</main>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
160
css/borders-responsive.css
Normal file
|
|
@ -0,0 +1,160 @@
|
|||
.border-top {
|
||||
border-top: 1px solid; }
|
||||
|
||||
.border-right {
|
||||
border-right: 1px solid; }
|
||||
|
||||
.border-bottom {
|
||||
border-bottom: 1px solid; }
|
||||
|
||||
.border-left {
|
||||
border-left: 1px solid; }
|
||||
|
||||
.border-top-0 {
|
||||
border-top: 0 !important; }
|
||||
|
||||
.border-right-0 {
|
||||
border-right: 0 !important; }
|
||||
|
||||
.border-bottom-0 {
|
||||
border-bottom: 0 !important; }
|
||||
|
||||
.border-left-0 {
|
||||
border-left: 0 !important; }
|
||||
|
||||
.border-x {
|
||||
border-left: 1px solid;
|
||||
border-right: 1px solid; }
|
||||
|
||||
.border-y {
|
||||
border-top: 1px solid;
|
||||
border-bottom: 1px solid; }
|
||||
|
||||
@media (min-width: 576px) {
|
||||
.border-sm-top {
|
||||
border-top: 1px solid; }
|
||||
|
||||
.border-sm-right {
|
||||
border-right: 1px solid; }
|
||||
|
||||
.border-sm-bottom {
|
||||
border-bottom: 1px solid; }
|
||||
|
||||
.border-sm-left {
|
||||
border-left: 1px solid; }
|
||||
|
||||
.border-sm-top-0 {
|
||||
border-top: 0 !important; }
|
||||
|
||||
.border-sm-right-0 {
|
||||
border-right: 0 !important; }
|
||||
|
||||
.border-sm-bottom-0 {
|
||||
border-bottom: 0 !important; }
|
||||
|
||||
.border-sm-left-0 {
|
||||
border-left: 0 !important; }
|
||||
|
||||
.border-sm-x {
|
||||
border-left: 1px solid;
|
||||
border-right: 1px solid; }
|
||||
|
||||
.border-sm-y {
|
||||
border-top: 1px solid;
|
||||
border-bottom: 1px solid; } }
|
||||
@media (min-width: 768px) {
|
||||
.border-md-top {
|
||||
border-top: 1px solid; }
|
||||
|
||||
.border-md-right {
|
||||
border-right: 1px solid; }
|
||||
|
||||
.border-md-bottom {
|
||||
border-bottom: 1px solid; }
|
||||
|
||||
.border-md-left {
|
||||
border-left: 1px solid; }
|
||||
|
||||
.border-md-top-0 {
|
||||
border-top: 0 !important; }
|
||||
|
||||
.border-md-right-0 {
|
||||
border-right: 0 !important; }
|
||||
|
||||
.border-md-bottom-0 {
|
||||
border-bottom: 0 !important; }
|
||||
|
||||
.border-md-left-0 {
|
||||
border-left: 0 !important; }
|
||||
|
||||
.border-md-x {
|
||||
border-left: 1px solid;
|
||||
border-right: 1px solid; }
|
||||
|
||||
.border-md-y {
|
||||
border-top: 1px solid;
|
||||
border-bottom: 1px solid; } }
|
||||
@media (min-width: 992px) {
|
||||
.border-lg-top {
|
||||
border-top: 1px solid; }
|
||||
|
||||
.border-lg-right {
|
||||
border-right: 1px solid; }
|
||||
|
||||
.border-lg-bottom {
|
||||
border-bottom: 1px solid; }
|
||||
|
||||
.border-lg-left {
|
||||
border-left: 1px solid; }
|
||||
|
||||
.border-lg-top-0 {
|
||||
border-top: 0 !important; }
|
||||
|
||||
.border-lg-right-0 {
|
||||
border-right: 0 !important; }
|
||||
|
||||
.border-lg-bottom-0 {
|
||||
border-bottom: 0 !important; }
|
||||
|
||||
.border-lg-left-0 {
|
||||
border-left: 0 !important; }
|
||||
|
||||
.border-lg-x {
|
||||
border-left: 1px solid;
|
||||
border-right: 1px solid; }
|
||||
|
||||
.border-lg-y {
|
||||
border-top: 1px solid;
|
||||
border-bottom: 1px solid; } }
|
||||
@media (min-width: 1200px) {
|
||||
.border-xl-top {
|
||||
border-top: 1px solid; }
|
||||
|
||||
.border-xl-right {
|
||||
border-right: 1px solid; }
|
||||
|
||||
.border-xl-bottom {
|
||||
border-bottom: 1px solid; }
|
||||
|
||||
.border-xl-left {
|
||||
border-left: 1px solid; }
|
||||
|
||||
.border-xl-top-0 {
|
||||
border-top: 0 !important; }
|
||||
|
||||
.border-xl-right-0 {
|
||||
border-right: 0 !important; }
|
||||
|
||||
.border-xl-bottom-0 {
|
||||
border-bottom: 0 !important; }
|
||||
|
||||
.border-xl-left-0 {
|
||||
border-left: 0 !important; }
|
||||
|
||||
.border-xl-x {
|
||||
border-left: 1px solid;
|
||||
border-right: 1px solid; }
|
||||
|
||||
.border-xl-y {
|
||||
border-top: 1px solid;
|
||||
border-bottom: 1px solid; } }
|
||||
197
css/main.css
Normal file
|
|
@ -0,0 +1,197 @@
|
|||
body {
|
||||
padding-top: 5rem;
|
||||
}
|
||||
.starter-template {
|
||||
padding: 3rem 1.5rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.border-grey {
|
||||
border-color:
|
||||
#888 !important;
|
||||
}
|
||||
|
||||
.border-light-grey {
|
||||
border-color:
|
||||
#bbb !important;
|
||||
}
|
||||
|
||||
.bd-callout {
|
||||
border-left: 3px solid;
|
||||
}
|
||||
|
||||
.notice {
|
||||
border-left: 4px solid lightgray;
|
||||
padding: 0.2rem 0 0.2rem 0.4rem;
|
||||
}
|
||||
|
||||
.notice-warning {
|
||||
background-color: #fcf8e3;
|
||||
border-color: #f1c40f;
|
||||
}
|
||||
|
||||
.notice-danger {
|
||||
background-color: #f2dede;
|
||||
border-color: #e74c3c;
|
||||
}
|
||||
|
||||
.notice-success {
|
||||
background-color: #dff0d8;
|
||||
border-color: #2ecc71;
|
||||
}
|
||||
|
||||
.faded {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
/* blog */
|
||||
|
||||
.blog h1 {
|
||||
border-bottom : 1px solid #aaa;
|
||||
padding-bottom: 10px;
|
||||
font-size: 1.8rem;
|
||||
}
|
||||
|
||||
.blog h2 {
|
||||
border-bottom : 1px solid #aaa;
|
||||
padding-bottom: 10px;
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
.blog h3 {
|
||||
border-bottom : 1px solid #aaa;
|
||||
padding-bottom: 10px;
|
||||
font-size: 1.3rem;
|
||||
}
|
||||
|
||||
.blog .datebox {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.blog img {
|
||||
max-width : 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
|
||||
.post img {
|
||||
max-width : 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.row img {
|
||||
max-width : 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
/* a {
|
||||
color: #212529
|
||||
} */
|
||||
|
||||
|
||||
/* wiki */
|
||||
|
||||
.wiki h1 {
|
||||
border-bottom : 0px solid #aaa;
|
||||
padding-bottom: 5px;
|
||||
font-size: 1.8rem;
|
||||
}
|
||||
|
||||
.wiki h2 {
|
||||
border-bottom : 1px solid #aaa;
|
||||
padding-bottom: 5px;
|
||||
font-size: 1.6rem;
|
||||
}
|
||||
|
||||
.wiki h3 {
|
||||
border-bottom : 1px solid #aaa;
|
||||
padding-bottom: 5px;
|
||||
font-size: 1.4rem;
|
||||
}
|
||||
|
||||
.wiki .datebox {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.wiki img {
|
||||
max-width : 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
|
||||
.video-container {
|
||||
position: relative;
|
||||
padding-bottom: 56.25%;
|
||||
padding-top: 35px;
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
|
||||
.video-container iframe {
|
||||
position: absolute;
|
||||
top:0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
/* .anchor::before {
|
||||
display: block;
|
||||
content: " ";
|
||||
margin-top: -80px;
|
||||
height: 80px;
|
||||
width: 0px;
|
||||
visibility: hidden;
|
||||
pointer-events: none;
|
||||
z-index: -100;
|
||||
} */
|
||||
|
||||
.anchor a {
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
top: -80px;
|
||||
}
|
||||
.anchor {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
|
||||
.section a {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
display: block;
|
||||
border-left : 4pt solid;
|
||||
border-color: grey;
|
||||
padding-left: 1em;
|
||||
}
|
||||
|
||||
.toc a {
|
||||
color : black;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.toc-sub a {
|
||||
color : black;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
html {
|
||||
scroll-padding-top: 70px; /* height of sticky header */
|
||||
}
|
||||
|
||||
.top70 {
|
||||
top : 70px;
|
||||
}
|
||||
|
||||
div .highlight {
|
||||
padding-left : 0.8em;
|
||||
padding-top: 0.1em;
|
||||
padding-bottom: 0em;
|
||||
font-family: JetBrains Mone;
|
||||
}
|
||||
.highlight {
|
||||
background-color: #EEE;
|
||||
}
|
||||
121
css/pl.css
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
|
||||
/*Navbar*/
|
||||
.navbar, .tudelft {
|
||||
/* background-color: #007bc0; */
|
||||
background-color: #1d3056;
|
||||
/* background-color: #00A6D6; */
|
||||
}
|
||||
|
||||
/*
|
||||
@media(max-width: 992px) {
|
||||
|
||||
.navbar {
|
||||
min-height: 80px;
|
||||
}
|
||||
|
||||
.navbar-toggler-icon {
|
||||
width: 2em;
|
||||
height: 2em;
|
||||
}
|
||||
|
||||
body {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media(max-width: 992px) {
|
||||
.logo {
|
||||
height: 45px;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
.logo {
|
||||
height: 35px;
|
||||
}
|
||||
|
||||
|
||||
.navbar-light .navbar-nav .nav-link, .tudelft {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.navbar-light .navbar-nav .nav-link:focus, .navbar-light .navbar-nav .nav-link:hover {
|
||||
color: #de1b2c;
|
||||
}
|
||||
|
||||
/*Content*/
|
||||
|
||||
/*
|
||||
|
||||
.container-center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@media(min-width: 992px) {
|
||||
.content {
|
||||
width: 80%;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
.content {
|
||||
padding: 1rem;
|
||||
display: inline-block;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/********* Simple or original overlay *******/
|
||||
/* Main container */
|
||||
.overlay-image {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
/* Original image */
|
||||
.overlay-image .image {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
/* Original text overlay */
|
||||
.overlay-image .text {
|
||||
color: #fff;
|
||||
font-size: 30px;
|
||||
line-height: 1.5em;
|
||||
text-shadow: 2px 2px 2px #000;
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/********* Overlay on hover *******/
|
||||
/* New overlay on hover */
|
||||
.overlay-image .hover {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
opacity: 0;
|
||||
transition: .5s ease;
|
||||
}
|
||||
/* New overlay appearance on hover */
|
||||
.overlay-image:hover .hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
/* Make card pictures equal size */
|
||||
.people-card img.card-img-top {
|
||||
height: 350px;
|
||||
object-fit: cover;
|
||||
object-position: 50% 0%;
|
||||
}
|
||||
@media (max-width: 1199px){.people-card img.card-img-top { height: 400px; } }
|
||||
@media (max-width: 991px){ .people-card img.card-img-top { height: 450px; } }
|
||||
@media (max-width: 767px){ .people-card img.card-img-top { height: 600px; } }
|
||||
273
homework/1-1-a.html
Normal file
|
|
@ -0,0 +1,273 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Week 1.1(a): Compilers</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Week 1.1(a): Compilers
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Homework
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
September 02, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<p>The assignments for <a href="../lecture/1.html">Lecture 1</a> are essay questions, which you can find on <a href="https://weblab.tudelft.nl/cs4200/2021-2022/assignment/87591/info">WebLab</a>.
|
||||
We will <em>not</em> grade these assignments, and they are not part of the Homework grade.
|
||||
But expect these types of questions on the exam.</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1-1-b.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1-1-b.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
291
homework/1-1-b.html
Normal file
|
|
@ -0,0 +1,291 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Week 1.1(b): Syntax Definition</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Week 1.1(b): Syntax Definition
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
Eelco Visser
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Homework
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
September 03, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<p>In this set of assignments, published on <a href="https://weblab.tudelft.nl/cs4200/2021-2022/assignment/87648/info">WebLab</a>, we exercise syntax definition in SDF3 to define the structure and notation of programs following the material of <a href="../lecture/2.html">Lecture 2</a>.</p>
|
||||
|
||||
<!-- You can make the assignments directly in WebLab, but we recommend following the [instructions](/2021/homework/1-1-b) to set up a Spoofax project to make the assignments in Spoofax. -->
|
||||
|
||||
<p>The template for the assignments this week is: given this (fragment of a) language, provide a syntax definition for it.
|
||||
We give a couple of examples.
|
||||
In the exam we will test your skills in this department.
|
||||
So, do exercise your understanding of syntax definition by creating syntax definitions for all the languages you encounter.</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1-1-a.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1-1.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1-1-a.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1-1.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
295
homework/1-1.html
Normal file
|
|
@ -0,0 +1,295 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Week 1.2: Disambiguation</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Week 1.2: Disambiguation
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Homework
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
September 09, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<p>In this set of assignments, published on <a href="https://weblab.tudelft.nl/cs4200/2021-2022/assignment/87683/view">WebLab</a>, we exercise the disambiguation of grammars following the material of <a href="../lecture/3.html">Lecture 3</a>.</p>
|
||||
|
||||
<!-- You can make the assignments directly in WebLab, but we recommend following the [instructions](/2021/homework/1-1-b) to set up a Spoofax project to make the assignments in Spoofax. -->
|
||||
|
||||
<p>The template for the assignments this week is: given this (ambiguous) context-free grammar:</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p>Show that the grammar is indeed ambiguous by giving a sentence and at least two different left-most derivations for that sentence and the corresponding abstract syntax trees.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Disambiguate the grammar using declarative disambiguation rules to indicate the associativity and priority of operators.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Transform the grammar to an unambiguous grammar with equivalent abstract syntax trees for sentences.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>We also provide an assignment to exercise disambiguation using layout constraints.</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1-1-b.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1-3.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1-1-b.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1-3.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
276
homework/1-3.html
Normal file
|
|
@ -0,0 +1,276 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Week 1.3: Type Constraints</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Week 1.3: Type Constraints
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Homework
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
September 16, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<p>In this set of assignments, published on <a href="https://weblab.tudelft.nl/cs4200/2021-2022/assignment/87716/view">WebLab</a>, we exercise the definition of simple type constraints in Statix following the material of <a href="../lecture/4.html">Lecture 4</a>.</p>
|
||||
|
||||
<!-- You can make the assignments directly in WebLab, but we recommend following the [instructions](/2021/homework/1-3-a) to set up a Spoofax project to make the assignments in Spoofax. -->
|
||||
|
||||
<p>The template for the assignments this week is: given this language (the syntax definition of which you can find in the ‘test data’ of the assignment) define the given predicate (e.g. <code class="language-plaintext highlighter-rouge">typeOfExp</code>) for all the constructs of the language such that all tests succeed. The assignment text gives a high-level explanation of the expected properties of operators. The tests provide concrete examples.</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1-1.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1-4.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1-1.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1-4.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
271
homework/1-4.html
Normal file
|
|
@ -0,0 +1,271 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Week 1.4: Name Binding and Name Resolution</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Week 1.4: Name Binding and Name Resolution
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Homework
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
September 23, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<p>In this set of assignments, published on <a href="https://weblab.tudelft.nl/cs4200/2020-2021/assignment/51095/view">WebLab</a>, we exercise the definition of name resolution in Statix following the material of <a href="../lecture/5.html">Lecture 5</a>.</p>
|
||||
|
||||
<!-- You can make the assignments directly in WebLab, but we recommend following the [instructions](/homework/2020/09/17/homework-project/) to set up a Spoofax project to make the assignments in Spoofax. -->
|
||||
|
||||
<p>The template for the assignments this week is: given this language (the syntax definition of which you can find in the ‘test data’ of the assignment) define the given predicate (e.g. <code class="language-plaintext highlighter-rouge">typeOfExp</code>) for all the constructs of the language such that all tests succeed. The assignment text gives a high-level explanation of the expected properties of operators. The tests provide concrete examples.</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1-3.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1-5.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1-3.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1-5.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
262
homework/1-5.html
Normal file
|
|
@ -0,0 +1,262 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Week 1.5: Constraint Resolution</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Week 1.5: Constraint Resolution
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Homework
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
September 30, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<p>In this set of assignments, published on <a href="https://weblab.tudelft.nl/cs4200/2021-2022/assignment/87779/view">WebLab</a>, we exercise constraint resolution techniques following the material of <a href="../lecture/6.html">Lecture 6</a>.</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1-4.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1-7.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1-4.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1-7.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
257
homework/1-7.html
Normal file
|
|
@ -0,0 +1,257 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Week 1.6: Parsing</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Week 1.6: Parsing
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Homework
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
October 08, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<p>In this set of assignments, published on <a href="https://weblab.tudelft.nl/cs4200/2021-2022/assignment/87798/view">WebLab</a>, we exercise the material of <a href="../lecture/7.html">Lecture 7</a> and <a href="../lecture/8.html">Lecture 8</a> on parsing algorithms.</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1-5.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../homwork/2-1.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1-5.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../homwork/2-1.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
439
homework/index.html
Normal file
|
|
@ -0,0 +1,439 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Homework Assignments</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<main role="main" >
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
<div class="ml-3 mr-3 mb-3 pb-3 border-bottom border-dark" width="100%">
|
||||
<h2>Homework Assignments</h2>
|
||||
<div class="border-top border-dark pt-3 mt-3">
|
||||
See also:
|
||||
<a href="../lectures/index.html">Lectures</a>
|
||||
| <a href="../project/index.html">Project</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ml-3 mr-3 mb-3 pb-3 border-bottom border-dark" width="100%">
|
||||
Note that last year's assignments are list marked with (2020). They will be updated to their definitive 2021 versions.
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row ml-3 mr-3 mb-3 border-bottom border-secondary">
|
||||
<div class="col-md-2 ml-0 pl-0 pr-0">
|
||||
<div class="">
|
||||
<h3 id="y2021">2021</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-10 pl-0 pr-0 mr-0">
|
||||
<ul class="list-group list-group-flush">
|
||||
|
||||
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pt-0 mb-0" >
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-primary pl-3 ">
|
||||
<div class="font-weight-bold text-dark" >
|
||||
<a class="text-dark" href="1-1-a.html">Week 1.1(a): Compilers</a>
|
||||
</div>
|
||||
|
||||
<div class="text-secondary" style="font-size:90%;">
|
||||
|
||||
|
||||
Homework
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
September 02, 2021
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pt-0 mb-0" >
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-primary pl-3 ">
|
||||
<div class="font-weight-bold text-dark" >
|
||||
<a class="text-dark" href="1-1-b.html">Week 1.1(b): Syntax Definition</a>
|
||||
</div>
|
||||
|
||||
<!-- <div class="text-secondary" >
|
||||
Eelco Visser
|
||||
</div> -->
|
||||
|
||||
<div class="text-secondary" style="font-size:90%;">
|
||||
|
||||
|
||||
Homework
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
September 03, 2021
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pt-0 mb-0" >
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-primary pl-3 ">
|
||||
<div class="font-weight-bold text-dark" >
|
||||
<a class="text-dark" href="1-1.html">Week 1.2: Disambiguation</a>
|
||||
</div>
|
||||
|
||||
<div class="text-secondary" style="font-size:90%;">
|
||||
|
||||
|
||||
Homework
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
September 09, 2021
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pt-0 mb-0" >
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-primary pl-3 ">
|
||||
<div class="font-weight-bold text-dark" >
|
||||
<a class="text-dark" href="1-3.html">Week 1.3: Type Constraints</a>
|
||||
</div>
|
||||
|
||||
<div class="text-secondary" style="font-size:90%;">
|
||||
|
||||
|
||||
Homework
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
September 16, 2021
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pt-0 mb-0" >
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-primary pl-3 ">
|
||||
<div class="font-weight-bold text-dark" >
|
||||
<a class="text-dark" href="1-4.html">Week 1.4: Name Binding and Name Resolution</a>
|
||||
</div>
|
||||
|
||||
<div class="text-secondary" style="font-size:90%;">
|
||||
|
||||
|
||||
Homework
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
September 23, 2021
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pt-0 mb-0" >
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-primary pl-3 ">
|
||||
<div class="font-weight-bold text-dark" >
|
||||
<a class="text-dark" href="1-5.html">Week 1.5: Constraint Resolution</a>
|
||||
</div>
|
||||
|
||||
<div class="text-secondary" style="font-size:90%;">
|
||||
|
||||
|
||||
Homework
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
September 30, 2021
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pt-0 mb-0" >
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-primary pl-3 ">
|
||||
<div class="font-weight-bold text-dark" >
|
||||
<a class="text-dark" href="1-7.html">Week 1.6: Parsing</a>
|
||||
</div>
|
||||
|
||||
<div class="text-secondary" style="font-size:90%;">
|
||||
|
||||
|
||||
Homework
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
October 08, 2021
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pt-0 mb-0" >
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-primary pl-3 ">
|
||||
<div class="font-weight-bold text-dark" >
|
||||
<a class="text-dark" href="../homwork/2-1.html">Week 2.1: Transformation with Rewrite Rules</a>
|
||||
</div>
|
||||
|
||||
<div class="text-secondary" style="font-size:90%;">
|
||||
|
||||
|
||||
Homework
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
November 11, 2021
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pt-0 mb-0" >
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-primary pl-3 ">
|
||||
<div class="font-weight-bold text-dark" >
|
||||
<a class="text-dark" href="../homwork/2-1.html">Homework Q2</a>
|
||||
</div>
|
||||
|
||||
<div class="text-secondary" style="font-size:90%;">
|
||||
|
||||
|
||||
Homework
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
November 18, 2021
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
</ul> </div> </div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</main>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
239
homwork/2-1.html
Normal file
|
|
@ -0,0 +1,239 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Homework Q2</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Homework Q2
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Homework
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
November 18, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<p>See WebLab for further homework assignments to prepare for the exam.</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="2-1.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../homework/index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="2-1.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../homework/index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
BIN
img/logo/PL-logo72.png
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
BIN
img/logo/pl_ico2_2B3_icon.ico
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
img/spoofax/Spoofax-Screenshot2.png
Normal file
|
After Width: | Height: | Size: 96 KiB |
BIN
img/vmb6/2019/2019-03-27-building-28.jpg
Normal file
|
After Width: | Height: | Size: 4.1 MiB |
BIN
img/weblab/WebLabScreenshot2.png
Normal file
|
After Width: | Height: | Size: 273 KiB |
761
index.html
Normal file
|
|
@ -0,0 +1,761 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>CS4200 | Compiler Construction | 2021-2022</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="css/main.css" rel="stylesheet">
|
||||
<link href="css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<main role="main" >
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="span12">
|
||||
|
||||
<div class="row">
|
||||
<div class="mb-lg-3 col-sm-12 col-md-12 col-lg-5 col-xl-5 border-lg-right border-grey">
|
||||
|
||||
<div class="border-top border-light-grey">
|
||||
<div class="card-header bg-dark text-white">
|
||||
<h4 class="pt-2"> TU Delft | CS4200 | 2021-2022</h4>
|
||||
<h4 class="pt-2"> Compiler Construction </h4>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pt-0 mb-1 mt-0">
|
||||
<ul class="list-group list-group-flush pt-0 mt-0">
|
||||
<li class="list-group-item">
|
||||
<a href="https://studiegids.tudelft.nl/a101_displayProgram.do?program_tree_id=25159">Master Computer Science</a>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
Common Core Software Technology
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
Specialization Programming Languages
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
Credits: 2 x 5 ECTS
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="card mb-1 border-top border-bottom border-dark border-left-0 border-right-0">
|
||||
<div class="card-body bg-dark text-white pt-1 pb-1">
|
||||
Schedule
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pt-0 mb-1 mt-0 ">
|
||||
<ul class="list-group list-group-flush pt-0 mt-0">
|
||||
<li class="list-group-item">
|
||||
Lectures Q1: Thursday 11:00 - 12:45
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
Lab Q1: Tuesday 10:45 - 12:45, 13:45 - 15:45
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
Lectures Q2: Thursday 15:45 - 17:45
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
Lab Q2: Friday 13:45 - 17:45
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="card mb-1 border-top border-bottom border-dark border-left-0 border-right-0">
|
||||
<div class="card-body bg-dark text-white pt-1 pb-1">
|
||||
Organization
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<a href="https://pl.ewi.tudelft.nl"><img width="30%" src="img/logo/PL-logo72.png" align="right" class="ml-3 mt-3"></a>
|
||||
|
||||
<div class="pt-0 mb-1 mt-0 ">
|
||||
<ul class="list-group list-group-flush pt-0 mt-0">
|
||||
<li class="list-group-item">
|
||||
<a href="https://pl.ewi.tudelft.nl">
|
||||
Programming Languages Group
|
||||
</a>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<a href="https://www.tudelft.nl/en/eemcs/the-faculty/departments/software-technology/">Department of Software Technology</a>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<a href="https://www.tudelft.nl/en/ewi/">Faculty of Electrical Engineering, Mathematics and Computer Science</a>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<a href="http://www.tudelft.nl/">Delft University of Technology</a></li>
|
||||
<li class="list-group-item">
|
||||
Delft, The Netherlands (<a href="http://www.timeanddate.com/worldclock/custom.html?cities=16">CEST/CET</a>)
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="card mb-1 border-top border-bottom border-dark border-left-0 border-right-0">
|
||||
<div class="card-body bg-dark text-white pt-1 pb-1">
|
||||
Course Staff
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pt-0 mb-1 mt-0">
|
||||
<ul class="list-group list-group-flush pt-0 mt-0">
|
||||
<li class="list-group-item">
|
||||
Lecturer: <a href="https://eelcovisser.org">Eelco Visser</a>
|
||||
(<a href="mailto:e.visser@tudelft.nl">e.visser@tudelft.nl</a>)
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
TA: Ruben van Baarle
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
TA: Thijs Molendijk
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
TA: Aron Zwaan (for Q1)
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
TA: Jeff Smits (for Q2)
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
TA: Gabriël Konat (for Spoofax3)
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<a href="contact/index.html">
|
||||
<img width="100%" src="img/vmb6/2019/2019-03-27-building-28.jpg" />
|
||||
</a>
|
||||
<small >
|
||||
<p class="ml-3">Computer Science Building 28 at Van Mourik Broekmanweg</p>
|
||||
</small>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12 col-md-12 col-lg-7 col-xl-7 border-grey">
|
||||
|
||||
|
||||
|
||||
<div class="border-top border-light-grey pt-3 mt-0">
|
||||
<div class="card-body pt-0 mt-0 ">
|
||||
<h5 class="card-title">
|
||||
Compiler Construction
|
||||
</h5>
|
||||
|
||||
<p>Compilers translate the source code of programs in a high-level programming language into executable (virtual) machine code. Nowadays, compilers are typically integrated into development environments providing features like syntax highlighting, content assistance, live error reporting, and continuous target code generation.</p> <p> This course studies the architecture of compilers and interactive programming environments and the concepts and techniques underlying the components of that architecture. For each of the components of a compiler we study the formal theory underlying the language aspect that it covers, declarative specification languages to define compiler components, and the techniques for their implementation. The concepts and techniques are illustrated by application to small languages or language fragments.</p><p>The compiler construction program consists of two courses of 5 ECTS each.</p>
|
||||
<a href="https://tudelft-cs4200.github.io/#researchtopics">
|
||||
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
|
||||
<div class="card border-dark mb-3">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">
|
||||
<a href="/#researchtopics">
|
||||
|
||||
</a>
|
||||
</h5>
|
||||
<p>Compilers translate the source code of programs in a high-level programming language into executable (virtual) machine code. Nowadays, compilers are typically integrated into development environments providing features like syntax highlighting, content assistance, live error reporting, and continuous target code generation.</p> <p> This course studies the architecture of compilers and interactive programming environments and the concepts and techniques underlying the components of that architecture. For each of the components of a compiler we study the formal theory underlying the language aspect that it covers, declarative specification languages to define compiler components, and the techniques for their implementation. The concepts and techniques are illustrated by application to small languages or language fragments.</p><p>The compiler construction program consists of two courses of 5 ECTS each.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
-->
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="border-top border-light-grey pt-3 mt-0">
|
||||
<div class="card-body pt-0 mt-0 ">
|
||||
<h5 class="card-title">
|
||||
CS4200-A: Front-End (Q1)
|
||||
</h5>
|
||||
|
||||
<p>In the first course we study the front-end of the compiler that parses and type checks programs. We study meta-languages for the definition of the syntax and static semantics of programming languages. [<a href=https://studiegids.tudelft.nl/a101_displayCourse.do?course_id=57369>Study guide</a>]</p>
|
||||
<a href="https://studiegids.tudelft.nl/a101_displayCourse.do?course_id=55207">
|
||||
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
|
||||
<div class="card border-dark mb-3">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">
|
||||
<a href="https://studiegids.tudelft.nl/a101_displayCourse.do?course_id=55207">
|
||||
|
||||
</a>
|
||||
</h5>
|
||||
<p>In the first course we study the front-end of the compiler that parses and type checks programs. We study meta-languages for the definition of the syntax and static semantics of programming languages. [<a href=https://studiegids.tudelft.nl/a101_displayCourse.do?course_id=57369>Study guide</a>]</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
-->
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="border-top border-light-grey pt-3 mt-0">
|
||||
<div class="card-body pt-0 mt-0 ">
|
||||
<h5 class="card-title">
|
||||
CS4200-B: Back-End (Q2)
|
||||
</h5>
|
||||
|
||||
In the second course we study the back-end of the compiler that performs static analysis, optimization, and code generation. [<a href=https://studiegids.tudelft.nl/a101_displayCourse.do?course_id=57374>Study guide</a>]
|
||||
<a href="https://studiegids.tudelft.nl/a101_displayCourse.do?course_id=55213">
|
||||
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
|
||||
<div class="card border-dark mb-3">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">
|
||||
<a href="https://studiegids.tudelft.nl/a101_displayCourse.do?course_id=55213">
|
||||
|
||||
</a>
|
||||
</h5>
|
||||
In the second course we study the back-end of the compiler that performs static analysis, optimization, and code generation. [<a href=https://studiegids.tudelft.nl/a101_displayCourse.do?course_id=57374>Study guide</a>]
|
||||
</div>
|
||||
</div>
|
||||
|
||||
-->
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="border-top border-light-grey pt-3 mt-0">
|
||||
<div class="card-body pt-0 mt-0 ">
|
||||
<h5 class="card-title">
|
||||
Spoofax Language Workbench
|
||||
</h5>
|
||||
|
||||
|
||||
<a href="https://tudelft-cs4200.github.io/research/#Spoofax">
|
||||
<img style="border:1px solid black; width:100pt; margin-left:10px;" src="img/spoofax/Spoofax-Screenshot2.png" class="float-right card-img" alt="">
|
||||
</a>
|
||||
|
||||
|
||||
The <a href=https://www.spoofax.dev>Spoofax Language Workbench</a> is an environment for the development of programming languages using high-level declarative meta-languages for syntax, static semantics, dynamic semantics, program analysis, and program transformation. We use Spoofax to implement a compiler and IDE for the project language and in homework assignments to experiment with various aspects of compilers in isolation.
|
||||
<a href="https://tudelft-cs4200.github.io/research/#Spoofax">
|
||||
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
|
||||
<div class="card border-dark mb-3">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">
|
||||
<a href="/research/#Spoofax">
|
||||
|
||||
</a>
|
||||
</h5>
|
||||
The <a href=https://www.spoofax.dev>Spoofax Language Workbench</a> is an environment for the development of programming languages using high-level declarative meta-languages for syntax, static semantics, dynamic semantics, program analysis, and program transformation. We use Spoofax to implement a compiler and IDE for the project language and in homework assignments to experiment with various aspects of compilers in isolation.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
-->
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="border-top border-light-grey pt-3 mt-0">
|
||||
<div class="card-body pt-0 mt-0 ">
|
||||
<h5 class="card-title">
|
||||
ChocoPy: Project Language
|
||||
</h5>
|
||||
|
||||
In the course project students implement a compiler for <a href=https://chocopy.org/>ChocoPy</a>, a subset of Python3 with static types. The back-end of the compiler generates RISC-V code, which can be run with a simulator running on the JVM. The language comes with a <a href=https://chocopy.org/chocopy_language_reference.pdf>fully specified using formal grammar, typing rules, and operational semantics</a>. ChocoPy was developed at UC Berkeley for their compiler course.
|
||||
<a href="https://chocopy.org/">
|
||||
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
|
||||
<div class="card border-dark mb-3">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">
|
||||
<a href="https://chocopy.org/">
|
||||
|
||||
</a>
|
||||
</h5>
|
||||
In the course project students implement a compiler for <a href=https://chocopy.org/>ChocoPy</a>, a subset of Python3 with static types. The back-end of the compiler generates RISC-V code, which can be run with a simulator running on the JVM. The language comes with a <a href=https://chocopy.org/chocopy_language_reference.pdf>fully specified using formal grammar, typing rules, and operational semantics</a>. ChocoPy was developed at UC Berkeley for their compiler course.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
-->
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="border-top border-light-grey pt-3 mt-0">
|
||||
<div class="card-body pt-0 mt-0 ">
|
||||
<h5 class="card-title">
|
||||
WebLab: Homework Assignments and Exams
|
||||
</h5>
|
||||
|
||||
|
||||
<a href="https://weblab.tudelft.nl/cs4200/2021-2022/">
|
||||
<img style="border:1px solid black; width:100pt; margin-left:10px;" src="img/weblab/WebLabScreenshot2.png" class="float-right card-img" alt="">
|
||||
</a>
|
||||
|
||||
|
||||
We use the WebLab learning management system for homework assignments. In WebLab you can submit answers to exercises with grammars, type systems, and transformations, which we can automatically grade. You can even program the solutions directly in WebLab, but it is probably more convenient at this stage to do that in Spoofax and then copy the solutions. We will also use WebLab for the (online) digital exams for the course. Thus, you will be expected to program in the Spoofax meta-languages at the exam.
|
||||
<a href="https://weblab.tudelft.nl/cs4200/2021-2022/">
|
||||
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
|
||||
<div class="card border-dark mb-3">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">
|
||||
<a href="https://weblab.tudelft.nl/cs4200/2021-2022/">
|
||||
|
||||
</a>
|
||||
</h5>
|
||||
We use the WebLab learning management system for homework assignments. In WebLab you can submit answers to exercises with grammars, type systems, and transformations, which we can automatically grade. You can even program the solutions directly in WebLab, but it is probably more convenient at this stage to do that in Spoofax and then copy the solutions. We will also use WebLab for the (online) digital exams for the course. Thus, you will be expected to program in the Spoofax meta-languages at the exam.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
-->
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="border-top border-grey">
|
||||
<div class="card-body pt-3 mt-0 ">
|
||||
<a href="lectures/index.html">Lectures</a>
|
||||
| <a href="project/index.html">Project</a>
|
||||
| <a href="homework/index.html">Homework</a>
|
||||
| <a href="https://weblab.tudelft.nl/cs4200/2021-2022/">WebLab</a>
|
||||
| <a href="https://www.spoofax.dev/">Spoofax</a>
|
||||
| <a href="https://chocopy.org/">ChocoPy</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row border-top border-bottom border-grey pt-3 mb-3">
|
||||
|
||||
<div class="mb-3 col-sm-12 col-md-12 col-lg-6 col-xl-6 border-lg-right border-grey">
|
||||
|
||||
<div class="pt-0 mb-1 mt-0">
|
||||
<div class="card-body pb-2 pt-1">
|
||||
<h4>Tentative Lecture Schedule CS4200-A/Q1</h4>
|
||||
<p>
|
||||
Lectures are on Thursdays 10:45 - 12:45.
|
||||
</p>
|
||||
</div>
|
||||
<ul class="list-group list-group-flush pt-0 mt-0">
|
||||
|
||||
|
||||
<li class="list-group-item">
|
||||
Sep 2:
|
||||
|
||||
<a href="lecture/1.html">What is a compiler?</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
Sep 3:
|
||||
|
||||
<a href="lecture/2.html">Declarative Syntax Definition (Friday!)</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
Sep 9:
|
||||
|
||||
<a href="lecture/3.html">Disambiguation and Layout Sensitive Syntax</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
Sep 16:
|
||||
|
||||
<a href="lecture/4.html">Type Constraints</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
Sep 23:
|
||||
|
||||
<a href="lecture/5.html">Name Binding Constraints</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
Sep 30:
|
||||
|
||||
<a href="lecture/6.html">Constraint Resolution</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
Oct 7:
|
||||
|
||||
<a href="lecture/7.html">More Constraints and Statix</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
Oct 14:
|
||||
|
||||
<a href="lecture/8.html">Parsing</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
Oct 14:
|
||||
|
||||
<a href="lecture/8b.html">More Parsing</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
Oct 21:
|
||||
|
||||
<a href="lecture/9.html">Summary & Further Study</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
Thu Oct 28, 13:30-16:30:
|
||||
|
||||
Exam Q1
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3 col-sm-12 col-md-12 col-lg-6 col-xl-6">
|
||||
<div class="pt-0 mb-1 mt-0">
|
||||
<div class="card-body pb-2 pt-1 mt-3">
|
||||
<h4>Tentative Lecture Schedule CS4200-B/Q2</h4>
|
||||
<p>
|
||||
Lectures are on Thursdays 10:45 - 12:45. (Note the extra lecture on Friday Sep 4.)
|
||||
</p>
|
||||
</div>
|
||||
<ul class="list-group list-group-flush pt-0 mt-0">
|
||||
|
||||
|
||||
<li class="list-group-item">
|
||||
Nov 11:
|
||||
|
||||
<a href="lecture/10.html">Transformation with Rewrite Rules</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
Nov 18:
|
||||
|
||||
<a href="lecture/11.html">Composing Transformations with Strategy Combinators</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
Nov 25:
|
||||
|
||||
<a href="lecture/12.html">Instruction Sets and Code Generation</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
Dec 2:
|
||||
|
||||
<a href="lecture/13.html">Functions, Calling Conventions, and Code Generation Mechanics</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
Dec 9:
|
||||
|
||||
<a href="lecture/14.html">Nested Functions & Memory Management</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
Dec 16:
|
||||
|
||||
<a href="lecture/15.html">Representing Objects & Register Allocation</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
Dec 23:
|
||||
|
||||
<a href="lecture/16.html">Data-Flow Analysis</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
Jan 13:
|
||||
|
||||
<a href="lecture/17.html">Beyond Compiler Construction</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
Fri Jan 28, 13:30-16:30:
|
||||
|
||||
Exam Q2
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row border-bottom border-grey pt-3 mb-3">
|
||||
<div class="mb-3 col-sm-12 col-md-12 col-lg-8 col-xl-8 border-lg-right border-grey">
|
||||
<div class="mb-3 ">
|
||||
<div class="card-body pb-2 pt-1">
|
||||
<h4>Recorded Talks about Spoofax</h4>
|
||||
</div>
|
||||
<div class="video-container ml-3 mr-3" >
|
||||
<iframe width="560" height="315" src="https://www.youtube.com/embed/videoseries?list=PLCmRbWMnTaz_XoF823mqmpa65DTliH6tE" frameborder="0" allow="accelerometer; encrypted-media; gyroscope; picture-in-picture" allowfullscreen align="center"></iframe>
|
||||
</div>
|
||||
<div class="ml-3 mr-3">
|
||||
<small>
|
||||
A <a href="https://www.youtube.com/playlist?list=PLCmRbWMnTaz_XoF823mqmpa65DTliH6tE">YouTube Playlist</a> with recordings of tutorials and research talks about (research related to) the <a href="http://metaborg.org">Spoofax Language Workbench</a>.
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- <div class="mb-2">
|
||||
<div class="card-body pb-2 pt-1">
|
||||
<h4>Upcoming Events</h4>
|
||||
</div>
|
||||
<ul class="list-group list-group-flush">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="mb-2">
|
||||
<div class="card-body pt-1 pb-2">
|
||||
<h4>Latest News</h4>
|
||||
</div>
|
||||
<ul class="list-group list-group-flush">
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item">
|
||||
<p class="mb-1">Migrated website to 2021-2021 academic year.</p>
|
||||
<small class="text-secondary">August 27, 2021</small>
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
<p class="mb-1">Homework and project assignments about type constraints available</p>
|
||||
<small class="text-secondary">September 21, 2020</small>
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
<p class="mb-1">Homework assignments about disambiguation available</p>
|
||||
<small class="text-secondary">September 14, 2020</small>
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
<p class="mb-1">The recording of today's lecture is available on Brightspace.</p>
|
||||
<small class="text-secondary">September 03, 2020</small>
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
<p class="mb-1">Introduction lecture <a href=/lectures/2020/09/03/introduction/>What is a compiler?</a> on Thursday, September 3, 10:45 - 12:45. Online venue will be announced on Brightspace.</p>
|
||||
<small class="text-secondary">August 31, 2020</small>
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
<p class="mb-1">A new website for the compiler construction course</p>
|
||||
<small class="text-secondary">August 31, 2020</small>
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
<p class="mb-1">The website of the course in 2019 is at <a href=https://tudelft-cs4200-2019.github.io/>tudelft-cs4200-2019.github.io</a></p>
|
||||
<small class="text-secondary">August 31, 2020</small>
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
<a href="/news/">Archive</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div> -->
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</main>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
414
lab/0.html
Normal file
|
|
@ -0,0 +1,414 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Rules for the Course Project</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
<a class="text-dark" href="https://weblab.tudelft.nl/cs4200/2021-2022/rules">
|
||||
Rules for the Course Project
|
||||
</a>
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
<a class="text-primary" href="https://weblab.tudelft.nl/cs4200/2021-2022/rules">
|
||||
Project Rules
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
September 01, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<h2 id="submission">Submission</h2>
|
||||
|
||||
<p>We rely on GitLab for project assignment submissions. We assign a private GitLab repository to each student and encourage students to commit and push their work frequently.</p>
|
||||
|
||||
<ul>
|
||||
<li>To submit your assignment, you need to file a merge request. There are two kinds of submissions.</li>
|
||||
<li>To check your progress on an assignment, you can submit a <em>preliminary solution</em>. We will provide limited feedback on preliminary solutions. This feedback typically comes with a tentative grade and points out areas where your solution is incomplete or insufficient, without giving any details on the reasons.</li>
|
||||
<li>To submit your solution for grading, you need to submit a <em>final solution</em>. As the name suggests, you cannot submit another final solution for the same assignment.
|
||||
We will provide a detailed grading report on final solutions. To ensure fairness and equal chances for all students, grading reports will not be published before 2 days after the submission deadline. We do our best to hand out grading reports as quick as possible, but manual grading can be tedious and might result in longer waiting times for some assignments.</li>
|
||||
</ul>
|
||||
|
||||
<h2 id="grades">Grades</h2>
|
||||
|
||||
<p>We grade the first final solution of each of your assignments. Grades reflect on correctness, clarity, shown programming skills, and readability of your submission. To pass the practical part of the course, you need to meet all of the following criteria:</p>
|
||||
|
||||
<ol>
|
||||
<li>You completed each assignment with a grade of 4.0 or better.</li>
|
||||
<li>You completed the assignments of each milestone with an average grade of 5.0 or better.</li>
|
||||
<li>You completed all the assignments with an average grade of 6.0 better.</li>
|
||||
</ol>
|
||||
|
||||
<p>These rules allow you to compensate for lower grades in single assignments, but ensure a minimal quality in all your milestones as well as in your overall practical work.</p>
|
||||
|
||||
<h2 id="deadlines">Deadlines</h2>
|
||||
|
||||
<p>Assignments must be submitted by the published deadline. You get a standard deadline extension of 48 hours with a penalty of 2 grade points computed proportionally to the amount of extra time you use.</p>
|
||||
|
||||
<p>If you think you cannot meet deadlines due to special personal circumstances, you should contact the academic counsellor. Together we will try to find an individual solution for you. Remember to contact the academic counsellor as soon as possible, once you become aware of your situation. Otherwise, you might lose your chance for a deadline extension.</p>
|
||||
|
||||
<h2 id="academic-misconduct">Academic Misconduct</h2>
|
||||
|
||||
<ul>
|
||||
<li>All actual, detailed work on assignments must be <strong>individual work</strong>.</li>
|
||||
<li>You are encouraged to discuss assignments, programming languages used to solve the assignments, their libraries, and general solution techniques in these languages with each other. If you do so, then you must <strong>acknowledge</strong> the people with whom you discussed at the top of your submission.</li>
|
||||
<li>You should not look for assignment solutions elsewhere; but if material is taken from elsewhere, then you must <strong>acknowledge</strong> its source.</li>
|
||||
<li>You are not permitted to provide or receive any kind of solutions of assignments. This includes partial, incomplete, or erroneous solutions.</li>
|
||||
<li>You are also not permitted to provide or receive programming help from people other than the teaching assistants, PhD students associated with this course, or the course manager.</li>
|
||||
</ul>
|
||||
|
||||
<p>Any violation of these rules will be reported as a suspected case of fraud to the Board of Examiners and handled according to the EEMCS Faculty’s fraud procedure. If the case is proven, a penalty will be imposed: a minimum of exclusion from the course for the duration of one academic year up to a maximum of a one-year exclusion form all courses at TU Delft. For details on the procedure, see Section 2.1.26 in the faculty’s Study Guide for MSc Programmes.</p>
|
||||
|
||||
<h2 id="retry">Retry</h2>
|
||||
|
||||
<p>To ensure fairness and equal chances for all students, you are not allowed to take the same practical assignments in another edition of this course. In case you participated in previous editions of the course, please contact the course manager to discuss an individual assignment.</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="0a.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<ul id="my_toc" class="toc list-group list-group-flush d-none d-lg-block d-xl-block p-0 ml-0 mt-3">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="0.html#submission">Submission</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="0.html#grades">Grades</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="0.html#deadlines">Deadlines</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="0.html#academic-misconduct">Academic Misconduct</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="0.html#retry">Retry</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="0a.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
1020
lab/0a.html
Normal file
379
lab/0b.html
Normal file
|
|
@ -0,0 +1,379 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Lab 0(b): Registering Your Project</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
<a href="https://tudelft-cs4200.github.io/2021">
|
||||
<img class="border border-dark" width="100%" src="../project/2021/00-lab0b/netid.png"/>
|
||||
</a>
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
<a class="text-dark" href="https://weblab.tudelft.nl/cs4200/2021-2022/assignment/87898/view">
|
||||
Lab 0(b): Registering Your Project
|
||||
</a>
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
<a class="text-primary" href="https://weblab.tudelft.nl/cs4200/2021-2022/assignment/87898/view">
|
||||
WebLab
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
September 03, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<p>We use the Git version control system with https://gitlab.ewi.tudelft.nl to manage submissions and grade assignments. You can access EWI GitLab with you NetID.</p>
|
||||
|
||||
<p>To setup your individual repository, we need to know your NetID. Please provide it in your answer to <a href="https://weblab.tudelft.nl/cs4200/2021-2022/assignment/87898/view">this question</a> on WebLab. If your GitLab username is different than your NetID, provide it in your answer too.</p>
|
||||
|
||||
<p>If you are in doubt about your answer, check the model answer by clicking the A button in the top right corner.</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="0a.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1a.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="0a.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1a.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
503
lab/10.html
Normal file
|
|
@ -0,0 +1,503 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Lab 10: Instruction Selection</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Lab 10: Instruction Selection
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Project
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
November 26, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<p>See the slides of <a href="../lecture/12.html">Lecture 12</a> on code generation for an approach to get started.</p>
|
||||
|
||||
<h3 id="objectives">Objectives</h3>
|
||||
|
||||
<ol>
|
||||
<li>
|
||||
<p>Develop tests for your compiler that explore the edge cases.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Define a transformation strategy that translates ChocoPy expressions to RISC-V code, including variable definitions, integer and boolean constants and operators.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Develop a simplification transformation that transforms expressions such that more concise code can be generated.</p>
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<h3 id="basic-compiler-pipeline">Basic Compiler Pipeline</h3>
|
||||
|
||||
<p>Follow the slides of <a href="../lecture/12.html">Lecture 12</a> to set up a basic compiler pipeline:</p>
|
||||
|
||||
<pre><code class="language-stratego:"> compile-to-rv32im-ast :: Program -> RProgram
|
||||
|
||||
compile-to-rv32im-ast =
|
||||
compile-cpy-to-cir
|
||||
; compile-cir-to-rv32im
|
||||
; compile-rv32im
|
||||
|
||||
</code></pre>
|
||||
|
||||
<h4 id="debugging">Debugging</h4>
|
||||
|
||||
<p>Use <code class="language-plaintext highlighter-rouge">debug(!msg)</code> or <code class="language-plaintext highlighter-rouge">dbg(|msg)</code> to print the current term to the console.</p>
|
||||
|
||||
<p>You can also debug your generated code, by creating a <code class="language-plaintext highlighter-rouge">.cpy</code> file, transforming it to an <code class="language-plaintext highlighter-rouge">.rv32im</code> file using the <code class="language-plaintext highlighter-rouge">Spoofax > Generation</code> menu, and copying the generated output to the online Venus editor, where you can use the <code class="language-plaintext highlighter-rouge">Simulator</code> tab to run your code or step through each line, and inspect the memory and registers.</p>
|
||||
|
||||
<h3 id="from-chocopy-to-c-ir">From ChocoPy to C-IR</h3>
|
||||
|
||||
<p>Develop a first compilation phase to transform ChocoPy programs to an intermediate language that makes control flow explicit.</p>
|
||||
|
||||
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code> compile-cpy-to-cir :: Program -> CProgram
|
||||
|
||||
compile-cpy-to-cir =
|
||||
explicate-types
|
||||
; desugar
|
||||
; uniquify
|
||||
; remove-complex-operands
|
||||
; explicate-control
|
||||
</code></pre></div></div>
|
||||
|
||||
<h4 id="explicate-types">Explicate Types</h4>
|
||||
|
||||
<p>A useful transformation is to type specialize the constructors of the AST, such that the analysis results are no longer needed.
|
||||
That is useful when applying transformations, since preserving those annotations cannot be done for all transformations.
|
||||
<strong>The following <code class="language-plaintext highlighter-rouge">explicate-types</code> transformation should be invoked on the AST before invoking the compiler transformation.</strong></p>
|
||||
|
||||
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>signature
|
||||
constructors
|
||||
AddInt : Exp * Exp -> Exp
|
||||
|
||||
rules
|
||||
|
||||
explicate-types =
|
||||
innermost(type-specialize)
|
||||
|
||||
type-specialize :
|
||||
add@Add(e1, e2) -> AddInt(e1, e2)
|
||||
where <get-type> add => Int()
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Note that the rules for translating integer additions should be adapted to reflect the change in constructors.</p>
|
||||
|
||||
<h4 id="desugar">Desugar</h4>
|
||||
|
||||
<p>To improve the result of code generation, it can be useful to transform the source language expression.
|
||||
For example, left-associative additions may produce a better result.</p>
|
||||
|
||||
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code> desugar-exp :
|
||||
AddInt(e1, AddInt(e2, e3)) -> AddInt(AddInt(e1, e2), e3)
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Define a transformation to <code class="language-plaintext highlighter-rouge">desugar</code> ChocoPy programs, making the task of downstream compilation easier.</p>
|
||||
|
||||
<p>This simplification can include constant folding, eventually.
|
||||
However, do not yet include constant folding rules, since you want to test the translation of operators.
|
||||
That is, your code generator should be able to translate arbitrary combinations of operators, so be prepared for the general case.</p>
|
||||
|
||||
<p>Think about (and try out in the online compiler!) the differences between adding integers and concatenating strings in RISC-V. In ChocoPy, they initially both use the <code class="language-plaintext highlighter-rouge">Add(...)</code> constructor, so make sure to disambiguate them into separate constructors you will later use for code generation. The same holds for other operations, but you have to think about those yourself.</p>
|
||||
|
||||
<h4 id="uniquify">Uniquify</h4>
|
||||
|
||||
<p>Define a transformation that eliminates shadowing. (See slides)</p>
|
||||
|
||||
<h4 id="remove-complex-operands">Remove Complex Operands</h4>
|
||||
|
||||
<p>To simplify instruction selection, simplify expressions to only use atomic expressions (constants or variables) creating new variables to store intermediate results.</p>
|
||||
|
||||
<h4 id="explicate-control-using-c-ir">Explicate Control using C-IR</h4>
|
||||
|
||||
<p>Use an intermediate language to explicate control.
|
||||
That is, the <code class="language-plaintext highlighter-rouge">explicate-control</code> strategy translates from ChocoPy ASTs</p>
|
||||
|
||||
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>signature
|
||||
sorts CID CINT CProgram CBlock CLabel CTail CStmt
|
||||
CType CExp CAtom CVar
|
||||
constructors
|
||||
: string -> CID
|
||||
: string -> CINT
|
||||
CProgram : List(CBlock) -> CProgram
|
||||
CBlock : CLabel * CTail -> CBlock
|
||||
CLabel : CID -> CLabel
|
||||
CReturn : CExp -> CTail
|
||||
CReturnNone : CTail
|
||||
CSeq : CStmt * CTail -> CTail
|
||||
CVarDec : CVar * CType * CExp -> CStmt
|
||||
CAssign : CVar * CExp -> CStmt
|
||||
CIntT : CType
|
||||
: CAtom -> CExp
|
||||
CMin : CAtom -> CExp
|
||||
CAdd : CAtom * CAtom -> CExp
|
||||
CMul : CAtom * CAtom -> CExp
|
||||
CDiv : CAtom * CAtom -> CExp
|
||||
CInt : CINT -> CAtom
|
||||
: CVar -> CAtom
|
||||
CVar : CID -> CVar
|
||||
</code></pre></div></div>
|
||||
|
||||
<h3 id="instruction-selection">Instruction Selection</h3>
|
||||
|
||||
<p>Define a transformation from C-IR to RISC-V instructions:</p>
|
||||
|
||||
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code> compile-cir-to-rv32im :: CProgram -> RProgram
|
||||
|
||||
compile-cir-to-rv32im =
|
||||
select-instructions-cprogram
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>The essence of this translation consists of instruction selection, i.e. mapping the high-level instructions of the intermediate language to concrete RISC-V instructions.
|
||||
For example, register allocation for integer constants, variables, and addition may be defined as follows:</p>
|
||||
|
||||
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code> select-instrs-exp(|RArg) :: CExp -> List(RLine)
|
||||
|
||||
select-instrs-exp(|x) :
|
||||
CInt(i) -> [RLi(x, <cint-to-rint>i)]
|
||||
|
||||
select-instrs-exp(|x) :
|
||||
CVar(y) -> [RMv(x, RVar(<cid-to-string>y))]
|
||||
|
||||
select-instrs-exp(|x) :
|
||||
CAdd(y@CVar(_), z@CVar(_)) -> [RAdd(x, <cvar-to-rvar>y, <cvar-to-rvar>z)]
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Note that because expressions have been transformed to applications of operators to atomic expressions, this step does not need to invent names for intermediate results.
|
||||
We use <code class="language-plaintext highlighter-rouge">RVar(x)</code> as symbolic registers in RISC-V code in order to postpone the mapping to concrete registers.</p>
|
||||
|
||||
<p>Define transformation rules for all operators of ChocoPy expressions.</p>
|
||||
|
||||
<h4 id="special-cases">Special Cases</h4>
|
||||
|
||||
<p>RISC-V provides specialized instructions for some operations.
|
||||
For example, the <code class="language-plaintext highlighter-rouge">addi</code> instruction allows directly adding an integer constant (between -2048 and 2047) to a register.
|
||||
A compiler can make use of such instructions, by detecting special patterns in the source language.
|
||||
For example, the following rule, detects additions with an integer constant, and translates those to applications of <code class="language-plaintext highlighter-rouge">addi</code>, avoiding the use of an extra register.</p>
|
||||
|
||||
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>select-instrs-exp(|x) :
|
||||
CAdd(z@CVar(_), CInt(i)) -> [RAddi(x, <cvar-to-rvar>z, <cint-to-rint>i)]
|
||||
with debug(!"select-instrs-exp: ")
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Can you detect other specialized instructions and corresponding source language patterns that provide a more concise and/or faster target code?</p>
|
||||
|
||||
<h4 id="booleans">Booleans</h4>
|
||||
|
||||
<p>In ChocoPy we compile the Booleans <code class="language-plaintext highlighter-rouge">True</code> and <code class="language-plaintext highlighter-rouge">False</code> to integers in RISC-V (<code class="language-plaintext highlighter-rouge">1</code> and <code class="language-plaintext highlighter-rouge">0</code>, respectively).
|
||||
Implement the Boolean operators <code class="language-plaintext highlighter-rouge">and</code>, <code class="language-plaintext highlighter-rouge">or</code> and <code class="language-plaintext highlighter-rouge">not</code>, and integer comparison operators <code class="language-plaintext highlighter-rouge">==</code>, <code class="language-plaintext highlighter-rouge">!=</code>, <code class="language-plaintext highlighter-rouge"><</code>, <code class="language-plaintext highlighter-rouge">></code>, <code class="language-plaintext highlighter-rouge"><=</code>, <code class="language-plaintext highlighter-rouge">>=</code> (you can ignore <code class="language-plaintext highlighter-rouge">is</code> for now since it operates on objects).</p>
|
||||
|
||||
<p>You can make use of the online compiler, or the RISC-V instruction set to find the proper instructions in RISC-V.</p>
|
||||
|
||||
<!-- Also implement the ternary operator `... if ... else ...`. (See [Short-circuit Boolean operations](#shortcircuit) to get an idea on how to implement it.) -->
|
||||
|
||||
<h3 id="patching-risc-v-instructions">Patching RISC-V instructions</h3>
|
||||
|
||||
<p>Finally, we define a compiler stage that patches up the RISC-V code:</p>
|
||||
|
||||
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code> compile-rv32im :: RProgram -> RProgram
|
||||
|
||||
compile-rv32im =
|
||||
assign-homes
|
||||
; patch-instructions
|
||||
</code></pre></div></div>
|
||||
|
||||
<h4 id="assign-homes">Assign Homes</h4>
|
||||
|
||||
<p>Map symbolic registers to concrete registers.
|
||||
Either by mapping variables to actual registers or by using a stack discipline.
|
||||
We will look at register allocation next, so keep it simple.</p>
|
||||
|
||||
<h4 id="patch-instructions">Patch Instructions</h4>
|
||||
|
||||
<p>This is the place for any mopping up that needs to be done.</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="9.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="11.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<ul id="my_toc" class="toc list-group list-group-flush d-none d-lg-block d-xl-block p-0 ml-0 mt-3">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="10.html#objectives">Objectives</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="10.html#basic-compiler-pipeline">Basic Compiler Pipeline</a>
|
||||
<ul class="toc-sub pl-0">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="10.html#debugging">Debugging</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="10.html#from-chocopy-to-c-ir">From ChocoPy to C-IR</a>
|
||||
<ul class="toc-sub pl-0">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="10.html#explicate-types">Explicate Types</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="10.html#desugar">Desugar</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="10.html#uniquify">Uniquify</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="10.html#remove-complex-operands">Remove Complex Operands</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="10.html#explicate-control-using-c-ir">Explicate Control using C-IR</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="10.html#instruction-selection">Instruction Selection</a>
|
||||
<ul class="toc-sub pl-0">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="10.html#special-cases">Special Cases</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="10.html#booleans">Booleans</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="10.html#patching-risc-v-instructions">Patching RISC-V instructions</a>
|
||||
<ul class="toc-sub pl-0">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="10.html#assign-homes">Assign Homes</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="10.html#patch-instructions">Patch Instructions</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="9.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="11.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
644
lab/11.html
Normal file
|
|
@ -0,0 +1,644 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Lab 11: Implementing Register Allocation and Control Flow</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Lab 11: Implementing Register Allocation and Control Flow
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Project
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
December 03, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<h2 id="register-allocation">Register Allocation</h2>
|
||||
|
||||
<p>In this lab you implement register allocation taking the implementation from the slides as basis.</p>
|
||||
|
||||
<h3 id="liveness-analysis">Liveness Analysis</h3>
|
||||
|
||||
<p>Implement liveness analysis to determine when (at what instructions) variables are live.
|
||||
Extend the analysis to deal with control flow and loops.
|
||||
This requires a fixed point analysis.</p>
|
||||
|
||||
<h3 id="graph-coloring">Graph Coloring</h3>
|
||||
|
||||
<p>Next implement register allocation bases on the outcome of the liveness analysis.
|
||||
Use the priority queue data structure to represent the interference graph with the nodes representing variables with the most inference listed first.
|
||||
Coloring the graph with a limited number of registers.
|
||||
How do you treat spilling variables to memory?</p>
|
||||
|
||||
<h2 id="control-flow">Control Flow</h2>
|
||||
|
||||
<p>Extend the fragment of the language that is supported by your compiler with control-flow constructs such as if-then-else and booleans.</p>
|
||||
|
||||
<h3 id="desugaring">Desugaring</h3>
|
||||
|
||||
<p>Define desugaring rules to reduce the number of constructs that the downstream compiler has to deal with.
|
||||
Consider whether or for which language constructs this is worthwhile; the target machine may have instructions that correspond directly to the source language operators.</p>
|
||||
|
||||
<h3 id="explicating-control-translation-to-c-ir">Explicating Control: Translation to C-IR</h3>
|
||||
|
||||
<p>Translate the recursive expressions for control flow in ChocoPy to jumps in the control flow graph.</p>
|
||||
|
||||
<h3 id="instruction-selection">Instruction Selection</h3>
|
||||
|
||||
<p>Translate to RISC-V instructions.</p>
|
||||
|
||||
<!-- In this lab you extend your ChocoPy code generator with translation of function definitions and function calls.
|
||||
|
||||
See the slides of [Lecture 13](/2021/lecture/13) on code generation mechanics and the [ChocoPy v2.2: RISC-V Implementation Guide](https://chocopy.org/chocopy_implementation_guide.pdf) for an explanation of the calling convention for ChocoPy.
|
||||
|
||||
### Objectives
|
||||
|
||||
1. Compiling functions
|
||||
- Compiling function definitions according to calling convention
|
||||
- Compiling variables referring to formal parameters and local variables
|
||||
- Generate code for function calls according to calling convention
|
||||
- Define a transformation that lifts nested function calls to top-level assignment statements.
|
||||
2. Integrate the execution environment
|
||||
3. Challenges
|
||||
- Optimize generated code
|
||||
- Alternative calling conventions
|
||||
|
||||
### Context-Sensitive Transformation
|
||||
|
||||
In the previous lab you used rewrite rules to transform source ASTs to target ASTs.
|
||||
The transformations were context-free. That is, an addition operation can be translated without any information about the context in which it appears.
|
||||
This is not the case for transformations in a compiler.
|
||||
For example, compiling a variable in an expression requires knowing where it is stored on the stack, i.e. its offset from the frame pointer.
|
||||
|
||||
The slides of [Lecture 13](/2021/lecture/13) introduce the use of dynamic rewrite rules in Stratego to implement such context-sensitive transformations. See the paper by Bravenboer et al. (2006) referenced on the lecture page for an overview, including applications of dynamic rules.
|
||||
We discuss some examples here that may be useful for your compiler.
|
||||
|
||||
#### Dynamic Rewrite Rules
|
||||
|
||||
A dynamic rewrite rule in Stratego is like a normal rewrite rule, but it is generated at run-time (dynamically) and some of its variables are bound in the context of its definition.
|
||||
For example, consider the following definition of a constant propagation transformation strategy that propagates assignments of constants to variables to uses of those variables (in straight-line code):
|
||||
|
||||
```
|
||||
rules
|
||||
|
||||
prop-const =
|
||||
PropConst
|
||||
<+ prop-const-assign
|
||||
<+ (all(prop-const); try(eval))
|
||||
|
||||
prop-const-assign =
|
||||
Assign([Target(?x)], prop-const => e)
|
||||
; if <is-value> e
|
||||
then rules( PropConst : Var(x) -> e )
|
||||
else rules( PropConst :- Var(x) )
|
||||
end
|
||||
|
||||
eval : Add(Int(i), Int(j)) -> Int(<addS>(i, j))
|
||||
|
||||
is-value = ?Int(_)
|
||||
```
|
||||
|
||||
The construct `rules( PropConst : Var(x) -> e )` generates a new dynamic rule for the specific values of `x` and `e` found in the context.
|
||||
Thus, if `PropConst` is later applied to a concrete variable for which a rule has been defined, it is replaced with the corresponding right-hand side.
|
||||
If a different rule had been defined previously for `Var(x)`, the new rule overwrites the old one.
|
||||
|
||||
The construct `rules( PropConst :- Var(x) )` undefines all dynamic `PropConst` rules for `Var(x)`.
|
||||
|
||||
We discuss some examples of applications of dynamic rules that can be useful in your compiler.
|
||||
|
||||
#### Keeping Track of the Stack
|
||||
|
||||
Dynamic rules can be used to implement a counter. For example, the following rules keep track of stack offsets:
|
||||
|
||||
```
|
||||
rules
|
||||
|
||||
stack-set(|n) =
|
||||
rules(Stack : () -> n); !n
|
||||
|
||||
stack-get =
|
||||
<Stack>() <+ !0
|
||||
|
||||
stack-inc(|n) =
|
||||
stack-set(|<add>(<stack-get>, n))
|
||||
```
|
||||
|
||||
Dynamic rules can be scoped using the construct `{| L : s}`, where `L` is the label of the dynamic rule. For example, the stack rules above can be used in a transformation to generate subsequent stack offset and at end retrieve the total offset needed:
|
||||
|
||||
```
|
||||
{| Stack
|
||||
: stack-set(|0)
|
||||
; <some-transformation> t => instrs
|
||||
; size := <stack-get>
|
||||
|}
|
||||
```
|
||||
|
||||
After leaving the scope, all definitions for `Stack` in the scope are eliminated and the value before the scope is available again. For example,
|
||||
the code
|
||||
|
||||
```
|
||||
stack-set(|10)
|
||||
; debug(!"stack: ")
|
||||
; {| Stack
|
||||
: stack-set(|20)
|
||||
; debug(!"stack: ")
|
||||
|}
|
||||
; stack-get
|
||||
; debug(!"stack: ")
|
||||
```
|
||||
|
||||
will print
|
||||
|
||||
```
|
||||
stack: 10
|
||||
stack: 20
|
||||
stack: 10
|
||||
```
|
||||
|
||||
#### Binding Variable Offsets
|
||||
|
||||
Another application of dynamic rules is to distribute contex-sensitive information about bindings. For example, the following rules bind an offset with respect to the framepointer to a variable name:
|
||||
|
||||
```
|
||||
rules
|
||||
|
||||
var-offset-set(|x, n) =
|
||||
rules(VarOffset : x -> n)
|
||||
|
||||
var-offset-get :
|
||||
x -> n
|
||||
with <VarOffset> x => n
|
||||
```
|
||||
|
||||
This can be used in handling the formal parameters of a function to associate with parameter the next offset in the stack:
|
||||
|
||||
```
|
||||
rules
|
||||
fun-arg :
|
||||
TypedVar(x, t) -> offset
|
||||
with var-offset-set(|x, <stack-get => offset>)
|
||||
with stack-inc(|4)
|
||||
```
|
||||
|
||||
Then, when translating a variable, the dynamic rule can be used to lookup its offset:
|
||||
|
||||
```
|
||||
rules
|
||||
exp-to-instrs-(|r, regs) :
|
||||
Var(x) -> [Lw(r, <int-to-string>offset, "fp")]
|
||||
with <var-offset-get>x => offset
|
||||
``` -->
|
||||
|
||||
<!-- #### Collecting Information
|
||||
|
||||
```
|
||||
rules
|
||||
|
||||
transform :
|
||||
Foo(x, y) -> Bar(x)
|
||||
where rules( Collect :+ )
|
||||
|
||||
``` -->
|
||||
|
||||
<!--
|
||||
### Compiling Functions
|
||||
|
||||
The main objective of this lab is to implement the compilation of function definitions and function calls.
|
||||
We illustrate the process with the following example ChocoPy program:
|
||||
|
||||
```
|
||||
def callee(x : int, y : int, z: int) -> int:
|
||||
a : int = 1
|
||||
b : int = 2
|
||||
return x + y + z + a + b
|
||||
|
||||
def caller():
|
||||
d : int = 0
|
||||
d = callee(345, 4357, 235)
|
||||
```
|
||||
|
||||
#### Compiling Function Definitions
|
||||
|
||||
Compiling a function definition consists of generating code for setting up and breaking down an activation record (aka call frame).
|
||||
This process follows a calling convention such that caller and callee agree about how to pass arguments to and return results from function calls.
|
||||
The process starts with advancing the stack pointer register `sp` so that the call frame has enough space for the local variables and tempories in the call.
|
||||
Then, the return address (`ra`) and frame pointer (`fp`) registers are saved in the call frame so that they are not overwritten on subsequent calls.
|
||||
Next, the local variables are initialized.
|
||||
This is followed by the computation of the body of the function, leaving the return value in the `a0` register.
|
||||
Finally, the return address and frame pointer registers are restored, and the function jumps to the return address.
|
||||
|
||||
The function `callee` above is translated as follows:
|
||||
|
||||
```
|
||||
.globl $callee
|
||||
$callee:
|
||||
addi sp, sp, -@callee.size # reserve space for stack frame
|
||||
sw ra, @callee.size-4(sp) # save return address
|
||||
sw fp, @callee.size-8(sp) # save control link (fp)
|
||||
sw fp, @callee.size(sp) # new fp is at old SP
|
||||
li a0, 1 # initialize local variable a
|
||||
sw a0, -16(fp)
|
||||
li a0, 2 # initialize local variable b
|
||||
sw a0, -12(fp)
|
||||
lw a0, 8(fp) # load argument x
|
||||
lw t0, 4(fp) # load argument y
|
||||
add a0, a0, t0 # x + y
|
||||
lw t0, 0(fp) # load argument z
|
||||
add a0, a0, t0 # (x + y) + z
|
||||
lw t0, -16(fp) # load local variable a
|
||||
add a0, a0, t0 # (x + y + z) + a
|
||||
lw t0, -12(fp) # load local variable b
|
||||
add a0, a0, t0 # (x + y + z + a) + b
|
||||
j label_47
|
||||
mv a0, zero
|
||||
j label_47
|
||||
label_47:
|
||||
.equiv @callee.size, 16
|
||||
lw ra, -4(fp) # restore return address
|
||||
lw fp, -8(fp) # restore frame pointer
|
||||
addi sp, sp, @callee.size # restore stack pointer
|
||||
jr ra # return to caller
|
||||
```
|
||||
|
||||
In this translation you should compute the size of the stack frame needed to hold all local variables, temporaries, return address, and frame pointer
|
||||
|
||||
#### Compiling Variables
|
||||
|
||||
To compile variables bind the stack offsets of formal parameters and local variables and transfer these offsets from definition site to use site. (See the discussion about dynamic rewrite rules above.)
|
||||
Given these offsets using a variable and updating a variable is a matter of loading the variable from the stack into a register (see the `lw` instructions in the code above), and storing the value a register into the stack (see the `sw` instructions in the code above).
|
||||
|
||||
#### Compiling Function Calls
|
||||
|
||||
Executing a function call requires computing the values of the actual parameters and transferring these to the code of the function following the calling convention.
|
||||
The default ChocoPy calling convention is to pass arguments on the stack _in the same order as the function expects them_.
|
||||
|
||||
For example, the following ChocoPy function call
|
||||
|
||||
```
|
||||
def caller():
|
||||
d : int = 0
|
||||
d = callee(345, 4357, 235)
|
||||
```
|
||||
|
||||
is translated to the following RISC-V code:
|
||||
|
||||
```
|
||||
.globl $caller
|
||||
$caller:
|
||||
addi sp, sp, -@caller.size
|
||||
sw ra, @caller.size-4(sp)
|
||||
sw fp, @caller.size-8(sp)
|
||||
sw fp, @caller.size(sp)
|
||||
li a0, 0 # initialize local variable d
|
||||
sw a0, -12(fp)
|
||||
sw sp, -12(sp) # reserve space for arguments
|
||||
li a0, 345 # evaluate first argument
|
||||
sw a0, 12(sp) # push on stack
|
||||
li a0, 4357 # evaluate second argument
|
||||
sw a0, 8(sp) # push on stack
|
||||
li a0, 235 # evaluate third argument
|
||||
sw a0, 4(sp) # push on stack
|
||||
jal $callee # call function
|
||||
sw sp, 12(sp) # clean up stack
|
||||
sw a0, -12(fp) # return value in a0
|
||||
j label_48
|
||||
mv a0, zero
|
||||
j label_48
|
||||
label_48:
|
||||
.equiv @caller.size, 12
|
||||
lw ra, -4(fp)
|
||||
lw fp, -8(fp)
|
||||
addi sp, sp, @caller.size
|
||||
jr ra
|
||||
```
|
||||
|
||||
#### Lifting Nested Function Calls
|
||||
|
||||
When using registers to store the intermediate values of an expression, a function call in the middle of such an expression may overwrite such registers.
|
||||
One approach for avoiding this is to lift function calls to the top-level statements in the context.
|
||||
For example, the nested call to `inc` in the following function
|
||||
|
||||
```
|
||||
def caller():
|
||||
d : int = 0
|
||||
d = callee(345 + 81 + inc(13), 4357, 235)
|
||||
```
|
||||
|
||||
can be lifted to top-level using an extra local variable:
|
||||
|
||||
```
|
||||
def caller( ) :
|
||||
d : int = 0
|
||||
temp_2 : int = 0
|
||||
temp_2 = inc(13)
|
||||
d = callee(345 + 81 + temp_2, 4357, 235)
|
||||
```
|
||||
|
||||
Define a transformation that lifts nested functions to top-level.
|
||||
You can use `<newname> "temp_"` to generate a unique new name.
|
||||
|
||||
#### Execution Environment
|
||||
|
||||
The ChocoPy language includes an execution envionrment consisting of a suite of standard functions such as `print`.
|
||||
We provide implementations of these functions as a set of Stratego strategies in the project template.
|
||||
Integrate this execution environment in the code your compiler generates.
|
||||
|
||||
### Challenges
|
||||
|
||||
#### Challenge: Optimizing Generated Code
|
||||
|
||||
Generating code in a systematic way will generate combinations of instructions that are not very efficient.
|
||||
For example, storing a register on the stack only to retrieve it from the stack in the next instruction.
|
||||
As a challenge, consider avoiding to generate such instructions or to transform the generated code
|
||||
|
||||
#### Challenge: Alternative Calling Convention
|
||||
|
||||
The ChocoPy calling convention uses the stack to pass all arguments to functions. Design an alternative calling convention that passes the first `n` arguments via registers (for some small value of `n`). For functions with few arguments or that doesn't call other functions, this may be quite efficient. (But if a function calls another function, it may end saving the registers on the stack after all.)
|
||||
|
||||
|
||||
### Challenges
|
||||
|
||||
#### Running out of registers
|
||||
|
||||
The approach sketched above does not generalize to arbitrary expressions.
|
||||
Create test cases that require more temporary registers than are available.
|
||||
|
||||
Start thinking about solutions for this limitation. Two standard solutions are using the stack for temporaries (which is slow since it involves writing to and reading from memory), and register allocation (which requires a program analysis on the generated code).
|
||||
|
||||
#### <a name="shortcircuit"></a>Short-circuit Boolean operations.
|
||||
|
||||
When encountering a Boolean operation of the form `False and ...`, do we really care about the right side of the operator? Similarly, when we encounter `True or ...`?
|
||||
|
||||
Think about how we can use conditional jumps in RISC-V to short-circuit (any) Boolean operators. Have a look at the instruction set and online compiler.
|
||||
|
||||
A conditional jump in RISC-V takes a label, which represents an address in memory. In Stratego, labels can be generated using `<newname> "L" => label`. (Note that `"L"` can be anything you want, as long as it is a string.) -->
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="10.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="12.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<ul id="my_toc" class="toc list-group list-group-flush d-none d-lg-block d-xl-block p-0 ml-0 mt-3">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="11.html#register-allocation">Register Allocation</a>
|
||||
<ul class="toc-sub pl-0">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="11.html#liveness-analysis">Liveness Analysis</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="11.html#graph-coloring">Graph Coloring</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="11.html#control-flow">Control Flow</a>
|
||||
<ul class="toc-sub pl-0">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="11.html#desugaring">Desugaring</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="11.html#explicating-control-translation-to-c-ir">Explicating Control: Translation to C-IR</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="11.html#instruction-selection">Instruction Selection</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="10.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="12.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
486
lab/12.html
Normal file
|
|
@ -0,0 +1,486 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Lab 12: Loops & Functions</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Lab 12: Loops & Functions
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Project
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
December 10, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<h2 id="while-loops">While Loops</h2>
|
||||
|
||||
<p>Extend your compiler to generate code for while loops.
|
||||
Remember to extend liveness analysis to cater for loops.
|
||||
That is, there may be multipe blocks that jump to a block.
|
||||
This requires that the analysis performs a fixpoint computation.</p>
|
||||
|
||||
<h2 id="functions">Functions</h2>
|
||||
|
||||
<p>Extend your compiler to generate code for functions.
|
||||
To cater for nested functions, you should pass a pointer to the call frame to the lecically enclosing function (a so called static link).
|
||||
Note that the static link may <em>not</em> point to the caller of the function.</p>
|
||||
|
||||
<!-- In this lab you develop code generation for statements and extend your implementation of functions to deal with nested functions.
|
||||
|
||||
See the slides of [Lecture 14](/2021/lecture/14) for a discussion of static links and several critical example ChocoPy programs.
|
||||
|
||||
### Objectives
|
||||
|
||||
1. Compiling statements
|
||||
2. Compiling string constants
|
||||
3. Execution environment
|
||||
4. Compiling nested functions
|
||||
5. Challenges
|
||||
|
||||
### Miscellaneous
|
||||
|
||||
#### Compiling Statements
|
||||
|
||||
Develop transformation rules for assignments and control-flow statements.
|
||||
Here is a sketch for a rule transforming the `if` statement.
|
||||
|
||||
```
|
||||
rules
|
||||
|
||||
stat-to-instrs-(|r, regs) :
|
||||
IfElse(e, Block(stats1), Else(Block(stats2))) -> <concat>[
|
||||
…
|
||||
]
|
||||
with <exp-to-instrs(|r, regs)> e => instrs0
|
||||
with <stats-to-instrs(|r, regs)> stats1 => instrs1
|
||||
with <stats-to-instrs(|r, regs)> stats2 => instrs2
|
||||
```
|
||||
|
||||
#### String Constants
|
||||
|
||||
String constants in ChocoPy can be encoded as constant objects.
|
||||
We will discuss objects in more detail next week, but you can already translate string constants.
|
||||
For example
|
||||
|
||||
```
|
||||
message : str = "hello"
|
||||
target : str = "world"
|
||||
|
||||
print(message + " " + target)
|
||||
```
|
||||
|
||||
A constant can be translated to a constant object.
|
||||
For example, the string constant `"hello"` becomes:
|
||||
|
||||
```
|
||||
.globl const_286
|
||||
const_286:
|
||||
.word 3
|
||||
.word 6
|
||||
.word $str$dispatchTable
|
||||
.word 5
|
||||
.string "hello"
|
||||
.align 2
|
||||
```
|
||||
|
||||
You can then use the label (`const_286` in this case) to load the string into a register.
|
||||
|
||||
```
|
||||
la a0, const_286 # load string constant
|
||||
```
|
||||
|
||||
#### Execution Environment
|
||||
|
||||
From the reference compiler at <chocopy.org> you can obtain the implementation of the built-in functions of ChocoPy.
|
||||
|
||||
### Compiling Nested Functions
|
||||
|
||||
#### Handling Shadowing: Making Names Unique
|
||||
|
||||
In ChocoPy definitions can shadow (make invisible) the definition of other names.
|
||||
You will have encountered this in your definition of a type system for Statix.
|
||||
For example, the following program defines two functions named `foo` and several variables named `a`:
|
||||
|
||||
```
|
||||
a : int = 10
|
||||
def foo(a: int) !- int:
|
||||
def foo(b : int) !- int:
|
||||
a : int = 20
|
||||
return a + b
|
||||
return foo(a + 10)
|
||||
|
||||
print(foo(a))
|
||||
```
|
||||
|
||||
In order to make code generation unambiguous you can transform programs to make names unique.
|
||||
For example, the program above could be compiled to the following program, where the name of the enclosing function is used to disambiguate names:
|
||||
|
||||
```
|
||||
$a : int = 10
|
||||
def $foo($foo.a: int) !- int:
|
||||
def $foo.foo($foo.foo.b : int) !- int:
|
||||
$foo.foo.a : int = 20
|
||||
return $foo.foo.a + $foo.foo.b
|
||||
return $foo($foo.a + 10)
|
||||
|
||||
print($foo($a))
|
||||
```
|
||||
|
||||
Note that this program does not parse, since `$` is not part of the syntax of identifiers.
|
||||
But the approach can be used in abstract syntax, and the names _can_ be used in the target RISC-V code.
|
||||
|
||||
#### Nested Functions
|
||||
|
||||
ChocoPy supports the definition of nested functions.
|
||||
That is, a function definition can be nested in another function defintion.
|
||||
This entails that they body of a nested function can access the parameters and local variables of the enclosing function(s).
|
||||
For example, here is a (contrived) program with nested functions:
|
||||
|
||||
```
|
||||
a : int = 10
|
||||
|
||||
def foo(x : int) -> int:
|
||||
b : int = 0
|
||||
|
||||
def aux(i : int) -> int:
|
||||
return b + i
|
||||
|
||||
def bar(y : int) -> int:
|
||||
c : int = 0
|
||||
|
||||
def baz(z : int) -> int:
|
||||
d : int = 0
|
||||
d = aux(c + 1)
|
||||
return a + x + y + z
|
||||
|
||||
return baz(a + b + x)
|
||||
|
||||
b = aux(x)
|
||||
return bar(b + 10)
|
||||
|
||||
print(foo(a))
|
||||
```
|
||||
|
||||
#### Static Links
|
||||
|
||||
Global variables can be accessed directly using their named label.
|
||||
Formal parameters and local variables can be accessed via their offset from the frame pointer.
|
||||
The parameters and local variables of enclosing functions are accessible to nested functions.
|
||||
They are stored in the call frame of the corresponding function, which is on the stack when a nested function is being executed.
|
||||
Thus, to access those variables we need to find the corresponding call frame.
|
||||
However, the call frame of the enclosing function is not necessarily the call frame of the caller of a function.
|
||||
For example, when a function is recursive, there may be multiple call frames separating the call frame of a nested function and that of its (statically) enclosing function.
|
||||
|
||||
A _static link_ is an additional implicit argument of a function that points to the call frame of its directly enclosing function.
|
||||
Via the chain of static links, the call frames of all enclosing functions can be reached.
|
||||
See the slides of [Lecture 14](/2021/lecture/14) for example ChocoPy programs with nested functions and the use of static links to implement them.
|
||||
|
||||
#### Making Nesting Explicit
|
||||
|
||||
Once you have added static links to your code generator, you can implement the calling of nested functions and access to local variables and formal parameters of nested functions.
|
||||
To do that correctly, you need to know how many static links to follow.
|
||||
One approach is to compute before code generation as a program transformation, annotating all function calls with the number of links to follow.
|
||||
For example, for the program above that would lead to:
|
||||
|
||||
```
|
||||
a : int = 10
|
||||
|
||||
def foo(x : int) -> int:
|
||||
b : int = 0
|
||||
|
||||
def aux(i : int) -> int:
|
||||
return b/1 + i/0
|
||||
|
||||
def bar(y : int) -> int:
|
||||
c : int = 0
|
||||
|
||||
def baz(z : int) -> int:
|
||||
d : int = 0
|
||||
d = aux/2(c/1 + 1)
|
||||
return a/0 + x/2 + y/1 + z/0
|
||||
|
||||
return baz/0(a/0 + b/1 + x/1)
|
||||
|
||||
b = aux/0(x/0)
|
||||
return bar/0(b/0 + 10)
|
||||
|
||||
print(foo/0(a/0))
|
||||
```
|
||||
|
||||
#### Evaluation Order
|
||||
|
||||
A question to consider when compiling function calls is whether the order of evaluation of function arguments is relevant.
|
||||
For a language such as C, the order of evaluation is not defined, and up to the compiler to chose an order.
|
||||
This means that programmers cannot count on the order being deterministic.
|
||||
Is the order of evaluation of function call arguments defined for ChocoPy?
|
||||
Does that correspond to the semantics of Python?
|
||||
|
||||
### Challenges
|
||||
|
||||
#### Boxed vs Unboxed Representation of Primitive Values
|
||||
|
||||
The ChocoPy reference implementation uses a boxed representation of strings, integers, and booleans. Is that necessary? Is it possible to use an unboxed representation?
|
||||
|
||||
#### Functions as First-Class Citizens
|
||||
|
||||
Functions in ChocoPy can be nested. This means that they can have 'free variables' that are defined in the context of the function definitions.
|
||||
But ChocoPy functions are not first-class citizens.
|
||||
Thus, one cannot pass a function to another function or store it in a data structure.
|
||||
Can you extend ChocoPy with functions as first-class citizens, i.e. add anonymous function literals to the language?
|
||||
What syntax would you give to such function literals?
|
||||
What would be your strategy for implementing this feature? -->
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="11.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="13.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<ul id="my_toc" class="toc list-group list-group-flush d-none d-lg-block d-xl-block p-0 ml-0 mt-3">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="12.html#while-loops">While Loops</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="12.html#functions">Functions</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="11.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="13.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
394
lab/13.html
Normal file
|
|
@ -0,0 +1,394 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Lab 13: Compiling Objects</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Lab 13: Compiling Objects
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Project
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
December 17, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<p>Develop code generation for ChocoPy classes and methods.</p>
|
||||
|
||||
<h3 id="objectives">Objectives</h3>
|
||||
|
||||
<ol>
|
||||
<li>Compiling objects</li>
|
||||
<li>Compiling lists</li>
|
||||
<li>Challenges
|
||||
<ul>
|
||||
<li>Garbage collection</li>
|
||||
<li>Register allocation</li>
|
||||
<li>Peephole optimizations</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<h3 id="compiling-objects">Compiling Objects</h3>
|
||||
|
||||
<p>The main objective for today’s lab is to extend your compiler to support the compilation of classes.
|
||||
See also the slides of <a href="../lecture/15.html">Lecture 15</a> and the <a href="https://chocopy.org/chocopy_implementation_guide.pdf">ChocoPy implementation guide</a>.</p>
|
||||
|
||||
<h4 id="objects-in-chocopy">Objects in ChocoPy</h4>
|
||||
|
||||
<p>ChocoPy supports object-oriented programming through classes with attributes and methods.
|
||||
The following example program (from the reference manual) illustrates many of the features of classes in ChocoPy:</p>
|
||||
|
||||
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>class animal(object):
|
||||
makes_noise:bool = False
|
||||
|
||||
def make_noise(self: "animal") -> object:
|
||||
if (self.makes_noise):
|
||||
print(self.sound())
|
||||
|
||||
def sound(self: "animal") -> str:
|
||||
return "???"
|
||||
|
||||
class cow(animal):
|
||||
def __init__(self: "cow"):
|
||||
self.makes_noise = True
|
||||
|
||||
def sound(self: "cow") -> str:
|
||||
return "moo"
|
||||
|
||||
c:animal = None
|
||||
c = cow()
|
||||
c.make_noise()
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>A class defines a type and inherits from a superclass of which it is a subtype.</p>
|
||||
|
||||
<p>A class has attributes that are initialized with a literal value, which is <code class="language-plaintext highlighter-rouge">None</code> in the case of object types.</p>
|
||||
|
||||
<p>A class has method defintions, which are regular ChocoPy function definitions, except that methods always have a first argument (<code class="language-plaintext highlighter-rouge">self</code>) of the enclosing class type, which represents the objects to which the method is applied.
|
||||
Methods can have nested functions.</p>
|
||||
|
||||
<p>A method call <code class="language-plaintext highlighter-rouge">e0.f(e1, ...)</code> invokes a method on the object. The actual implementation called corresponds to the <em>dynamic</em> type of the object value. That is, when the object is of a subtype <code class="language-plaintext highlighter-rouge">t</code> of the static type of <code class="language-plaintext highlighter-rouge">e0</code>, and the method <code class="language-plaintext highlighter-rouge">f</code> has been overridden in <code class="language-plaintext highlighter-rouge">t</code> or a supertype of <code class="language-plaintext highlighter-rouge">t</code>, the method lowest in the class hierarchy is called. This is known as <em>dynamic dispatch</em>.</p>
|
||||
|
||||
<p>A function with the same name as the class (e.g. <code class="language-plaintext highlighter-rouge">cow()</code> in the example above) is used to create objects.
|
||||
When a class or one of its superclasses has an <code class="language-plaintext highlighter-rouge">__init__</code> method, that method is called implicitly on construction of the object.</p>
|
||||
|
||||
<h4 id="object-layout-and-prototypes">Object Layout and Prototypes</h4>
|
||||
|
||||
<p>An object value is represented by a chunk of memory in the heap, consisting of a type tag, the size of the object, a pointer to the dispatch table (see below) of the class, and the values of the attributes of the class.</p>
|
||||
|
||||
<p>Objects are allocated by the <code class="language-plaintext highlighter-rouge">alloc</code> function in the execution environment, by copying a pointer to a prototype object.
|
||||
The prototype object for a class is an object following the layout described above with attribute values set to their initial values in the corresponding class.
|
||||
Thus, there is not need to perform the default initialization programmatically.
|
||||
After copying the prototype object, the <code class="language-plaintext highlighter-rouge">__init__</code> method is invoked to apply further custom initialization.</p>
|
||||
|
||||
<h4 id="dispatch-tables">Dispatch Tables</h4>
|
||||
|
||||
<p>Since all object instance of a class share the same set of methods, there is no need to copy the addresses of the corresponding functions into each object.
|
||||
Instead, an object contains a pointer to a dispatch table, which contains the addresses (labels) of the functions implementing the methods.
|
||||
Note that the methods of inherited method are also included in the dispatch table.</p>
|
||||
|
||||
<h4 id="compiling-methods">Compiling Methods</h4>
|
||||
|
||||
<p>Methods are standard top-level functions and can be compiled using the same approach as used for those.
|
||||
The first argument of a function is a pointer to the object to which the method is applied.
|
||||
Since methods and attributes are accessed through this <code class="language-plaintext highlighter-rouge">self</code> argument, no special measures are needed.</p>
|
||||
|
||||
<h4 id="calling-methods">Calling Methods</h4>
|
||||
|
||||
<p>Method calls are similar to top-level function calles, but the first argument is passed as a receiver object.
|
||||
That is, <code class="language-plaintext highlighter-rouge">e0.f(e1, ...)</code> is essentially a function call <code class="language-plaintext highlighter-rouge">f(e0, e1, ...)</code>.
|
||||
However, the actual function to be called should be obtained through the dispatch table to which the value of <code class="language-plaintext highlighter-rouge">e0</code> points.
|
||||
In order to access that object it should not be <code class="language-plaintext highlighter-rouge">None</code>.</p>
|
||||
|
||||
<h4 id="accessing-attributes">Accessing Attributes</h4>
|
||||
|
||||
<p>An attribute access <code class="language-plaintext highlighter-rouge">e.x</code> is implemented by accessing the object at the offset corresponding to the attribute <code class="language-plaintext highlighter-rouge">x</code>.
|
||||
Also for attribute accesses, the object should not be <code class="language-plaintext highlighter-rouge">None</code>.</p>
|
||||
|
||||
<h3 id="compiling-lists">Compiling Lists</h3>
|
||||
|
||||
<p>ChocoPy has lists, which are mutable sequences of a fixed length. So, lists behave like arrays in C. Operations on lists are length <code class="language-plaintext highlighter-rouge">len</code>, indexing <code class="language-plaintext highlighter-rouge">lst[i]</code>, and concatenation <code class="language-plaintext highlighter-rouge">lst1 + lst2</code>.
|
||||
Lists are represented as objects with <code class="language-plaintext highlighter-rouge">len</code> attributes to represent the elements of the list.
|
||||
Concatenation constructs a new list copying the original lists.</p>
|
||||
|
||||
<h3 id="challenges">Challenges</h3>
|
||||
|
||||
<h4 id="garbage-collection">Garbage Collection</h4>
|
||||
|
||||
<p>Objects are allocated on the heap. What happens when your program runs out of heap memory to allocate objects? Is compiled code memory safe? Develop a garbage collection algorithm for the execution environment of ChocoPy progams in order to support automatic memory management.</p>
|
||||
|
||||
<!-- #### Register Allocation
|
||||
|
||||
In [Lecture 15](/2021/lecture/15) we discussed register allocation using graph coloring. Use a separate register allocation phase to assign temporary values to registers in order to avoid saving values to memory. -->
|
||||
|
||||
<h4 id="peephole-optimization">Peephole Optimization</h4>
|
||||
|
||||
<p>A peephole optimization can be applied to generated code, i.e. to the AST of the generated program. A peephole optimization recognizes a couple of adjacent instructions and replaces them with something more efficient.
|
||||
Extend your compiler with a peephole optimization phase after code generation that optimizes generated code.
|
||||
Make sure that optimizations do preserve the semantics of the code.</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="12.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="14.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<ul id="my_toc" class="toc list-group list-group-flush d-none d-lg-block d-xl-block p-0 ml-0 mt-3">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="13.html#objectives">Objectives</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="13.html#compiling-objects">Compiling Objects</a>
|
||||
<ul class="toc-sub pl-0">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="13.html#objects-in-chocopy">Objects in ChocoPy</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="13.html#object-layout-and-prototypes">Object Layout and Prototypes</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="13.html#dispatch-tables">Dispatch Tables</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="13.html#compiling-methods">Compiling Methods</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="13.html#calling-methods">Calling Methods</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="13.html#accessing-attributes">Accessing Attributes</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="13.html#compiling-lists">Compiling Lists</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="13.html#challenges">Challenges</a>
|
||||
<ul class="toc-sub pl-0">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="13.html#garbage-collection">Garbage Collection</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="13.html#peephole-optimization">Peephole Optimization</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="12.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="14.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
259
lab/14.html
Normal file
|
|
@ -0,0 +1,259 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Lab 14: Implementing Lists & Testing Your Compiler</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Lab 14: Implementing Lists & Testing Your Compiler
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Project
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
December 24, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<p>Implement lists in ChocoPy.</p>
|
||||
|
||||
<p>Test all corner cases of the ChocoPy language and make sure your compiler deals with them correctly.</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="13.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="15.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="13.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="15.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
252
lab/15.html
Normal file
|
|
@ -0,0 +1,252 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Lab 15: Finishing Touches</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Lab 15: Finishing Touches
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Project
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
January 14, 2022
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<p>Make sure your code is ready for final submission.</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="14.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../milestone/3.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="14.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../milestone/3.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
959
lab/1a.html
Normal file
|
|
@ -0,0 +1,959 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Lab 1(a): Setting up Spoofax</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
<a href="https://tudelft-cs4200.github.io/2021">
|
||||
<img class="border border-dark" width="100%" src="../project/2021/00-lab1a/spoofax.png"/>
|
||||
</a>
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Lab 1(a): Setting up Spoofax
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Project Set-up
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
September 07, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<p>For the course project and for some of the homework assignments we will use the <a href="https://www.spoofax.dev/spoofax-pie/develop">Spoofax Language Workbench</a> version <a href="https://www.spoofax.dev/spoofax-pie/develop/">Spoofax 3</a>.</p>
|
||||
|
||||
<h3 id="installing-spoofax">Installing Spoofax</h3>
|
||||
|
||||
<p>Follow the <a href="https://www.spoofax.dev/spoofax-pie/develop/tutorial/install/">tutorial</a> on installing Spoofax3.</p>
|
||||
|
||||
<h3 id="language-projects">Language Projects</h3>
|
||||
|
||||
<p>In Spoofax you develop a programming language in a ‘language project’.</p>
|
||||
|
||||
<p>Follow the tutorial on <a href="https://www.spoofax.dev/spoofax-pie/develop/tutorial/create_language_project/">Creating a language project</a> to create a project with syntax and syntax tests.</p>
|
||||
|
||||
<h3 id="chocopy-project">ChocoPy Project</h3>
|
||||
|
||||
<p>Create a Spoofax project for the ChocoPy language. Configure your project to use the Chocopy name and <code class="language-plaintext highlighter-rouge">cpy</code> identifier, and place it in the <em>root of your repository</em>. See the image below for an example.</p>
|
||||
|
||||
<p><img src="https://i.imgur.com/wFAbX9K.png" alt="" /></p>
|
||||
|
||||
<p>Your project can be located in either <code class="language-plaintext highlighter-rouge">student-<yournetid>/chocopy.syntax</code> or <code class="language-plaintext highlighter-rouge">student-<yournetid>/chocopy</code>. If you place your project in a nested folder, or in a differently named folder, the grader will automatically reject your submission.</p>
|
||||
|
||||
<h3 id="updating-spoofax">Updating Spoofax</h3>
|
||||
|
||||
<p>During the course of the project, bugfixes and new features may be added to Spoofax 3. The grader will always test your project using the most recent version of Spoofax 3 that is backwards compatible with the initial project version (0.11.6).</p>
|
||||
|
||||
<p>To update your local installation to the newest version of Spoofax 3, launch Eclipse and select <code class="language-plaintext highlighter-rouge">Help</code> from the top menu, followed by <code class="language-plaintext highlighter-rouge">Install new software</code>.</p>
|
||||
|
||||
<p><img src="https://i.imgur.com/P8v2gj9.png" alt="" /></p>
|
||||
|
||||
<p>In the dialog that opens, enter the release URL of the latest Spoofax 3 release in the <code class="language-plaintext highlighter-rouge">Work with:</code> field. This URL starts with <code class="language-plaintext highlighter-rouge">https://artifacts.metaborg.org</code> and can be found on the <a href="https://www.spoofax.dev/spoofax-pie/develop/release/download/">Spoofax 3 releases page</a>. After entering the URL, hit enter to load all available packages for that release, then select the Spoofax package.</p>
|
||||
|
||||
<p><img src="https://i.imgur.com/j0Q91n8.png" alt="" /></p>
|
||||
|
||||
<p>Finally, hit next, accept the license if needed, and confirm the install. During installation, Eclipse may prompt that the package is unsigned. When this happens, select <code class="language-plaintext highlighter-rouge">Install anyway</code>.</p>
|
||||
|
||||
<p><img src="https://i.imgur.com/sKLxdGp.png" alt="" /></p>
|
||||
|
||||
<p>Then, restart Eclipse.
|
||||
After Eclipse has restarted, clean your ChocoPy language project by selecting it in the Package Explorer, choosing Project -> Clean from the main menu, and by pressing Clean.
|
||||
After the project is cleaned, build it once and continue.</p>
|
||||
|
||||
<h3 id="references">References</h3>
|
||||
|
||||
|
||||
|
||||
|
||||
<ul class="list-group list-group-flush pb-3">
|
||||
|
||||
|
||||
<li class="list-group-item pl-lg-0 border-0 pb-0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-success pl-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<a name="Spoofax3"></a>
|
||||
|
||||
<a class="font-weight-bold text-dark" target="_blank" href="https://www.spoofax.dev/spoofax-pie/develop/">Spoofax 3 (Documentation) </a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light" style="font-size:90%;">
|
||||
|
||||
(editor).
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
|
||||
|
||||
|
||||
|
||||
https://www.spoofax.dev/spoofax-pie/develop/ 2021
|
||||
|
||||
|
||||
|
||||
[<a class="text-secondary" target="_blank" href="https://researchr.org/publication/Spoofax3/bibtex">bib</a>, <a href="https://researchr.org/publication/Spoofax3" class="text-secondary" target="_blank">researchr</a>]
|
||||
|
||||
<!-- Spoofax3 -->
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item pl-lg-0 border-0 pb-0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-success pl-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<a name="Spoofax2021"></a>
|
||||
|
||||
<a class="font-weight-bold text-dark" target="_blank" href="https://www.spoofax.dev/">Spoofax: The Language Designer's Workbench</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light" style="font-size:90%;">
|
||||
|
||||
(editor).
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
|
||||
|
||||
|
||||
|
||||
https://www.spoofax.dev/ 2021
|
||||
|
||||
|
||||
|
||||
[<a class="text-secondary" target="_blank" href="https://researchr.org/publication/Spoofax2021/bibtex">bib</a>, <a href="https://researchr.org/publication/Spoofax2021" class="text-secondary" target="_blank">researchr</a>]
|
||||
|
||||
<!-- Spoofax2021 -->
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="0b.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1b.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<ul id="my_toc" class="toc list-group list-group-flush d-none d-lg-block d-xl-block p-0 ml-0 mt-3">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1a.html#installing-spoofax">Installing Spoofax</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1a.html#language-projects">Language Projects</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1a.html#chocopy-project">ChocoPy Project</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1a.html#updating-spoofax">Updating Spoofax</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1a.html#references">References</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="0b.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1b.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
975
lab/1b.html
Normal file
|
|
@ -0,0 +1,975 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Lab 1(b): Creating Syntax Tests</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
<a href="https://tudelft-cs4200.github.io/2021">
|
||||
<img class="border border-dark" width="100%" src="../project/2021/00-lab1b/spt.png"/>
|
||||
</a>
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Lab 1(b): Creating Syntax Tests
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Project
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
September 07, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<p>Before getting started with your syntax definition, you set up a test suite for syntax analysis.
|
||||
Develop the test suite in tandem with the development of your syntax definition.
|
||||
The test suite consists of positive and negative test cases.
|
||||
We will <em>not</em> grade this test suite, but you should develop one to get confidence in the quality of your syntax definition.
|
||||
When you are asking for help from the course staff, we will first ask what tests you have written to demonstrate the problem.</p>
|
||||
|
||||
<h3 id="objectives">Objectives</h3>
|
||||
|
||||
<p>Develop a test suite for syntax analysis.
|
||||
The test suite should provide</p>
|
||||
|
||||
<ol>
|
||||
<li>Syntactically valid and invalid test cases for the <code class="language-plaintext highlighter-rouge">Start</code> sort</li>
|
||||
<li>Disambiguation tests for associativity and precedence in expressions.</li>
|
||||
<li>Test cases for layout-sensitive language constructs</li>
|
||||
<li>Test cases for mandatory and optional whitespace.</li>
|
||||
</ol>
|
||||
|
||||
<h3 id="anatomy-of-a-test-suite">Anatomy of a Test Suite</h3>
|
||||
|
||||
<p>In Spoofax, a test suite consists of one or more <code class="language-plaintext highlighter-rouge">.spt</code> files.
|
||||
Consider the following example file:</p>
|
||||
|
||||
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>module example
|
||||
|
||||
test FUN composite [[func(1+1, 3*2)]] parse succeeds
|
||||
test FUN only comma [[func(,)]] parse fails
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>The first line specifies the name of the test <code class="language-plaintext highlighter-rouge">module</code>,
|
||||
In this <code class="language-plaintext highlighter-rouge">example</code> module, we test syntax of the <code class="language-plaintext highlighter-rouge">ChocoPy</code> language.</p>
|
||||
|
||||
<p>The last two lines specify a positive and a negative test case.
|
||||
Each test case consists of
|
||||
a name,
|
||||
a code fragment in double square brackets, and
|
||||
a condition which determines
|
||||
what kind of test should be performed (parsing) and
|
||||
what the expected outcome is (success or failure).</p>
|
||||
|
||||
<p>You get instant feedback while editing a test suite.
|
||||
Since you have not yet implemented the ChocoPy editor, all your positive test cases fail.
|
||||
You will work on this during the next lab.
|
||||
To read more on SPT, visit the documentation.</p>
|
||||
|
||||
<h4 id="chocopy-syntax-definition">ChocoPy Syntax Definition</h4>
|
||||
|
||||
<p>To write your own test cases, you need to understand ChocoPy’s syntax.
|
||||
You can find the definitive ChocoPy syntax definition in the <a href="0b.html">Reference Manual</a>.</p>
|
||||
|
||||
<h3 id="test-cases">Test Cases</h3>
|
||||
|
||||
<p>You can now start writing your own test cases.</p>
|
||||
|
||||
<h4 id="lexical-and-context-free-syntax">Lexical and Context-free Syntax</h4>
|
||||
|
||||
<p>Start with the lexical syntax and think about valid and invalid identifiers.
|
||||
Try to focus on corner cases such as</p>
|
||||
|
||||
<ul>
|
||||
<li>identifiers made of a single character,</li>
|
||||
<li>mixings of letters and digits (Which kinds of mixing are allowed? Which are not?),</li>
|
||||
<li>underscores in identifiers.</li>
|
||||
</ul>
|
||||
|
||||
<p class="notice notice-warning">The content for the tests for lexical symbols should not be surrounded by layout.</p>
|
||||
|
||||
<p>Next, you should walk through the whole syntax definition.
|
||||
Keep thinking of valid and invalid code fragments.
|
||||
Identify interesting corner cases and turn them into positive and negative test cases.</p>
|
||||
|
||||
<p>Try to keep your test cases small.
|
||||
Each test case should focus on a single aspect.
|
||||
For example, a negative test case should only contain one error.
|
||||
The name of a test case should reflect the aspect it addresses.</p>
|
||||
|
||||
<p>You can organise test cases which focus on similar aspects in test modules.
|
||||
Again, the name of a test module should reflect these aspects.
|
||||
Finally, you can organise test suites in folders.</p>
|
||||
|
||||
<p class="notice notice-warning">When writing tests that target the differences between Python and ChocoPy, only consider the syntactic differences.
|
||||
For example, identifiers in Python are limited to a certain size.
|
||||
This <strong>should not</strong> be checked by your tests as this limitation is not specified in the context-free grammar of Python.</p>
|
||||
|
||||
<h4 id="disambiguation">Disambiguation</h4>
|
||||
|
||||
<p>Next, you need to focus on disambiguation.
|
||||
Come up with positive test cases which specify the correct ASTs for nested expressions.
|
||||
As an alternative, you can also specify two fragments in concrete syntax, which should result in the same AST:</p>
|
||||
|
||||
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>test left associative addition [[21 + 14 + 14]] parse to [[(21 + 14) + 14]]
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>You can find a table listing the associativity and priorities of operators in the reference manual.
|
||||
Do not focus only on binary expressions.</p>
|
||||
|
||||
<p class="notice notice-warning">You <strong>do not</strong> have to test for constructs that are non-associative. In lab 2, <code class="language-plaintext highlighter-rouge">non-assoc</code> leads to semantic errors rather than syntactic errors during parse time. Since our language does not have analysis at that point, we cannot test the semantic errors and thus they are also not required for this lab.</p>
|
||||
|
||||
<h4 id="layout">Layout</h4>
|
||||
|
||||
<p>Finally, you can focus on layout.
|
||||
Think about places where whitespace is not optional but mandatory and define corresponding positive and negative test cases.
|
||||
Finish with test cases for single-line comments.
|
||||
Single-line comments cannot only end with a newline character, but also at the end of file.</p>
|
||||
|
||||
|
||||
|
||||
|
||||
<ul class="list-group list-group-flush pb-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item pl-lg-0 border-0 pb-0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-primary pl-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<a name="KatsVV11"></a>
|
||||
|
||||
<a class="font-weight-bold text-dark" target="_blank" href="http://doi.acm.org/10.1145/2048066.2048080">Integrated language definition testing: enabling test-driven language development</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
<a class="text-secondary" href="http://www.lclnet.nl/">Lennart C. L. Kats</a>, <a class="text-secondary" href="https://researchr.org/profile/robvermaas/publications">Rob Vermaas</a>, <a class="text-secondary" href="http://eelcovisser.org">Eelco Visser</a>.
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
|
||||
|
||||
OOPSLA 2011
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[<a href="../publications/2011/KatsVV11.pdf" class="text-secondary" target="_blank">pdf</a>, <a class="text-secondary" href="http://doi.acm.org/10.1145/2048066.2048080" target="_blank">doi</a>, <a class="text-secondary" target="_blank" href="https://researchr.org/publication/KatsVV11/bibtex">bib</a>, <a href="https://researchr.org/publication/KatsVV11" class="text-secondary" target="_blank">researchr</a>, <a class="text-secondary" data-toggle="collapse" href="1b.html#AbstractKatsVV11" role="button" aria-expanded="false" aria-controls="AbstractKatsVV11"">abstract</a>]
|
||||
|
||||
<!-- -->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="collapse mt-1 mb-2" id="AbstractKatsVV11">
|
||||
<div class="">
|
||||
The reliability of compilers, interpreters, and development environments for programming languages is essential for effective software development and maintenance. They are often tested only as an afterthought. Languages with a smaller scope, such as domain-specific languages, often remain untested. General-purpose testing techniques and test case generation methods fall short in providing a low-threshold solution for test-driven language development. In this paper we introduce the notion of a language-parametric testing language (LPTL) that provides a reusable, generic basis for declaratively specifying language definition tests. We integrate the syntax, semantics, and editor services of a language under test into the LPTL for writing test inputs. This paper describes the design of an LPTL and the tool support provided for it, shows use cases using examples, and describes our implementation in the form of the Spoofax testing language.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1a.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1c.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<ul id="my_toc" class="toc list-group list-group-flush d-none d-lg-block d-xl-block p-0 ml-0 mt-3">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1b.html#objectives">Objectives</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1b.html#anatomy-of-a-test-suite">Anatomy of a Test Suite</a>
|
||||
<ul class="toc-sub pl-0">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1b.html#chocopy-syntax-definition">ChocoPy Syntax Definition</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1b.html#test-cases">Test Cases</a>
|
||||
<ul class="toc-sub pl-0">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1b.html#lexical-and-context-free-syntax">Lexical and Context-free Syntax</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1b.html#disambiguation">Disambiguation</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1b.html#layout">Layout</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1a.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1c.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
485
lab/1c.html
Normal file
|
|
@ -0,0 +1,485 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Lab 1(c): Syntax Definition</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
<a href="https://tudelft-cs4200.github.io/2021">
|
||||
<img class="border border-dark" width="100%" src="../project/2021/00-lab1c/grammar.png"/>
|
||||
</a>
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Lab 1(c): Syntax Definition
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Project
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
September 07, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<p>In this lab, you define the concrete and abstract syntax of ChocoPy in Spoofax.
|
||||
From this definition, you generate an Eclipse editor, which provides syntax checking, error recovery, and syntax highlighting.</p>
|
||||
|
||||
<p>In this lab, focus on translating the grammar in Figure 3 of the ChocoPy Reference Manual to an <em>idiomatic</em> context-free syntax definition with constructors.
|
||||
In the <a href="2.html">next lab</a>, you extend this definition with <em>disambiguation rules</em> for associativity, priority, and layout constraints.</p>
|
||||
|
||||
<h3 id="objectives">Objectives</h3>
|
||||
|
||||
<p>Develop a syntax definition for ChocoPy in SDF3 and generate an Eclipse editor from it.
|
||||
The definition should include:</p>
|
||||
|
||||
<ol>
|
||||
<li>The start symbol <code class="language-plaintext highlighter-rouge">Start</code></li>
|
||||
<li>A lexical syntax definition for all ChocoPy lexemes</li>
|
||||
<li>A context-free syntax definition ChocoPy complying with the grammar in Figure 3 of the reference manual</li>
|
||||
<li>Constructor names for context-free syntax productions</li>
|
||||
</ol>
|
||||
|
||||
<h3 id="syntax-definition">Syntax Definition</h3>
|
||||
|
||||
<p>You should define your syntax in SDF3.
|
||||
You can start by opening the file <code class="language-plaintext highlighter-rouge">src/start.sdf3</code> in your chocopy project.
|
||||
You can also split your syntax definition over several modules in <code class="language-plaintext highlighter-rouge">src/</code> and import modules into module <code class="language-plaintext highlighter-rouge">start</code>.</p>
|
||||
|
||||
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>module start
|
||||
imports lex
|
||||
imports expressions
|
||||
imports statements
|
||||
// etc.
|
||||
context-free start symbols Start
|
||||
</code></pre></div></div>
|
||||
|
||||
<!-- The module already imports a module `Common.sdf3`, which you can find in any initial Spoofax editor project.
|
||||
This module provides syntax definitions for common lexical sorts such as identifiers, integers, strings, whitespace, and comments. -->
|
||||
|
||||
<!-- For more information on how to write SDF3 syntax definitions, also check the documentation on how to define a language in Spoofax.
|
||||
{: .notice .notice-warning} -->
|
||||
|
||||
<p>For more information on how to write SDF3 syntax definitions, you can also review the <a href="http://www.metaborg.org/en/latest/source/langdev/meta/lang/sdf3/index.html">old SDF3 reference manual</a> and the new <a href="https://www.spoofax.dev/references/syntax/">SDF3 reference</a>.</p>
|
||||
|
||||
<p class="notice notice-warning"><strong>Note that both of these are written for Spoofax 2, and that not all information may still be correct in Spoofax 3!</strong></p>
|
||||
|
||||
<h4 id="context-free-syntax">Context-free Syntax</h4>
|
||||
|
||||
<p>Start with the context-free syntax of the language.
|
||||
Use the context-free grammar in the <em>ChocoPy Language Reference Manual</em> as a reference.</p>
|
||||
|
||||
<!-- When you define your syntax definition bottom-up, you start with sorts such as `Type` and `VarDecl`.
|
||||
This allows you to run your tests frequently and check your progress. -->
|
||||
|
||||
<p>We recommend to use <em>template productions</em> for your context-free syntax definition, since they help when generating artifacts other than just the parser.
|
||||
When you use template productions, you need to make sure that templates are correctly tokenised.
|
||||
Otherwise, the parser would reject layout in certain positions, for example between <code class="language-plaintext highlighter-rouge">[</code> and <code class="language-plaintext highlighter-rouge">]</code> in an array type.
|
||||
Check the SDF3 documentation for details.
|
||||
In case you want to use <code class="language-plaintext highlighter-rouge"><</code> or <code class="language-plaintext highlighter-rouge">></code> as symbols inside a template, you can use alternate template brackets <code class="language-plaintext highlighter-rouge">[...]</code>.</p>
|
||||
|
||||
<h4 id="lexical-syntax">Lexical Syntax</h4>
|
||||
|
||||
<p>Continue with the lexical syntax definition including identifiers, integer, and simple layout.
|
||||
<!-- The `Common` module in `syntax/Common.sdf3` already provides definitions, but these do not necessarily comply with the lexical syntax of ChocoPy. -->
|
||||
<!-- You can either fix these definitions in `Common`, or define and import your own module and use `Common` only for inspiration. --></p>
|
||||
|
||||
<p>First, define lexical syntax rules:</p>
|
||||
|
||||
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>lexical syntax
|
||||
ID = ...
|
||||
INT = ...
|
||||
LAYOUT = ...
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Second, define follow restrictions to ensure longest match:</p>
|
||||
|
||||
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>lexical restrictions
|
||||
ID -/- ...
|
||||
INT -/- ...
|
||||
context-free restrictions
|
||||
LAYOUT? -/- ...
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Finally, use rejection rules to rule out reserved words.</p>
|
||||
|
||||
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>lexical syntax
|
||||
ID = ... {reject}
|
||||
</code></pre></div></div>
|
||||
|
||||
<h4 id="testing-your-syntax-definition">Testing Your Syntax Definition</h4>
|
||||
|
||||
<p>You now can check your tests.</p>
|
||||
|
||||
<p class="notice notice-danger">It is important to get your grammar working at this stage. Do not move on if you have issues here, since there is a high chance that these issues influence your other tests as well. If you experience weird behaviour on your tests or a large amount of ambiguity, this is most likely caused by an erroneous definition of <code class="language-plaintext highlighter-rouge">LAYOUT</code>.</p>
|
||||
|
||||
<p>Finally, you should add lexical syntax rules for comments to your syntax definition.
|
||||
Start with single line comments.
|
||||
Do not forget to define follow restrictions.</p>
|
||||
|
||||
<!-- ### Editor Services
|
||||
|
||||
When developing a language in Spoofax, the syntax definition written in SDF3 does not only produce a parser but other editor services as well.
|
||||
|
||||
#### Pretty Printing
|
||||
|
||||
Spoofax generates pretty-printing rules from your syntax definition.
|
||||
|
||||
In order to test the pretty-print builder, you need to build your project.
|
||||
Your ChocoPy editor provides a menu entry named `Format` that uses these generated rules to pretty-print a ChocoPy file.
|
||||
Create or open a `.cpy` test file with a valid program, go to the *Spoofax* -> *Syntax* menu and choose `Format`.
|
||||
This will apply `Format` to the current file and show the result in a new editor.
|
||||
|
||||
Typically, the pretty-printed code lacks proper indentation and line breaks.
|
||||
You can fix this by improving your templates in the syntax definition.
|
||||
The pretty-printer follows the indentation and line breaks from the syntax definition.
|
||||
|
||||
You should improve your syntax definition in order to get readable code with a consistent indentation.
|
||||
You might read on [indent styles](http://en.wikipedia.org/wiki/Indent_style) for some inspiration.
|
||||
|
||||
Make sure that your altered syntax definition is still correct and can be used to parse ChocoPy programs.
|
||||
{: .notice .notice-warning}
|
||||
|
||||
#### Syntactic Code Completion
|
||||
|
||||
Together with a pretty-printer, Spoofax also automatically derives syntactic code completion from the syntax definition. This feature allows for example, for new users to discover the language's syntax while editing the program. To know more details about syntactic code completion in Spoofax, check the documentation. -->
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1b.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1d.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<ul id="my_toc" class="toc list-group list-group-flush d-none d-lg-block d-xl-block p-0 ml-0 mt-3">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1c.html#objectives">Objectives</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1c.html#syntax-definition">Syntax Definition</a>
|
||||
<ul class="toc-sub pl-0">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1c.html#context-free-syntax">Context-free Syntax</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1c.html#lexical-syntax">Lexical Syntax</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1c.html#testing-your-syntax-definition">Testing Your Syntax Definition</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1b.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1d.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
555
lab/1d.html
Normal file
|
|
@ -0,0 +1,555 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Lab 1(d): Git(Lab), CI, and Submissions</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Lab 1(d): Git(Lab), CI, and Submissions
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Project
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
September 07, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<p>We use the Git version control system with <a href="https://gitlab.ewi.tudelft.nl">gitlab.ewi.tudelft.nl</a> to manage submissions and grade assignments.</p>
|
||||
|
||||
<h3 id="git">Git</h3>
|
||||
|
||||
<p>Download and install Git from <a href="https://git-scm.com/downloads">this page</a>. We will be using the Git command-line, since it is more powerful and easier to troubleshoot than GUI clients. On Linux and macOS, installing Git should provide a <code class="language-plaintext highlighter-rouge">git</code> command on your shell. On Windows, Git installs <code class="language-plaintext highlighter-rouge">Git BASH</code> to provide a command-line shell, which you need to start to use Git from the command-line.</p>
|
||||
|
||||
<p>We will explain the steps needed to work on and submit assignments on this page. To learn the basics of git, read <a href="http://rogerdudler.github.io/git-guide/">git - the simple guide</a> and <a href="https://try.github.io/">try out the Git command-line</a>. If you’d like to learn more, <a href="https://help.github.com/articles/good-resources-for-learning-git-and-github/">have a look at these resources</a>.</p>
|
||||
|
||||
<h3 id="repository-structure">Repository Structure</h3>
|
||||
|
||||
<p>Let’s look at the repository structure first.</p>
|
||||
|
||||
<p>On GitLab, we will create a private git repository for you, which is owned by us, and is only visible to you and the compiler construction team. This repository will host assignment templates and your submissions in <strong>protected</strong> branches. Note that you <strong>do not</strong> have write access to protected branches. You can only read from it and submit assignments to it by opening merge requests. This is to ensure that you cannot mess with submitted assignments after the deadline. You <strong>do</strong> have access to non-protected branches, and this is where you can push your work frequently.</p>
|
||||
|
||||
<h3 id="getting-started">Getting started</h3>
|
||||
|
||||
<p>First, find your private repository in the <a href="https://gitlab.ewi.tudelft.nl/CS4200/2021-2022">CS4200/2021-2022</a> group on GitLab, it should be called <code class="language-plaintext highlighter-rouge">student-id</code> where <code class="language-plaintext highlighter-rouge">id</code> is your NetID.</p>
|
||||
|
||||
<p>To actually do work in the Git repository, you need to make a <em>local</em> clone of the repository on your computer. You can find the URL needed to clone on the bottom right of the page, be sure to use <code class="language-plaintext highlighter-rouge">HTTPS</code>.</p>
|
||||
|
||||
<p><img src="../project/2021/00-submissions/clone_url.png" alt="Clone URL" /></p>
|
||||
|
||||
<p>Open up the command line and make a local clone with your URL:</p>
|
||||
|
||||
<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>git clone https://gitlab.ewi.tudelft.nl/CS4200/2021-2022/student-netid.git
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Now cd into the local clone and confirm that it works:</p>
|
||||
|
||||
<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">cd </span>student-netid
|
||||
git status
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>which should output something like:</p>
|
||||
|
||||
<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>On branch master
|
||||
Your branch is up-to-date with <span class="s1">'origin/master'</span><span class="nb">.</span>
|
||||
nothing to commit, working directory clean
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Your local repository is set up now! Follow the steps below to work on an assignment.</p>
|
||||
|
||||
<h3 id="starting-an-assignment">Starting an assignment</h3>
|
||||
|
||||
<p>You work on each assignment in its own development branch, named <code class="language-plaintext highlighter-rouge">milestone-0-develop</code>, <code class="language-plaintext highlighter-rouge">milestone-1-develop</code>, etc.
|
||||
The correct assignment branch must be checked out in your local Git repository to be able to work on it.
|
||||
The steps to check out a branch depend on whether we provide you with a template, or if you continue with work from a previous assignment.</p>
|
||||
|
||||
<h4 id="template">Template</h4>
|
||||
|
||||
<p>If the assignments asks you to check out a template, which for example <code class="language-plaintext highlighter-rouge">milestone-0-template</code> does, use the following steps:</p>
|
||||
|
||||
<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>git fetch origin
|
||||
git checkout <span class="nt">-b</span> milestone-0-develop origin/milestone-0-template
|
||||
git push <span class="nt">-u</span> origin milestone-0-develop
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>This checks out a fresh branch from the remote repository. It does not contain any of your previous work.</p>
|
||||
|
||||
<h4 id="continue-from-previous-assignment">Continue from previous assignment</h4>
|
||||
|
||||
<p>If the assignment asks you to continue from the previous assignment, which for example milestone 2 does, use the following steps instead:</p>
|
||||
|
||||
<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>git checkout <span class="nt">-b</span> milestone-2-develop
|
||||
git push <span class="nt">-u</span> origin milestone-2-develop
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>The new <code class="language-plaintext highlighter-rouge">milestone-2-develop</code> branch will be in an identical state to the <code class="language-plaintext highlighter-rouge">milestone-1-develop</code> branch, but changes will only be committed to the <code class="language-plaintext highlighter-rouge">milestone-2-develop</code> branch, leaving the <code class="language-plaintext highlighter-rouge">milestone-1-develop</code> branch as is.
|
||||
Now you have the assignment branch checked out in your local repository and can start working.</p>
|
||||
|
||||
<h3 id="saving-work">Saving work</h3>
|
||||
|
||||
<p>Whenever you have changes that you’d like to save, such as after getting (a part of) the assignment working, you need to add, commit, and push your changes:</p>
|
||||
|
||||
<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>git add <span class="nt">--all</span>
|
||||
git commit <span class="nt">-m</span> <span class="s2">"Message describing your changes"</span>
|
||||
git push
|
||||
</code></pre></div></div>
|
||||
|
||||
<h3 id="continuous-integration-ci">Continuous Integration (CI)</h3>
|
||||
|
||||
<p>The template contains a <code class="language-plaintext highlighter-rouge">.gitlab-ci.yml</code> file that configures continuous integration in GitLab.
|
||||
It runs <code class="language-plaintext highlighter-rouge">gradle buildAll</code> on each push to <code class="language-plaintext highlighter-rouge">milestone-*-develop</code>. It also invokes the grader when the project is submitted using a merge request.</p>
|
||||
|
||||
<p>By default, both language projects used for milestones 0-2 are enabled in the gradle build. If, for some reason, building of a project needs to be disabled, the following lines should be commented out in the <code class="language-plaintext highlighter-rouge">settings.gradle.kts</code> file.</p>
|
||||
|
||||
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>includeLanguageIfExists("chocopy.syntax")
|
||||
includeLanguageIfExists("chocopy.types")
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Enabling the build of your <em>language</em> projects in CI is <strong>recommended</strong> but <strong>not required</strong> when submitting your work.</p>
|
||||
|
||||
<h3 id="submitting-a-milestone">Submitting a milestone</h3>
|
||||
|
||||
<p><a href="https://docs.gitlab.com/ee/gitlab-basics/add-merge-request.html">Merge requests</a> are used to submit a milestone from your <em>develop</em> branch to its corresponding <em>submission</em> branch.</p>
|
||||
|
||||
<p>Make sure you’ve pushed all your changes first, then go to your repository on GitLab.
|
||||
Navigate to <strong>Merge Requests</strong> and click the <strong>New merge request</strong> button:</p>
|
||||
|
||||
<p><img src="../project/2021/00-submissions/new_merge_request.png" alt="New merge request" /></p>
|
||||
|
||||
<p>Select the <em>develop</em> branch as source and its corresponding <em>submission</em> branch as target.
|
||||
Click <em>Compare branches and continue</em>.</p>
|
||||
|
||||
<p>If all is well, you can review your changes and you can press the <code class="language-plaintext highlighter-rouge">Submit merge request</code> button to submit your milestone. If not, check the troubleshooting section.</p>
|
||||
|
||||
<p><img src="../project/2021/00-submissions/merge_request.png" alt="Merge request" /></p>
|
||||
|
||||
<p>We will grade your milestone and post the results as an issue in your project, so check back later.</p>
|
||||
|
||||
<h3 id="switching-to-another-milestone">Switching to another milestone</h3>
|
||||
|
||||
<p>If you’d like to work on an another milestone, for example to fix things for a new submission, you can just check out the branch for that milestone.
|
||||
Be sure to push any changes to your current branch first, then check out the branch for the milestone you wish to switch to:</p>
|
||||
|
||||
<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>git checkout milestone-1-develop
|
||||
</code></pre></div></div>
|
||||
|
||||
<h3 id="pulling-in-changes-from-template">Pulling in changes from template</h3>
|
||||
|
||||
<p>If there’s something wrong in the template for a milestone, we fix it in the <em>template</em> branch, and you have to merge in those changes.
|
||||
Use the following commands to merge in changes (use the correct branch!):</p>
|
||||
|
||||
<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>git fetch origin
|
||||
git merge origin/milestone-1-template
|
||||
git push
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>In most cases, Git will automatically merge in any changes, but sometimes conflicts can occur. See <a href="https://help.github.com/articles/resolving-a-merge-conflict-from-the-command-line/">Resolving a merge conflict</a> on how to resolve conflicts.</p>
|
||||
|
||||
<h3 id="git-gui-clients">Git GUI clients</h3>
|
||||
|
||||
<p>This guide uses command-line Git commands, but if you’d rather use a GUI, use <a href="https://www.sourcetreeapp.com/">SourceTree</a>.</p>
|
||||
|
||||
<h3 id="troubleshooting">Troubleshooting</h3>
|
||||
|
||||
<h4 id="cannot-push">Cannot push</h4>
|
||||
|
||||
<p><strong>No access/rights</strong></p>
|
||||
|
||||
<p>When Git complains about not being able to push because you do not have access or rights to the repository, this probably means that you’re trying to push to a <em>template</em> or <em>submission</em> branch rather than a <em>develop</em> branch.</p>
|
||||
|
||||
<p><strong>Out of date branch</strong></p>
|
||||
|
||||
<p>You cannot push changes to a remote when that remote has changes that you haven’t yet pulled, you’ll get an error like:</p>
|
||||
|
||||
<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>git push
|
||||
To ...
|
||||
<span class="o">!</span> <span class="o">[</span>rejected] milestone-1-develop -> milestone-1-develop <span class="o">(</span>non-fast-forward<span class="o">)</span>
|
||||
error: failed to push some refs to <span class="s1">'...'</span>
|
||||
hint: Updates were rejected because the tip of your current branch is behind
|
||||
hint: its remote counterpart. Integrate the remote changes <span class="o">(</span>e.g.
|
||||
hint: <span class="s1">'git pull ...'</span><span class="o">)</span> before pushing again.
|
||||
hint: See the <span class="s1">'Note about fast-forwards'</span> <span class="k">in</span> <span class="s1">'git push --help'</span> <span class="k">for </span>details.
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>First pull changes with <code class="language-plaintext highlighter-rouge">git pull</code> and then push your changes.</p>
|
||||
|
||||
<h4 id="cannot-pull">Cannot pull</h4>
|
||||
|
||||
<p><strong>Local changes</strong></p>
|
||||
|
||||
<p>When you have changes in your local repository that you have not committed yet, and you try to pull, Git may complain about your changes being overwritten.
|
||||
First add and commit your changes locally with:</p>
|
||||
|
||||
<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>git add <span class="nt">--all</span>
|
||||
git commit <span class="nt">-m</span> <span class="s2">"Message describing your changes"</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>and then pull changes with <code class="language-plaintext highlighter-rouge">git pull</code>.</p>
|
||||
|
||||
<h4 id="cannot-automatically-merge-merge-request">Cannot automatically merge merge request</h4>
|
||||
|
||||
<p>If a merge request cannot be automatically merged, your branch is out of date with the <em>template</em> branch.
|
||||
Merge in changes from the template (use the correct branch!):</p>
|
||||
|
||||
<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>git fetch origin
|
||||
git merge origin/milestone-1-template
|
||||
git push
|
||||
</code></pre></div></div>
|
||||
|
||||
<h4 id="resolving-merge-conflicts">Resolving merge conflicts</h4>
|
||||
|
||||
<p>See <a href="https://help.github.com/articles/resolving-a-merge-conflict-from-the-command-line/">Resolving a merge conflict</a> on how to resolve merge conflicts.
|
||||
You can also try a GUI merge tool such as <a href="https://sourcegear.com/diffmerge/">DiffMerge</a> to resolve merge conflicts.</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1c.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../milestone/0.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<ul id="my_toc" class="toc list-group list-group-flush d-none d-lg-block d-xl-block p-0 ml-0 mt-3">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1d.html#git">Git</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1d.html#repository-structure">Repository Structure</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1d.html#getting-started">Getting started</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1d.html#starting-an-assignment">Starting an assignment</a>
|
||||
<ul class="toc-sub pl-0">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1d.html#template">Template</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1d.html#continue-from-previous-assignment">Continue from previous assignment</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1d.html#saving-work">Saving work</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1d.html#continuous-integration-ci">Continuous Integration (CI)</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1d.html#submitting-a-milestone">Submitting a milestone</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1d.html#switching-to-another-milestone">Switching to another milestone</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1d.html#pulling-in-changes-from-template">Pulling in changes from template</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1d.html#git-gui-clients">Git GUI clients</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1d.html#troubleshooting">Troubleshooting</a>
|
||||
<ul class="toc-sub pl-0">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1d.html#cannot-push">Cannot push</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1d.html#cannot-pull">Cannot pull</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1d.html#cannot-automatically-merge-merge-request">Cannot automatically merge merge request</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1d.html#resolving-merge-conflicts">Resolving merge conflicts</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1c.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../milestone/0.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
1060
lab/2.html
Normal file
895
lab/3a.html
Normal file
|
|
@ -0,0 +1,895 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Lab 3(a): Setting up Static Analysis</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
<a href="https://tudelft-cs4200.github.io/2021">
|
||||
<img class="border border-dark" width="100%" src="../project/2021/00-lab1a/spoofax.png"/>
|
||||
</a>
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Lab 3(a): Setting up Static Analysis
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Project Set-up
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
September 22, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<p>In this lab, you define the static analysis of ChocoPy in Spoofax.
|
||||
Follow the instructions from <a href="https://tudelft-cs4200.github.io/2021/lab/1a/">Lab 1(a)</a> for using Spoofax.</p>
|
||||
|
||||
<h4 id="modifying-the-static-analysis">Modifying the Static Analysis</h4>
|
||||
|
||||
<p>Static analysis is implement in the Statix language of Spoofax.
|
||||
The <code class="language-plaintext highlighter-rouge">/src/main.stx</code> file is the main Statix file.
|
||||
You can define static analysis rules in this main file, but it is probably a good idea to distribute your Statix definition over multiple modules, as Statix is a modular language.
|
||||
If you create new modules, you must import them into <code class="language-plaintext highlighter-rouge">/src/main.stx</code>.</p>
|
||||
|
||||
<h3 id="references">References</h3>
|
||||
|
||||
|
||||
|
||||
|
||||
<ul class="list-group list-group-flush pb-3">
|
||||
|
||||
|
||||
<li class="list-group-item pl-lg-0 border-0 pb-0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-success pl-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<a name="Spoofax3"></a>
|
||||
|
||||
<a class="font-weight-bold text-dark" target="_blank" href="https://www.spoofax.dev/spoofax-pie/develop/">Spoofax 3 (Documentation) </a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light" style="font-size:90%;">
|
||||
|
||||
(editor).
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
|
||||
|
||||
|
||||
|
||||
https://www.spoofax.dev/spoofax-pie/develop/ 2021
|
||||
|
||||
|
||||
|
||||
[<a class="text-secondary" target="_blank" href="https://researchr.org/publication/Spoofax3/bibtex">bib</a>, <a href="https://researchr.org/publication/Spoofax3" class="text-secondary" target="_blank">researchr</a>]
|
||||
|
||||
<!-- Spoofax3 -->
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item pl-lg-0 border-0 pb-0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-success pl-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<a name="Spoofax2021"></a>
|
||||
|
||||
<a class="font-weight-bold text-dark" target="_blank" href="https://www.spoofax.dev/">Spoofax: The Language Designer's Workbench</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light" style="font-size:90%;">
|
||||
|
||||
(editor).
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
|
||||
|
||||
|
||||
|
||||
https://www.spoofax.dev/ 2021
|
||||
|
||||
|
||||
|
||||
[<a class="text-secondary" target="_blank" href="https://researchr.org/publication/Spoofax2021/bibtex">bib</a>, <a href="https://researchr.org/publication/Spoofax2021" class="text-secondary" target="_blank">researchr</a>]
|
||||
|
||||
<!-- Spoofax2021 -->
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="2.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="3b.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<ul id="my_toc" class="toc list-group list-group-flush d-none d-lg-block d-xl-block p-0 ml-0 mt-3">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="3a.html#modifying-the-static-analysis">Modifying the Static Analysis</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="2.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="3b.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
615
lab/3b.html
Normal file
|
|
@ -0,0 +1,615 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Lab 3(b): Creating Static Analysis Tests</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Lab 3(b): Creating Static Analysis Tests
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Project
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
September 22, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<p>Before getting started with your static analysis definition, you set up a test suite for static analysis. Develop the test suite in tandem with the development of your static analysis. The test suite consists of positive and negative test cases. We will not grade this test suite, but you should develop one to get confidence in the quality of your static analysis. When you are asking for help from the course staff, we will first ask what tests you have written to demonstrate the problem.</p>
|
||||
|
||||
<h3 id="objectives">Objectives</h3>
|
||||
|
||||
<p>In your chocopy project, develop a test suite for static analysis. The test suite should provide</p>
|
||||
|
||||
<ol>
|
||||
<li>Test cases for types</li>
|
||||
<li>Test cases for name resolution</li>
|
||||
<li>Test cases for errors</li>
|
||||
</ol>
|
||||
|
||||
<h3 id="testing-type-constraints">Testing Type Constraints</h3>
|
||||
|
||||
<p>See the example tests in the WebLab homework assignments for Week 3.</p>
|
||||
|
||||
<h3 id="testing-reference-resolution">Testing Reference Resolution</h3>
|
||||
|
||||
<p>In test cases for reference resolution,
|
||||
you write syntactically correct programs and
|
||||
mark names at definition and use sites with inner square bracket blocks.
|
||||
You can then relate the use site with the definition site in a <code class="language-plaintext highlighter-rouge">resolve x to y</code> clause,
|
||||
using numbers to refer to the inner blocks.
|
||||
For example, the following two test cases require to resolve the type <code class="language-plaintext highlighter-rouge">Foo</code> to the name in the definition of class <code class="language-plaintext highlighter-rouge">Foo</code>:</p>
|
||||
|
||||
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>module resolution
|
||||
|
||||
test class name resolution[[
|
||||
class [[A]](object):
|
||||
pass
|
||||
|
||||
class B(object):
|
||||
a:[[A]] = None
|
||||
]] resolve #2 to #1
|
||||
|
||||
test class field resolution[[
|
||||
class Foo(object):
|
||||
[[bar]]:int = 0
|
||||
|
||||
foo:Foo = None
|
||||
foo = Foo()
|
||||
print(foo.[[bar]])
|
||||
]] resolve #2 to #1
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>After copying this into an SPT file Spoofax will add the error <em>“Reference resolution failed”</em> and <em>“No constraint generation rule for …“</em>. This is expected, since your project is missing an implementation for reference resolution (this is part of the next lab).</p>
|
||||
|
||||
<p>You can use <em>fixtures</em> to avoid repeating parts in similar test cases. See the SPT documentation for details.</p>
|
||||
|
||||
<p>You should come up with test cases for the resolution of class names, field names, parameter names, and variable names.
|
||||
Start with simple test cases, but keep in mind that coverage is the main criterion for your grade.
|
||||
It is important to think about
|
||||
forward and backward references,
|
||||
global and non-local declarations in functions,
|
||||
and resolution in the presence of homonyms.</p>
|
||||
|
||||
<p class="notice notice-warning">Make sure that there are no errors in tests with a <code class="language-plaintext highlighter-rouge">resolve x to y</code> clause, these tests are invalid when there are errors.</p>
|
||||
|
||||
<h3 id="testing-error-checking">Testing Error Checking</h3>
|
||||
|
||||
<p>In test cases for error checking, you need to specify the number of errors, warnings, or notes in a
|
||||
test case in <code class="language-plaintext highlighter-rouge">errors</code>, <code class="language-plaintext highlighter-rouge">warnings</code>, or <code class="language-plaintext highlighter-rouge">notes</code> clauses. For example, the following test cases
|
||||
specify a correct ChocoPy program, a program with two errors which are reported on the name of a
|
||||
duplicate class <code class="language-plaintext highlighter-rouge">Foo</code>, and another program with an error which is reported on the name of an unknown
|
||||
class <code class="language-plaintext highlighter-rouge">Bar</code>:</p>
|
||||
|
||||
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>module correctness
|
||||
|
||||
language chocopy
|
||||
|
||||
test correct program [[
|
||||
class Counter(object):
|
||||
count:int = 0
|
||||
|
||||
def getCount(self:Counter)->int:
|
||||
return self.count
|
||||
|
||||
def increaseCount(self:Counter):
|
||||
self.count = self.count + 1
|
||||
]] 0 errors
|
||||
|
||||
test incorrect program [[
|
||||
class Counter(object):
|
||||
count:bool = False
|
||||
|
||||
def getCount(self:Counter)->int:
|
||||
return self.count
|
||||
|
||||
def increaseCount(self:Counter):
|
||||
self.count = self.count + 1
|
||||
]] >= 1 errors // or 3 errors
|
||||
|
||||
test error on unknown class [[
|
||||
class Foo(object):
|
||||
bar:Bar = None
|
||||
]] >= 1 errors
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>You can start with test cases for duplicate and missing definitions. Similar to your syntax test
|
||||
cases, you can pair up positive (<code class="language-plaintext highlighter-rouge">0 errors</code>) and negative test cases. For duplicate definitions, we
|
||||
expect errors on the definitions with the same name.</p>
|
||||
|
||||
<p class="notice notice-warning">The number of errors can be hard to predict, because errors sometimes cascade. Therefore, if you
|
||||
expect any errors, you should use the <code class="language-plaintext highlighter-rouge">>= 1 errors</code> expectation, even if you expect a specific
|
||||
number of errors. For example, this expectation was used in the duplicate class test, even though we
|
||||
would expect exactly two errors.</p>
|
||||
|
||||
<p>Next, you should develop test cases for fields and variables which hide global variables, global and non-local declarations, and class
|
||||
instantiation, subclassing, referencing. Again, you should keep in mind that coverage is the main
|
||||
criterion for your grade.</p>
|
||||
|
||||
<h3 id="testing-types-of-expressions">Testing Types of Expressions</h3>
|
||||
|
||||
<p>In test cases for type analysis,
|
||||
you write syntactically correct programs and
|
||||
mark expressions with inner square bracket blocks.
|
||||
You can then specify the expected type of the marked expression in a <code class="language-plaintext highlighter-rouge">run x to y</code> clause.
|
||||
For example, the following two test cases require an integer literal to be of type <code class="language-plaintext highlighter-rouge">Int()</code>
|
||||
and a variable reference to be of its declared type <code class="language-plaintext highlighter-rouge">Bool()</code>:</p>
|
||||
|
||||
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>module types
|
||||
|
||||
test integer literal [[
|
||||
print([[1]])
|
||||
]] run get-type on #1 to Int()
|
||||
|
||||
test boolean condition [[
|
||||
b1:bool = True
|
||||
b2:bool = False
|
||||
if [[b1 and b2]]:
|
||||
print("Yes!")
|
||||
]] run get-type on #1 to Bool()
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>In order for these tests to succeed, you need to define your own Stratego rule <code class="language-plaintext highlighter-rouge">get-type</code>. For this, you can copy and paste the following code into <code class="language-plaintext highlighter-rouge">src/main.str2</code></p>
|
||||
|
||||
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>signature
|
||||
sorts
|
||||
Type
|
||||
|
||||
constructors
|
||||
Int : Type
|
||||
Bool : Type
|
||||
String : Type
|
||||
ClassType : scope * ID -> Type
|
||||
List : Type -> Type
|
||||
NoneType : Type
|
||||
EmptyList : Type
|
||||
Object : Type
|
||||
FunType : Type * list(Type) -> Type
|
||||
// We expect to get these types in the grading pipeline
|
||||
// you are free to use your own (custom) types in your Statix file
|
||||
// as long as you write transformation rules from your types to our types
|
||||
// in resolve-type
|
||||
|
||||
// Here you can define the signature of the types you have used in your Statix definitions.
|
||||
// This is just an example on how to do it.
|
||||
// signature
|
||||
// sorts
|
||||
// MyCustomType
|
||||
//
|
||||
// constructors
|
||||
// MyCustomIntType : MyCustomType
|
||||
// MyCustomClassType : ID * scope -> MyCustomType
|
||||
|
||||
rules
|
||||
// get-type: SimpleStatement(expr) -> <get-type> expr // An example on how to match on AST nodes.
|
||||
get-type: expr -> type' // Defines a rule which matches on node and returns type'
|
||||
where
|
||||
// Assigns variable a to be the result of the Statix analysis of the entire program (or throws an error)
|
||||
a := <stx-get-ast-analysis <+ fail-msg(|$[no analysis on node [<strip-annos;write-to-string> expr]])>;
|
||||
// Gets the type of the given node (or throws an error)
|
||||
type := <stx-get-ast-type(|a) <+ fail-msg(|$[no type on node [<strip-annos;write-to-string> expr]])> expr;
|
||||
// Calls a rule to convert the type given by Statix to a type for our tests.
|
||||
type' := <resolve-type> type
|
||||
|
||||
// resolve-type: MyCustomIntType() -> Int() // This rule matches on your custom type, and returns a type we need in our tests.
|
||||
// resolve-type: MyCustomClassType(name, scope) -> ClassType(scope, name) // This rule matches on your custom type, and returns a type we need in our tests.
|
||||
// TODO: Define your own transformation rules to transform types from your Statix defintion to the types we expect in our tests
|
||||
resolve-type: a -> a // This rule matches on a and returns a (trivial rule given as example). This implies no transformation actually takes place. Define your own rules ABOVE this rule.
|
||||
|
||||
fail-msg(|msg) = err-msg(|$[get-type: [msg]]); fail
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>This code defines a Stratego rule <code class="language-plaintext highlighter-rouge">get-type</code> which we can use to map AST Nodes to their types using the results of the Statix analysis. In our tests for the Early Feedback and Grading, we expect certain types, so it is highly recommended to use the same types in your Statix rules. If not, you might need to perform some extra transformations from your types to our types in the <code class="language-plaintext highlighter-rouge">resolve-type</code> rule.</p>
|
||||
|
||||
<p>For more information on the Stratego language, visit the Stratego documentation.</p>
|
||||
|
||||
<p>You can use <em>fixtures</em> to avoid repeating parts in similar test cases. See the
|
||||
SPT documentation
|
||||
for details.</p>
|
||||
|
||||
<p>When applying <code class="language-plaintext highlighter-rouge">get-type</code> to objects, we expect a <code class="language-plaintext highlighter-rouge">ClassType</code> constructor.</p>
|
||||
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>test class type [[
|
||||
class Foo(object):
|
||||
pass
|
||||
[[Foo()]]
|
||||
]] run get-type on #1 to ClassType(_, "Foo") // We don't care about the scope, only the classname.
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>You should come up with test cases for the types of all kinds of expressions. Just like previous
|
||||
testing assignments, this assignment is all about the coverage of your test suite.</p>
|
||||
|
||||
<p>The constructors for various types are:</p>
|
||||
|
||||
<ul>
|
||||
<li>Integer: <code class="language-plaintext highlighter-rouge">Int()</code></li>
|
||||
<li>Boolean: <code class="language-plaintext highlighter-rouge">Bool()</code></li>
|
||||
<li>String: <code class="language-plaintext highlighter-rouge">String()</code></li>
|
||||
<li>List of Type T: <code class="language-plaintext highlighter-rouge">List(T)</code></li>
|
||||
<li>Empty list type: <code class="language-plaintext highlighter-rouge">EmptyList()</code></li>
|
||||
<li>None type: <code class="language-plaintext highlighter-rouge">NoneType()</code></li>
|
||||
<li>Class with name Foo and scope s: <code class="language-plaintext highlighter-rouge">ClassType(s, "Foo")</code></li>
|
||||
<li>Function with return Type RT and a list of parameter types PTs: <code class="language-plaintext highlighter-rouge">FunType(RT, PTs)</code></li>
|
||||
<li>Object: <code class="language-plaintext highlighter-rouge">Object()</code></li>
|
||||
</ul>
|
||||
|
||||
<p class="notice notice-warning">Tests that contain a <code class="language-plaintext highlighter-rouge">run x to y</code> clause are invalid if the semantic analysis yields errors. Ensure that the snippet of ChocoPy that you are testing does not contain any errors if you want to use <code class="language-plaintext highlighter-rouge">get-type</code> or other strategies.</p>
|
||||
|
||||
<p class="notice notice-warning">If you use a start symbol other than <code class="language-plaintext highlighter-rouge">Program</code>, replace any samples in this guide that use <code class="language-plaintext highlighter-rouge">Program</code> with your start symbol instead.</p>
|
||||
|
||||
<p>Make sure to actually append your AST nodes with their types using <code class="language-plaintext highlighter-rouge">@x.type := T</code> (in a similar way to assigning the <code class="language-plaintext highlighter-rouge">ref</code> property, which is needed for name resolution). Otherwise the rule will not find any types on your AST node.</p>
|
||||
|
||||
<h3 id="testing-method-name-resolution">Testing Method Name Resolution</h3>
|
||||
|
||||
<p>Consider the following test case as an example:</p>
|
||||
|
||||
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>test method name resolution [[
|
||||
class Foo(object):
|
||||
def [[run]](self:Foo)->int:
|
||||
return 1
|
||||
Foo().[[run]]()
|
||||
]] resolve #2 to #1
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>The type of the callee expression determines the class in which the method declaration can be found.
|
||||
In this example, the expression <code class="language-plaintext highlighter-rouge">Foo()</code> is of type <code class="language-plaintext highlighter-rouge">ClassType(_, "Foo")</code> and
|
||||
the corresponding class <code class="language-plaintext highlighter-rouge">Foo</code> contains a method declaration for <code class="language-plaintext highlighter-rouge">run()</code>.</p>
|
||||
|
||||
<p>You should come up with test cases for the resolution of method names.
|
||||
Start with simple test cases, but keep in mind that method name resolution is quite complex
|
||||
and that coverage is the main criterion for your grade.
|
||||
It is important to think about forward and backward references,
|
||||
resolution in the presence of homonyms and overriding,
|
||||
and the influence of class hierarchies on resolution.</p>
|
||||
|
||||
<p>You should also come up with test cases for error checking on method names.
|
||||
This should include test cases for errors on duplicate definitions, missing definitions, and method overloading.
|
||||
Similar to previous test cases, you can pair up positive (<code class="language-plaintext highlighter-rouge">0 errors</code>) and negative test cases.</p>
|
||||
|
||||
<p class="notice notice-warning">Make sure that there are no errors in tests with a <code class="language-plaintext highlighter-rouge">resolve x to y</code> clause. These tests are invalid when there are errors.</p>
|
||||
|
||||
<h3 id="testing-type-error-checking">Testing Type Error Checking</h3>
|
||||
|
||||
<p>A type error occurs, when the type of an expression does not conform to its expected type.
|
||||
Consider the following test case as an example:</p>
|
||||
|
||||
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>test print boolean [[
|
||||
def printInt(i:int):
|
||||
print(i)
|
||||
printInt(True)
|
||||
]] 1 error
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Type errors can occur in statements, expressions, and method declarations.
|
||||
You should come up with test cases for such errors.
|
||||
Subtyping is a common source for errors not only in programs, but also in language implementations.
|
||||
It is therefore important to have positive and negative typing tests, which involve correct and incorrect subtyping.</p>
|
||||
|
||||
<p>Again, keep in mind that coverage is the main criterion for your grade.</p>
|
||||
|
||||
<h3 id="number-of-errors">Number of errors</h3>
|
||||
|
||||
<p>Similar to the previous testing lab, you need to be careful about the number of errors, because
|
||||
errors sometimes cascade. For example, if you expect <em>2</em> errors, you should use the <code class="language-plaintext highlighter-rouge">>= 2 errors</code>
|
||||
expectation, even if you expect an exact number of errors.</p>
|
||||
|
||||
<h3 id="a-final-note">A final note</h3>
|
||||
<p>A great way of testing expected ChocoPy behavior, when you want to know whether something is allowed or not, is to try it out on the <a href="https://chocopy.org/">ChocoPy Website</a></p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="3a.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="3c.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<ul id="my_toc" class="toc list-group list-group-flush d-none d-lg-block d-xl-block p-0 ml-0 mt-3">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="3b.html#objectives">Objectives</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="3b.html#testing-type-constraints">Testing Type Constraints</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="3b.html#testing-reference-resolution">Testing Reference Resolution</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="3b.html#testing-error-checking">Testing Error Checking</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="3b.html#testing-types-of-expressions">Testing Types of Expressions</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="3b.html#testing-method-name-resolution">Testing Method Name Resolution</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="3b.html#testing-type-error-checking">Testing Type Error Checking</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="3b.html#number-of-errors">Number of errors</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="3b.html#a-final-note">A final note</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="3a.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="3c.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
332
lab/3c.html
Normal file
|
|
@ -0,0 +1,332 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Lab 3(c): Simple Types</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Lab 3(c): Simple Types
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Project
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
September 22, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<p>Read Section 4 of the <a href="https://tudelft-cs4200.github.io/labl/0a">ChocoPy Reference Manual</a> with the type rules of the language.
|
||||
In the remaining labs of the course, you will translate those type rules into formal Statix rules in order to implement a type checker.
|
||||
You should submit the result, a complete type system implementation of ChocoPy in Statix, in <a href="../milestone/2.html">Milestone 2</a>.
|
||||
You can proceed at your own pace, but in this and the following lab descriptions, we give some ideas for ordering the task.</p>
|
||||
|
||||
<p>In this lab, follow <a href="../lecture/4.html">Lecture 4</a> and the homework assignments for <a href="../homework/1-3.html">Week 3</a> to define a predicate (say <code class="language-plaintext highlighter-rouge">typeOfExp</code>) to test the type correctness of expressions without names (variables, functions).</p>
|
||||
|
||||
<p>For more information on Statix, see also the <a href="https://www.spoofax.dev/references/statix/">Spoofax 2 documentation on Statix</a>. Most of the information in this document will also apply to Spoofax 3.</p>
|
||||
|
||||
<p>For now, ignore the contexts in the typing rules. You can see (by tracing the rules) that for expressions not involving names, those contexts are irrelevant. In the predicate, you can either leave the context out entirely, or you can pass around a dummy ‘scope’. (We will study scopes in the next lecture.)
|
||||
In the latter case, you need to figure out how to create the dummy scope. In the former case you will need to add scopes later, but that should be a simple find-and-replace action.</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="3b.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../milestone/1.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="3b.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../milestone/1.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
318
lab/4.html
Normal file
|
|
@ -0,0 +1,318 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Lab 4: Local Names</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Lab 4: Local Names
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Project
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
September 29, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<p>In this lab, follow <a href="../lecture/5.html">Lecture 5</a> and the homework assignments for <a href="../homework/1-4.html">Week 4</a> to extend the type checking predicates with name resolution.</p>
|
||||
|
||||
<p>Continue your study of Section 4 of the <a href="0a.html">ChocoPy Reference Manual</a> with the type rules of the language.</p>
|
||||
|
||||
<p>Start with the definition of local variable declarations and variable references in this first lab. Next add formal parameters of functions.</p>
|
||||
|
||||
<p>Define test cases to validate your definition. Make sure to test for shadowing of variables. Did you implement the correct visibility policy in your resolution queries?</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../milestone/1.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="5.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../milestone/1.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="5.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
311
lab/5.html
Normal file
|
|
@ -0,0 +1,311 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Lab 5: Functions and Classes</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Lab 5: Functions and Classes
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Project
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
October 06, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<p>Continue your study of Section 4 of the <a href="https://tudelft-cs4200.github.io/2021/labl/0a">ChocoPy Reference Manual</a> with the type rules of the language.</p>
|
||||
|
||||
<p>Finish the definition of local variables and function parameters (<a href="4.html">Lab 4</a>).</p>
|
||||
|
||||
<p>Move on to definition of function definitions and function calls, classes with inheritance, method definitions, and method calls.</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="4.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="6.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="4.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="6.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
304
lab/6.html
Normal file
|
|
@ -0,0 +1,304 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Lab 6: Preparing Milestone 2 Submission (2020)</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Lab 6: Preparing Milestone 2 Submission (2020)
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Project
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
October 13, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<p>You have two labs left until the <a href="../milestone/2.html">Milestone 2</a>.</p>
|
||||
|
||||
<p>Make sure to test the corner cases of type checking ChocoPy and use the early feedback to see how well you are doing.</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="5.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="7.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="5.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="7.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
299
lab/7.html
Normal file
|
|
@ -0,0 +1,299 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Lab 7: Finish Front-End (2020)</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Lab 7: Finish Front-End (2020)
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Project
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
October 20, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<p>You have one lab left until the <a href="../milestone/2.html">Milestone 2</a>.</p>
|
||||
|
||||
<p>Make sure to test the corner cases of type checking ChocoPy and use the early feedback to see how well you are doing.</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="6.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../milestone/2.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="6.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../milestone/2.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
659
lab/8.html
Normal file
|
|
@ -0,0 +1,659 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Lab 8: Simple Transformation</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Lab 8: Simple Transformation
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Project
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
November 12, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<p>During this lab get to know Stratego by making the <a href="https://weblab.tudelft.nl/cs4200/2021-2022/assignment/88076/view">homework assignments for Week 1</a> either in Spoofax 3 or in WebLab.</p>
|
||||
|
||||
<!--
|
||||
|
||||
This lab is your first encounter with Stratego.
|
||||
You add an outline view and a desugaring transformation to an initial editor provided by us.
|
||||
|
||||
|
||||
### Objectives
|
||||
|
||||
1. Specify rewrite rules `to-outline-label` which map AST nodes to labels in an outline view. You should include:
|
||||
* classes (class name and, if available, parent class name),
|
||||
* fields (field name and type),
|
||||
* methods (method name, parameter types, return type) and
|
||||
* local variables (variable name and type).
|
||||
2. Define rewrite rules `desugar` which desugar
|
||||
* unary expressions into terms of the form `UnExp(op, exp)`,
|
||||
* binary expressions into terms of the form `BinExp(op, exp1, exp2)` and
|
||||
3. Integrate `desugar` into a strategy `desugar-all` which desugars subtrees in an AST.
|
||||
|
||||
For grading, it is required to comply with all constructor names, rule names, and strategy names literally.
|
||||
|
||||
<!-- ### Submission
|
||||
|
||||
You need to submit your ChocoPy project with a merge request against branch `assignment-3-submission` on GitLab.
|
||||
The [Git documentation](/project/lab1d) explains how to file such a request. -->
|
||||
|
||||
<!-- ### Early Feedback
|
||||
|
||||
We provide early feedback for the correctness of your outline and desugarings.
|
||||
This feedback is a score out of 90 points; the strategy choice (10 points) is graded manually.
|
||||
You have 3 early feedback attempts. -->
|
||||
|
||||
<!--
|
||||
### Preliminaries
|
||||
|
||||
#### GitLab Repository
|
||||
|
||||
We provide you with a template for this assignment.
|
||||
See the [Git documentation](/2021/lab/1d) on how to check out this branch.
|
||||
Make sure to read the `README.md` in the root of the repository, as it contains further instructions that are specific to this template.
|
||||
|
||||
#### Anatomy of a Spoofax Project
|
||||
|
||||
Until now, you mainly worked on files in the `syntax` folder of your project.
|
||||
During this lab you will also edit files in the `trans` folder.
|
||||
So, this is a good point to talk about the general structure of a Spoofax project.
|
||||
Note: this general structure does not apply to the template we've given you for the project, considering it contains a compiled version of the front-end already.
|
||||
|
||||
First of all, every Spoofax project may be part of an Eclipse plug-in project.
|
||||
This allows you to deploy your editor as a plugin using the Eclipse update site mechanism.
|
||||
Users do not need to have Spoofax installed for using your editor.
|
||||
|
||||
The actual language definition is spread over three folders:
|
||||
|
||||
* `syntax` contains all syntax definition files, including the main file `chocopy.sdf3`.
|
||||
* `trans` contains all transformation files, including the main file `chocopy.str`.
|
||||
* `editor` contains editor service definition files, including the main file `Main.esv`.
|
||||
|
||||
In the `src-gen` folder, you will find files which were generated from your syntax definition.
|
||||
For each file `<name>.sdf3`, there are generated files:
|
||||
|
||||
* `syntax/<name>.sdf`: an SDF2 definition which is equivalent to the SDF3 definition.
|
||||
* `completions/<name>-cp.str`: abstract placeholder expansions for syntactic code completion derived from SDF3 templates.
|
||||
* `completions/colorer/<name>-cc-esv.esv`: instructions to color placeholders for syntactic completions in gray.
|
||||
* `pp/<name>-pp.str`: pretty-printing strategies derived from SDF3 templates.
|
||||
* `signatures/<name>-sig.str`: signatures derived from SDF3 templates.
|
||||
|
||||
You can find more generated files in `src-gen` and `target/metaborg` folders:
|
||||
|
||||
* `src-gen/syntax/ChocoPy.def`: your complete syntax definition in SDF2.
|
||||
* `src-gen/syntax/ChocoPy-Permissive.def`: a permissive version of the syntax definition, which supports error recovery.
|
||||
* `target/metaborg/ChocoPy.tbl`: the parse table of your language.
|
||||
* `src-gen/pp/ChocoPy-parenthesize.str`: strategies to add parentheses to an AST according to the priorities of your language.
|
||||
* `target/metaborg/stratego.ctree` and/or `target/metaborg/stratego.jar`: compiled Stratego code of your language.
|
||||
|
||||
#### Initial Editor Project
|
||||
|
||||
We provide you with an initial ChocoPy project in the branch `milestone-3-template`.
|
||||
This project is a common starting point for all of you.
|
||||
It includes:
|
||||
|
||||
* A compiled version of a front-end ChocoPy project.
|
||||
* corresponding signatures `reference/src-gen/signatures/*-sig.str`,
|
||||
* pretty-printing definitions `reference/src-gen/pp/*-pp.str`, and a
|
||||
* content-completion definitions `reference/src-gen/completion/*-cp.str` (errors in the completion files can be ignored).
|
||||
|
||||
During the building of the project the contents of `reference` will be copied over to `src-gen`.
|
||||
So, when importing any module from the reference, you can just use the 'local' variant.
|
||||
I.e. instead of importing `reference/src-gen/signatures/chocopy-sig`, please import `signatures/chocopy-sig`.
|
||||
|
||||
#### Signature
|
||||
|
||||
Signatures declare sorts and constructors for terms.
|
||||
In Spoofax, terms are used to represent abstract syntax trees.
|
||||
The corresponding signature is generated from the constructors in a syntax definition.
|
||||
You can find the signature for ChocoPy in the files `reference/src-gen/signatures/*-sig.str`.
|
||||
The signature was generated from a syntax definition, which itself is not included in the initial project.
|
||||
If you write your own syntax definition, the generated signatures can be found in `src-gen/signatures/`.
|
||||
|
||||
### Outline View
|
||||
|
||||
#### Rewrite Rules
|
||||
|
||||
An outline view can be specified by rewrite rules `to-outline-label` in `trans/outline.str`.
|
||||
These rules should rewrite AST nodes to their label in an outline view.
|
||||
For example, the following rule rewrites a variable declaration to its name, which will be used as a label.
|
||||
|
||||
```
|
||||
rules
|
||||
|
||||
to-outline-label: Var(t, v) -> v
|
||||
```
|
||||
|
||||
On the left-hand side, the rule matches a variable declaration.
|
||||
During the match, variables `t` and `v` are bound to actual terms.
|
||||
On the right-hand side, the rule instantiates a label.
|
||||
During the instantiation, variable `v` is replaced with the term it is bound to.
|
||||
You can extend `to-outline-label` to provide labels for
|
||||
|
||||
* class declarations,
|
||||
* field declarations and
|
||||
* method declarations.
|
||||
|
||||
When you build the project and open a ChocoPy file, you will get an outline of this program in the outline view.
|
||||
In case you do not see any outline view, you can select it in *Show View* from Eclipse's *Window* menu.
|
||||
|
||||
#### Naming Conventions
|
||||
|
||||
In Stratego, we use the following naming conventions:
|
||||
|
||||
* constructor and sort names: camel case, starting with an upper case (e.g. `Add`, `BinExp`)
|
||||
* rule names, strategy names, variable names: lower case, multiple words separated by `-` (e.g. `e1`, `project-path`)
|
||||
|
||||
#### String Interpolation
|
||||
|
||||
In many cases, you want to provide more information than just the name.
|
||||
For example, you might want to show not only a variable's name, but also it's type.
|
||||
The following rule achieves this:
|
||||
|
||||
```
|
||||
to-outline-label:
|
||||
Var(t, v) -> label
|
||||
where
|
||||
t' := <pp-partial-ChocoPy-string> t
|
||||
; label := <concat-strings> [v, ": ", t']
|
||||
```
|
||||
|
||||
On its right-hand side, it produces a `label`, which is bound in the `where` clause.
|
||||
First, the term bound to `t` is turned into a string bound to `t'` by applying a strategy `pp-partial-ChocoPy-string`.
|
||||
This strategy is defined in `ChocoPy/trans/pp.str` and uses the pretty-printing rules generated from our SDF3 grammar for ChocoPy.
|
||||
|
||||
Next, the label is bound to the concatenation of
|
||||
the string bound to `v`,
|
||||
a constant string `": "`,
|
||||
and the string bound to `t'`.
|
||||
|
||||
String concatenation is not very intuitive.
|
||||
Instead, you can also use string interpolation:
|
||||
|
||||
```
|
||||
to-outline-label:
|
||||
Var(t, v) -> $[[v]: [t']]
|
||||
where
|
||||
t' := <pp-partial-ChocoPy-string> t
|
||||
```
|
||||
|
||||
String interpolation allows you to combine text with variables.
|
||||
Text is enclosed in `$[` and `]`, while variables inside the text are enclosed in `[` and `]`.
|
||||
These variables need to be bound to strings.
|
||||
|
||||
You should provide the following information in your outline labels:
|
||||
|
||||
* class name and super class name
|
||||
* field name and type
|
||||
* method name, parameter types (not parameter names), return type
|
||||
* variable name and type
|
||||
|
||||
For parameter types, you need to turn a list of parameters into a string.
|
||||
You can do this with a recursive strategy:
|
||||
|
||||
```
|
||||
pp-params: // empty parameter list
|
||||
[] -> ...
|
||||
|
||||
pp-params: // single parameter
|
||||
[TypedVar(p, t)] -> ...
|
||||
|
||||
pp-params: // at least two parameters
|
||||
[TypedVar(p, t), param | params] -> ...
|
||||
where
|
||||
// do something on first parameter
|
||||
...
|
||||
// recursive call on remaining parameters
|
||||
... := <pp-params> [param | params]
|
||||
```
|
||||
|
||||
For grading, it is required to define a strategy `pp-params` that always rewrites a list of `TypedVar`s to a *string*.
|
||||
{: .notice .notice-warning}
|
||||
|
||||
Your current outline view is missing a root node.
|
||||
You can add a root node by providing a label for programs.
|
||||
|
||||
#### Annotations
|
||||
|
||||
In Stratego, terms can be annotated with additional information.
|
||||
The Spoofax outline view uses annotations to determine the icon of a node.
|
||||
You can specify the icon to use in an annotation:
|
||||
|
||||
```
|
||||
to-outline-label:
|
||||
Var(t, v) -> label{icon}
|
||||
where
|
||||
t' := <pp-partial-ChocoPy-string> t
|
||||
; label := $[[v]: [t']]
|
||||
; icon := "icons/var.gif"
|
||||
```
|
||||
|
||||
We do not require you to use icons and you will not earn any points with them.
|
||||
If you want to use them anyway, you should put the icons into the folder `icons`
|
||||
and place a proper attribution or license file next to them.
|
||||
|
||||
#### Challenge
|
||||
|
||||
Challenges are meant to distinguish excellent solutions from good solutions.
|
||||
Typically, they are less guided and require more investigation or higher programming skills.
|
||||
{: .notice .notice-success}
|
||||
|
||||
|
||||
1. Provide the file name as the root node label. In `outline.str`: import, command/control click and study `libspoofax/term/origin` for a suitable strategy.
|
||||
|
||||
2. Outline the main method as a subnode of the main class.
|
||||
You need to change this strategy in the `outline.str` file:
|
||||
|
||||
```
|
||||
outline := <custom-label-outline(to-outline-label, to-outline-node)> ast
|
||||
```
|
||||
|
||||
Also import, command/control click, and investigate `libspoofax/editor/outline` for inspiration.
|
||||
|
||||
3. Use one of the library strategies for folding to implement `pp-params`. You can find various folding strategies in the [API docs](http://releases.strategoxt.org/docs/api/libstratego-lib/stable/docs/).
|
||||
|
||||
### Desugaring
|
||||
|
||||
A uniform representation of unary and binary expressions eases static analysis and code generation.
|
||||
To get such a uniform representation, you need to desugar abstract syntax trees during the analysis phase.
|
||||
|
||||
#### Signature
|
||||
|
||||
Before you can implement a desugaring,
|
||||
you need to define a signature for the uniform representation of expressions in `trans/desugar.str`:
|
||||
|
||||
1. Identify unary and binary expressions in ChocoPy.
|
||||
A unary expression has one subexpression and an operator.
|
||||
A binary expression has two subexpressions and an operator.
|
||||
There are more than one kind of unary expressions and more than three kinds of binary expressions in ChocoPy.
|
||||
2. Specify new constants for unary and binary operators in a signature.
|
||||
Use `UnOp` and `BinOp` as types of these operators.
|
||||
Again, you should use names based on the semantics of an operator, not on its syntax.
|
||||
Reading an expression aloud might help you to find suitable constructor names.
|
||||
3. Define constructors `UnExp` and `BinExp`,
|
||||
which combine an operator and an expression (respectively two expressions) to an expression.
|
||||
|
||||
#### Rewrite Rules
|
||||
|
||||
The following rewrite rule defines a rule to desugar an addition:
|
||||
|
||||
```
|
||||
rules
|
||||
|
||||
desugar: Add(e1, e2) -> BinExp(Plus(), e1, e2)
|
||||
```
|
||||
|
||||
This rewrite rule is named `desugar`.
|
||||
On the left-hand side, the rule matches an addition.
|
||||
During the match, variables `e1` and `e2` are bound to actual terms.
|
||||
On the right-hand side, the rule instantiates a binary expression (in a uniform representation).
|
||||
During the instantiation, variables `e1` and `e2` are replaced with the terms they are bound to.
|
||||
You can extend `desugar` to replace the different unary and binary expressions in the abstract syntax tree
|
||||
with a uniform representation of these expressions.
|
||||
Define a rewrite rule `desugar` in `trans/desugar.str` for every unary or binary operator,
|
||||
which transforms the original expression into a uniform representation.
|
||||
|
||||
#### Editor Integration
|
||||
|
||||
To test your transformation, you need to define a builder.
|
||||
This is done similar to the builder for pretty-printing.
|
||||
First, import the `desugar` module (defined in `trans/desugar.str`) into the main `chocopy` module.
|
||||
Then, add the following rewrite rule to `trans/chocopy.str`:
|
||||
|
||||
```
|
||||
editor-desugar:
|
||||
(_, _, ast, path, project-path) -> (filename, text)
|
||||
where
|
||||
filename := <guarantee-extension(|"desugared.aterm")> path ;
|
||||
text := <desugar-all> ast
|
||||
```
|
||||
|
||||
This rule follows Spoofax' convention for strategies which implement editor services.
|
||||
On the left-hand site, it matches a tuple of
|
||||
|
||||
* the first two parts are ignored
|
||||
* the `path` of the current file and
|
||||
* the `project path`.
|
||||
|
||||
On the right-hand site, it instantiates a pair, consisting of a `filename` and the designated `text` of the file.
|
||||
Both variables are bound in the `where` clause.
|
||||
The file name is derived from the path of the current file,
|
||||
while the content of the file is a desugared version of the selected AST node.
|
||||
You also need to hook your strategy into the editor, making desugaring available in the *Syntax* menu.
|
||||
You can do this in `editor/Syntax.esv` under the *Show Parsed AST* action:
|
||||
|
||||
```
|
||||
action : "Show desugared syntax" = editor-desugar (source)
|
||||
```
|
||||
|
||||
This rule defines
|
||||
|
||||
* a builder,
|
||||
* its label in the *Syntax* menu, and
|
||||
* its implementation strategy `editor-desugar`.
|
||||
|
||||
Annotations can be used for different variants of builders:
|
||||
|
||||
* `(openeditor)` from the Syntax menu ensures that a new editor window is opened for the result.
|
||||
* Finally, `(source)` tells Spoofax to run the builder on an unanalysed (and also not desugared) AST.
|
||||
|
||||
Note that the `editor-desugar` rule uses `desugar-all`. You should implement this strategy as explained in the next section. Until you do, the menu option will not work.
|
||||
{: .notice .notice-warning}
|
||||
|
||||
|
||||
#### Strategies
|
||||
|
||||
Rewrite rules typically define local transformations inside an AST.
|
||||
Rewrite rules with the same name define a strategy of this name.
|
||||
Furthermore, strategies can be defined to orchestrate rewrite rules to complex transformations of complete ASTs.
|
||||
A strategy consists of a name and a definition, which is typically a combination of strategy applications.
|
||||
For example, the following strategy orchestrates local desugarings to a desugaring of complete ASTs:
|
||||
|
||||
```
|
||||
strategies
|
||||
|
||||
desugar-all = innermost(desugar)
|
||||
```
|
||||
|
||||
This strategy is named `desugar-all`.
|
||||
It applies local `desugar` rules.
|
||||
The application is guided by a generic traversal strategy `innermost`,
|
||||
which tries to apply its parameter inside a tree, starting at the leaves (bottom-up, left-to-right).
|
||||
Whenever an application is successful, the result is traversed again.
|
||||
|
||||
Same results can be achieved with different generic traversals.
|
||||
You should try different traversals in `trans/desugar.str`:
|
||||
|
||||
* `desugar-all = innermost(desugar)`
|
||||
* `desugar-all = topdown(desugar)`
|
||||
* `desugar-all = topdown(try(desugar))`
|
||||
* `desugar-all = bottomup(desugar)`
|
||||
* `desugar-all = bottomup(try(desugar))`
|
||||
* `desugar-all = alltd(desugar)`
|
||||
|
||||
Try to understand what is going on and decide for a suitable one.
|
||||
You can use the library strategy `debug` to print the currently visited node.
|
||||
For example, `innermost(debug; desugar)` will `debug` all nodes before it tries to `desugar` them.
|
||||
|
||||
As preparation for the exam, provide an explanation of
|
||||
1. the choice you made,
|
||||
2. why this choice is suitable for this project, and
|
||||
3. why other choices would be less suitable.
|
||||
|
||||
Try changing the `editor-desugar` rule to use `desugar-all` instead of `desugar`. If you chose a suitable strategy, the builder should succeed even when no node is selected in the ChocoPy program.
|
||||
|
||||
-->
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../milestone/2.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="9.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../milestone/2.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="9.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
550
lab/9.html
Normal file
|
|
@ -0,0 +1,550 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Lab 9: A Basic Compiler Pipeline</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Lab 9: A Basic Compiler Pipeline
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Project
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
November 19, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<p>In this lab you make a start with compiling ChocoPy to RISC-V code using Stratego.
|
||||
You translate expression statements with expressions containing constants, operators, and variables.
|
||||
While it would be possible to completely compute the values of such expressions using constant folding, this is not the aim of this lab.
|
||||
Rather, we want the basis for a translation of expressions using variables and function calls as well.</p>
|
||||
|
||||
<h3 id="a-minimial-viable-example">A Minimial Viable Example</h3>
|
||||
|
||||
<p>The following is a minimal ChocoPy program:</p>
|
||||
|
||||
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>y : int = 3
|
||||
1 + y
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Aim to get the complete compiler pipeline working for this example first.
|
||||
Then work on extending the various stages.</p>
|
||||
|
||||
<h3 id="nano-pass-compiler-architecture">Nano-Pass Compiler Architecture</h3>
|
||||
|
||||
<p>Follow the setup of the pipeline in <em>Essentials of Compiling</em> consisting of the following strategies:</p>
|
||||
|
||||
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>compile =
|
||||
compile-cpy-to-cir
|
||||
; compile-cir-to-rv32im
|
||||
; compile-rv32im
|
||||
|
||||
compile-cpy-to-cir =
|
||||
explicate-types
|
||||
; desugar
|
||||
; uniquify
|
||||
; remove-complex-operands
|
||||
; explicate-control
|
||||
|
||||
compile-cir-to-rv32im =
|
||||
select-instructions-cprogram
|
||||
|
||||
compile-rv32im =
|
||||
assign-homes
|
||||
; patch-instructions
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Be sure to replace the <code class="language-plaintext highlighter-rouge">compile</code> rule in <code class="language-plaintext highlighter-rouge">src/compile.str2</code> with the above <code class="language-plaintext highlighter-rouge">compile</code> strategy.</p>
|
||||
|
||||
<h3 id="risc-v-resources">RISC-V Resources</h3>
|
||||
|
||||
<p>Consult the following resources as documentation on the RISC-V architecture and instruction set:</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p><a href="https://github.com/jameslzhu/riscv-card/blob/master/riscv-card.pdf">RISC-V Reference</a> by James Zhu. Provides a concise overview of the instruction set.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><a href="https://chocopy.org/venus.html">Venus Editor</a> on ChocoPy site.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><a href="https://chocopy.org/">ChocoPy Reference Compiler</a> on the ChocoPy site. Produces RISC-V code with annotations.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><a href="https://riscv.org/technical/specifications/">RISC-V Specifications</a>. The offical specification.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><a href="https://github.com/riscv/riscv-isa-manual">RISC-V Instruction Set Manual</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><a href="https://github.com/riscv/riscv-asm-manual/blob/master/riscv-asm.md">RISC-V Assembly Programmer’s Manual</a> for an overview of the instruction set.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3 id="prebuilt">Prebuilt</h3>
|
||||
|
||||
<p>The <code class="language-plaintext highlighter-rouge">prebuilt</code> directory of your project template should have</p>
|
||||
|
||||
<ul>
|
||||
<li>The ChocoPy signature and pretty-printer</li>
|
||||
<li>The RV32IM signature and pretty-printer</li>
|
||||
</ul>
|
||||
|
||||
<p>The template should also have implementations of the ChocoPy parser and type checker.</p>
|
||||
|
||||
<h3 id="compiler-testing">Compiler Testing</h3>
|
||||
|
||||
<p>Develop tests in SPT to test your compiler.</p>
|
||||
|
||||
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>module test
|
||||
|
||||
language chocopy
|
||||
|
||||
test 1+1 [[
|
||||
1+1
|
||||
]] transform "To RV32IM and execute" to "2"
|
||||
</code></pre></div></div>
|
||||
|
||||
<!-- See the slides of [Lecture 12](/2021/lecture/12/) on code generation for an approach to get started. -->
|
||||
|
||||
<!-- ### Objectives
|
||||
|
||||
1. Develop tests for your compiler that explore the edge cases.
|
||||
|
||||
2. Define a transformation strategy that translates ChocoPy constant expressions to RISC-V code. I.e. including integer and boolean constants and operators.
|
||||
|
||||
3. Develop a simplification transformation that transforms expressions such that more concise code can be generated.
|
||||
|
||||
|
||||
|
||||
### Basic Compiler Pipeline
|
||||
|
||||
Follow the slides of [Lecture 12](/2021/lecture/12) to set up a basic compiler pipeline for translating statement expressions and print the resulting value.
|
||||
|
||||
```
|
||||
program-to-rv32im:
|
||||
ast@Program(definitions, [stat]) -> Program(instrs2)
|
||||
where
|
||||
a := <stx-get-ast-analysis>
|
||||
; <stat-to-instrs(|"a1", <registers>)> stat => instrs1
|
||||
; instrs2 := <concat> [
|
||||
[PSText()]
|
||||
, instrs1
|
||||
, [Li("a0", "1"),
|
||||
Ecall()]
|
||||
]
|
||||
```
|
||||
|
||||
Note that you will eventually have to extend this rule to cover all of ChocoPy.
|
||||
|
||||
The `stat-to-instrs` strategy transforms statements. For now, we are only defining it for expression statements:
|
||||
|
||||
```
|
||||
stat-to-instrs(|r, regs) :
|
||||
Exp(e) -> instrs
|
||||
where <exp-to-instrs(|r, regs)> e => instrs
|
||||
```
|
||||
|
||||
The strategy is parameterized with a register in which it expects the value of the expression to be stored and a list of registers that can be used as temporaries. For now this is defined as follows:
|
||||
|
||||
```
|
||||
registers = !["t0", "t1", "t2", "t3", "t4", "t5", "t6"]
|
||||
```
|
||||
|
||||
That is, the `t` registers can all be used as temporaries. You will probably have to adjust this in the future.
|
||||
|
||||
|
||||
|
||||
|
||||
### Translating Expressions
|
||||
|
||||
Define a strategy that transforms expressions to lists of instructions. The example rules below show how to do this for integer constants and integer additions. These rules use registers to store the intermediate values of sub-expressions, by drawing from a list of registers. Note that this a naive approach that does not scale to arbitrary expressions. You will have to discover the limitations and figure out how to overcome those.
|
||||
|
||||
#### Debugging
|
||||
|
||||
The following strategy definition defines `exp-to-instrs` in terms of an auxiliary rule `exp-to-instrs-`:
|
||||
|
||||
```
|
||||
exp-to-instrs(|r, regs) =
|
||||
exp-to-instrs-(|r, regs)
|
||||
<+ (debug(!"exp-to-instr fails: "); fail)
|
||||
```
|
||||
|
||||
This is a useful pattern in Stratego, as it catches a possible failure of the `exp-to-instrs-` rule and reports it in the Eclipse Console. For example, this strategy will report when you apply the compiler to an operator that is not (yet) supported.
|
||||
|
||||
You can also debug your generated code, by creating a `.cpy` file, transforming it to an `.rv32im` file using the `Spoofax > Generation` menu, and copying the generated output to the online Venus editor, where you can use the `Simulator` tab to run your code or step through each line, and inspect the memory and registers.
|
||||
|
||||
#### Translating Constants
|
||||
|
||||
Integer constants are translated to instructions that load the constant value into a register:
|
||||
|
||||
```
|
||||
exp-to-instrs-(|r, regs) :
|
||||
Int(i) -> [Li(r, i)]
|
||||
```
|
||||
|
||||
Can other types of constants be treated similarly?
|
||||
|
||||
#### Translating Operators
|
||||
|
||||
Operators combine expressions into new expressions. In order to translate an operator, its sub-expressions should be translated recursively the lists of instructions. Furthermore, while the value of the second sub-expression is computed, the value of the first sub-expression should be stored. This typically requires a new register. Thus, integer addition can be translated as follows:
|
||||
|
||||
```
|
||||
exp-to-instrs-(|r, regs@[r2 | regs']) :
|
||||
add@Add(e1, e2) -> <concat> [
|
||||
instrs1
|
||||
, instrs2
|
||||
, [Add(r, r, r2)]
|
||||
]
|
||||
where <stx-get-ast-analysis> add => a
|
||||
; <get-type(|a)> add => INT()
|
||||
; <exp-to-instrs(|r, regs)> e1 => instrs1
|
||||
; <exp-to-instrs(|r2, regs')> e2 => instrs2
|
||||
```
|
||||
|
||||
Note that the list of registers is used to obtain a fresh register.
|
||||
|
||||
Define transformation rules for all operators of ChocoPy expressions.
|
||||
|
||||
#### Special Cases
|
||||
|
||||
RISC-V provides specialized instructions for some operations. For example, the `addi` instruction allows directly adding an integer constant (between -2048 and 2047) to a register. A compiler can make use of such instructions, by detecting special patterns in the source language. For example, the following rule (when listed before the general rule for addition above), detects additions with an integer constant, and translates those to applications of `addi`, avoiding the use of an extra register.
|
||||
|
||||
```
|
||||
exp-to-instrs-(|r, regs) :
|
||||
add@Add(e, Int(i)) -> <concat> [
|
||||
instrs
|
||||
, [Addi(r, r, i)]
|
||||
]
|
||||
where <gtS>(i, "-2049"); <ltS>(i, "2048")
|
||||
; <stx-get-ast-analysis> add => a
|
||||
; <get-type(|a)> add => INT()
|
||||
; <exp-to-instrs(|r, regs)> e => instrs
|
||||
```
|
||||
|
||||
Can you detect other specialized instructions and corresponding source language patterns that provide a more concise and/or faster target code?
|
||||
|
||||
### Simplification
|
||||
|
||||
To improve the result of code generation, it can be useful to transform the source language expression. For example, left-associative additions produce a better result with the rules for addition above. Another useful transformation is to type specialize the constructors of the AST, such that the analysis results are no longer needed. That is useful when applying transformations, since preserving those annotations cannot be done for all transformations. **The following `simplify-all` transformation should be invoked on the AST before invoking the compiler transformation.**
|
||||
|
||||
```
|
||||
signature
|
||||
constructors
|
||||
AddInt : Exp * Exp -> Exp
|
||||
|
||||
rules
|
||||
|
||||
simplify-all =
|
||||
innermost(type-specialize <+ simplify)
|
||||
|
||||
type-specialize :
|
||||
add@Add(e1, e2) -> AddInt(e1, e2)
|
||||
where <stx-get-ast-analysis> add => a
|
||||
; <get-type(|a)> add => INT()
|
||||
|
||||
simplify :
|
||||
AddInt(e1, AddInt(e2, e3)) -> AddInt(AddInt(e1, e2), e3)
|
||||
```
|
||||
|
||||
Note that the rules for translating integer additions should be adapted to reflect the change in constructors.
|
||||
|
||||
This simplification can include constant folding, eventually. However, do not yet include constant folding rules, since you want to test the translation of operators. That is, your code generator should be able to translate arbitrary combinations of operators, so be prepared for the general case.
|
||||
|
||||
Think about (and try out in the online compiler!) the differences between adding integers and concatenating strings in RISC-V. In ChocoPy, they initially both use the `Add(...)` constructor, so make sure to disambiguate them into separate constructors you will later use for code generation. The same holds for other operations, but you have to think about those yourself.
|
||||
|
||||
### Booleans
|
||||
|
||||
In ChocoPy we compile the Booleans `True` and `False` to integers in RISC-V (`1` and `0`, respectively). Implement the Boolean operators `and`, `or` and `not`, and integer comparison operators `==`, `!=`, `<`, `>`, `<=`, `>=` (you can ignore `is` for now since it operates on objects).
|
||||
|
||||
You can make use of the online compiler, or the RISC-V instruction set to find the proper instructions in RISC-V.
|
||||
|
||||
Also implement the ternary operator `... if ... else ...`. (See [Short-circuit Boolean operations](#shortcircuit) to get an idea on how to implement it.)
|
||||
|
||||
### Challenges
|
||||
|
||||
#### Running out of registers
|
||||
|
||||
The approach sketched above does not generalize to arbitrary expressions.
|
||||
Create test cases that require more temporary registers than are available.
|
||||
|
||||
Start thinking about solutions for this limitation. Two standard solutions are using the stack for temporaries (which is slow since it involves writing to and reading from memory), and register allocation (which requires a program analysis on the generated code).
|
||||
|
||||
#### <a name="shortcircuit"></a>Short-circuit Boolean operations.
|
||||
|
||||
When encountering a Boolean operation of the form `False and ...`, do we really care about the right side of the operator? Similarly, when we encounter `True or ...`?
|
||||
|
||||
Think about how we can use conditional jumps in RISC-V to short-circuit (any) Boolean operators. Have a look at the instruction set and online compiler.
|
||||
|
||||
A conditional jump in RISC-V takes a label, which represents an address in memory. In Stratego, labels can be generated using `<newname> "L" => label`. (Note that `"L"` can be anything you want, as long as it is a string.) -->
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="8.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="10.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<ul id="my_toc" class="toc list-group list-group-flush d-none d-lg-block d-xl-block p-0 ml-0 mt-3">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="9.html#a-minimial-viable-example">A Minimial Viable Example</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="9.html#nano-pass-compiler-architecture">Nano-Pass Compiler Architecture</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="9.html#risc-v-resources">RISC-V Resources</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="9.html#prebuilt">Prebuilt</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="9.html#compiler-testing">Compiler Testing</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="8.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="10.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../project/index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
957
lecture/1.html
Normal file
|
|
@ -0,0 +1,957 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Lecture 1: What is a Compiler?</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
<a href="https://tudelft-cs4200.github.io/2021/lectures/2021/01-introduction/CS4200-2021-1-introduction.pdf">
|
||||
<img class="border border-dark" width="100%" src="../lectures/2021/01-introduction/CS4200-2021-1-introduction/CS4200-2021-1-introduction.001.png"/>
|
||||
</a>
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Lecture 1: What is a Compiler?
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
Eelco Visser
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Lecture
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
| <a class="text-primary" href="https://tudelft-cs4200.github.io/2021/lectures/2021/01-introduction/CS4200-2021-1-introduction.pdf">PDF</a>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
September 02, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<p>In the opening lecture we look at what compilers are, why you would want to study them, and how the course is organized.</p>
|
||||
|
||||
<h3 id="slides">Slides</h3>
|
||||
|
||||
<ul>
|
||||
<li><a href="../lectures/2021/01-introduction/CS4200-2021-1-introduction.pdf">Slides</a></li>
|
||||
<li><a href="../lectures/2021/01-introduction/CS4200-2021-1-introduction-builds.pdf">Slides with builds</a></li>
|
||||
</ul>
|
||||
|
||||
<h3 id="reading-material">Reading Material</h3>
|
||||
|
||||
<p>The lecture discusses the traditional compiler pipeline. In the course we will be using the Spoofax language workbench to define and implement languages. The [OOPSLA 2010] paper describes the design of Spoofax. The [SEFM 2020] paper gives an overview of SDF3, the language we will for syntax definition.</p>
|
||||
|
||||
<h3 id="tutorial">Tutorial</h3>
|
||||
|
||||
<iframe width="560" height="315" src="https://www.youtube.com/embed/7BBYQUp5ZnE" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>
|
||||
|
||||
<p>Introduction to a <a href="https://pldi20.sigplan.org/details/pldi-2020-tutorials/3/Declarative-Language-Definition-with-Spoofax">tutorial on Spoofax</a> at the <a href="https://pldi20.sigplan.org/">PLDI 2020</a> conference in June 2020.</p>
|
||||
|
||||
<h3 id="references">References</h3>
|
||||
|
||||
|
||||
|
||||
|
||||
<ul class="list-group list-group-flush pb-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item pl-lg-0 border-0 pb-0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-primary pl-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<a name="AmorimV20"></a>
|
||||
|
||||
<a class="font-weight-bold text-dark" target="_blank" href="https://doi.org/10.1007/978-3-030-58768-0_1">Multi-purpose Syntax Definition with SDF3</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
<a class="text-secondary" href="https://www.linkedin.com/profile/view?id=136481548">Luis Eduardo de Souza Amorim</a>, <a class="text-secondary" href="http://eelcovisser.org">Eelco Visser</a>.
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
|
||||
|
||||
SEFM 2020
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[<a class="text-secondary" href="https://doi.org/10.1007/978-3-030-58768-0_1" target="_blank">doi</a>, <a class="text-secondary" target="_blank" href="https://researchr.org/publication/AmorimV20/bibtex">bib</a>, <a href="https://researchr.org/publication/AmorimV20" class="text-secondary" target="_blank">researchr</a>, <a class="text-secondary" data-toggle="collapse" href="1.html#AbstractAmorimV20" role="button" aria-expanded="false" aria-controls="AbstractAmorimV20"">abstract</a>]
|
||||
|
||||
<!-- AmorimV20 -->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="collapse mt-1 mb-2" id="AbstractAmorimV20">
|
||||
<div class="">
|
||||
SDF3 is a syntax definition formalism that extends plain context-free grammars with features such as constructor declarations, declarative disambiguation rules, character-level grammars, permissive syntax, layout constraints, formatting templates, placeholder syntax, and modular composition. These features support the multi-purpose interpretation of syntax definitions, including derivation of type schemas for abstract syntax tree representations, scannerless generalized parsing of the full class of context-free grammars, error recovery, layout-sensitive parsing, parenthesization and formatting, and syntactic completion. This paper gives a high level overview of SDF3 by means of examples and provides a guide to the literature for further details.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item pl-lg-0 border-0 pb-0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-success pl-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<a name="PadhyeSH19"></a>
|
||||
|
||||
<a class="font-weight-bold text-dark" target="_blank" href="https://chocopy.org/chocopy_language_reference.pdf">ChocoPy v2.2: Language Manual and Reference</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
<a class="text-secondary" href="https://researchr.org/alias/rohan-padhye">Rohan Padhye</a>, <a class="text-secondary" href="https://researchr.org/alias/koushik-sen">Koushik Sen</a>, <a class="text-secondary" href="https://researchr.org/alias/paul-hilfnger"> Paul Hilfnger</a>, <a class="text-secondary" href="https://researchr.org/alias/rohan-padhye">Rohan Padhye</a>, <a class="text-secondary" href="https://researchr.org/alias/koushik-sen">Koushik Sen</a>, <a class="text-secondary" href="https://researchr.org/alias/paul-hilfnger"> Paul Hilfnger</a>.
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[<a href="https://tudelft-cs4200.github.io/2021https://chocopy.org/chocopy_language_reference.pdf" class="text-secondary" target="_blank">pdf</a>, <a class="text-secondary" target="_blank" href="https://researchr.org/publication/PadhyeSH19/bibtex">bib</a>, <a href="https://researchr.org/publication/PadhyeSH19" class="text-secondary" target="_blank">researchr</a>]
|
||||
|
||||
<!-- -->
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item pl-lg-0 border-0 pb-0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-primary pl-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<a name="KatsV10"></a>
|
||||
|
||||
<a class="font-weight-bold text-dark" target="_blank" href="https://doi.org/10.1145/1869459.1869497">The Spoofax language workbench: rules for declarative specification of languages and IDEs</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
<a class="text-secondary" href="http://www.lclnet.nl/">Lennart C. L. Kats</a>, <a class="text-secondary" href="http://eelcovisser.org">Eelco Visser</a>.
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
|
||||
|
||||
OOPSLA 2010
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[<a href="../publications/2010/KatsV10.pdf" class="text-secondary" target="_blank">pdf</a>, <a class="text-secondary" href="https://doi.org/10.1145/1869459.1869497" target="_blank">doi</a>, <a class="text-secondary" target="_blank" href="https://researchr.org/publication/KatsV10/bibtex">bib</a>, <a href="https://researchr.org/publication/KatsV10" class="text-secondary" target="_blank">researchr</a>, <a class="text-secondary" data-toggle="collapse" href="1.html#AbstractKatsV10" role="button" aria-expanded="false" aria-controls="AbstractKatsV10"">abstract</a>]
|
||||
|
||||
<!-- -->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="collapse mt-1 mb-2" id="AbstractKatsV10">
|
||||
<div class="">
|
||||
Spoofax is a language workbench for efficient, agile development of textual domain-specific languages with state-of-the-art IDE support. Spoofax integrates language processing techniques for parser generation, meta-programming, and IDE development into a single environment. It uses concise, declarative specifications for languages and IDE services. In this paper we describe the architecture of Spoofax and introduce idioms for high-level specifications of language semantics using rewrite rules, showing how analyses can be reused for transformations, code generation, and editor services such as error marking, reference resolving, and content completion. The implementation of these services is supported by language-parametric editor service classes that can be dynamically loaded by the Eclipse IDE, allowing new languages to be developed and used side-by-side in the same Eclipse environment.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../lectures/index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="2.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<ul id="my_toc" class="toc list-group list-group-flush d-none d-lg-block d-xl-block p-0 ml-0 mt-3">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1.html#slides">Slides</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1.html#reading-material">Reading Material</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1.html#tutorial">Tutorial</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="1.html#references">References</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="2.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../lectures/index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
1093
lecture/10.html
Normal file
908
lecture/11.html
Normal file
|
|
@ -0,0 +1,908 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Lecture 11: Nano-Pass Compiler Architecture & Composing Transformations with Strategy Combinators</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
<a href="../lectures/2021/11-transformation/CS4200-2021-11-strategy-combinators.pdf">
|
||||
<img class="border border-dark" width="100%" src="../lectures/2021/11-transformation/CS4200-2021-11-strategy-combinators/CS4200-2021-11-strategy-combinators.001.png"/>
|
||||
</a>
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Lecture 11: Nano-Pass Compiler Architecture & Composing Transformations with Strategy Combinators
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
Eelco Visser
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Lecture
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
| <a class="text-primary" href="../lectures/2021/11-transformation/CS4200-2021-11-strategy-combinators.pdf">PDF</a>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
November 18, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<p>In this lecture we take a first look at <a href="11.html">Jeremy Siek’s</a> nano-pass compiler architecture.</p>
|
||||
|
||||
<p>Furthermore, we study how rewrite rules and strategies are composed from basic strategy combinators. The basic building blocks of transformation are matching and building terms. These are composed using combinators including sequential composition and (left) choice into more complext strategies. To define traversal strategies that apply transformations throughout a term, we define one-level traversal primitives. These can be used to define a variety of traversals, including top-down, bottom-up, and innermost.</p>
|
||||
|
||||
<h3 id="slides">Slides</h3>
|
||||
|
||||
<ul>
|
||||
<li><a href="../lectures/2021/11-transformation/CS4200-2021-11-strategy-combinators.pdf">PDF</a></li>
|
||||
<li><a href="../lectures/2021/11-transformation/CS4200-2021-11-strategy-combinators-builds.pdf">PDF with builds</a></li>
|
||||
</ul>
|
||||
|
||||
<h3 id="references">References</h3>
|
||||
|
||||
|
||||
|
||||
|
||||
<ul class="list-group list-group-flush pb-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item pl-lg-0 border-0 pb-0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-info pl-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<a name="Siek2021"></a>
|
||||
|
||||
Essentials of Compilation. An Incremental Approach in Racket
|
||||
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
<a class="text-secondary" href="https://researchr.org/alias/jeremy-g.-siek">Jeremy G. Siek</a>.
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[<a class="text-secondary" target="_blank" href="https://researchr.org/publication/Siek2021/bibtex">bib</a>, <a href="https://researchr.org/publication/Siek2021" class="text-secondary" target="_blank">researchr</a>]
|
||||
|
||||
<!-- Siek2021 -->
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item pl-lg-0 border-0 pb-0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-danger pl-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<a name="BravenboerDOV06"></a>
|
||||
|
||||
<a class="font-weight-bold text-dark" target="_blank" href="https://content.iospress.com/articles/fundamenta-informaticae/fi69-1-2-06">Program Transformation with Scoped Dynamic Rewrite Rules</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
<a class="text-secondary" href="http://martin.bravenboer.name/">Martin Bravenboer</a>, <a class="text-secondary" href="https://researchr.org/profile/arthurvandam/publications">Arthur van Dam</a>, <a class="text-secondary" href="https://researchr.org/profile/karinaolmos/publications">Karina Olmos</a>, <a class="text-secondary" href="http://eelcovisser.org">Eelco Visser</a>.
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
|
||||
FUIN 69(1-2) 2006
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[<a href="../publications/2020/BravenboerDOV06.pdf" class="text-secondary" target="_blank">pdf</a>, <a class="text-secondary" href="https://content.iospress.com/articles/fundamenta-informaticae/fi69-1-2-06" target="_blank">doi</a>, <a class="text-secondary" target="_blank" href="https://researchr.org/publication/BravenboerDOV06/bibtex">bib</a>, <a href="https://researchr.org/publication/BravenboerDOV06" class="text-secondary" target="_blank">researchr</a>, <a class="text-secondary" data-toggle="collapse" href="11.html#AbstractBravenboerDOV06" role="button" aria-expanded="false" aria-controls="AbstractBravenboerDOV06"">abstract</a>]
|
||||
|
||||
<!-- -->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="collapse mt-1 mb-2" id="AbstractBravenboerDOV06">
|
||||
<div class="">
|
||||
The applicability of term rewriting to program transformation is limited by the lack of control over rule application and by the context-free nature of rewrite rules. The first problem is addressed by languages supporting user-definable rewriting strategies. The second problem is addressed by the extension of rewriting strategies with scoped dynamic rewrite rules. Dynamic rules are defined at run-time and can access variables available from their definition context. Rules defined within a rule scope are automatically retracted at the end of that scope. In this paper, we explore the design space of dynamic rules, and their application to transformation problems. The technique is formally defined by extending the operational semantics underlying the program transformation language Stratego, and illustrated by means of several program transformations in Stratego, including constant propagation, bound variable renaming, dead code elimination, function inlining, and function specialization.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item pl-lg-0 border-0 pb-0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-primary pl-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<a name="VisserBT98"></a>
|
||||
|
||||
<a class="font-weight-bold text-dark" target="_blank" href="http://doi.acm.org/10.1145/289423.289425">Building Program Optimizers with Rewriting Strategies</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
<a class="text-secondary" href="http://eelcovisser.org">Eelco Visser</a>, <a class="text-secondary" href="http://web.archive.org/web/20010515202744/www.cse.ogi.edu/~benaissa/">Zine-El-Abidine Benaissa</a>, <a class="text-secondary" href="http://www.cs.pdx.edu/~apt">Andrew P. Tolmach</a>.
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
|
||||
|
||||
ICFP 1998
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[<a class="text-secondary" href="http://doi.acm.org/10.1145/289423.289425" target="_blank">doi</a>, <a class="text-secondary" target="_blank" href="https://researchr.org/publication/VisserBT98/bibtex">bib</a>, <a href="https://researchr.org/publication/VisserBT98" class="text-secondary" target="_blank">researchr</a>, <a class="text-secondary" data-toggle="collapse" href="11.html#AbstractVisserBT98" role="button" aria-expanded="false" aria-controls="AbstractVisserBT98"">abstract</a>]
|
||||
|
||||
<!-- VisserBT98 -->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="collapse mt-1 mb-2" id="AbstractVisserBT98">
|
||||
<div class="">
|
||||
We describe a language for defining term rewriting strategies, and its application to the production of program optimizers. Valid transformations on program terms can be described by a set of rewrite rules; rewriting strategies are used to describe when and how the various rules should be applied in order to obtain the desired optimization effects. Separating rules from strategies in this fashion makes it easier to reason about the behavior of the optimizer as a whole, compared to traditional monolithic optimizer implementations. We illustrate the expressiveness of our language by using it to describe a simple optimizer for an ML-like intermediate representation.The basic strategy language uses operators such as sequential composition, choice, and recursion to build transformers from a set of labeled unconditional rewrite rules. We also define an extended language in which the side-conditions and contextual rules that arise in realistic optimizer specifications can themselves be expressed as strategy-driven rewrites. We show that the features of the basic and extended languages can be expressed by breaking down the rewrite rules into their primitive building blocks, namely matching and building terms in variable binding environments. This gives us a low-level core language which has a clear semantics, can be implemented straightforwardly and can itself be optimized. The current implementation generates C code from a strategy specification.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="10.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../lectures/index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="12.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<ul id="my_toc" class="toc list-group list-group-flush d-none d-lg-block d-xl-block p-0 ml-0 mt-3">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="11.html#slides">Slides</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="11.html#references">References</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="10.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="12.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../lectures/index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
742
lecture/12.html
Normal file
|
|
@ -0,0 +1,742 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Lecture 12: Instruction Selection & Register Allocation</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
<a href="../lectures/2021/12-instruction-selection/CS4200-2021-12-code-generation.pdf">
|
||||
<img class="border border-dark" width="100%" src="../lectures/2021/12-instruction-selection/CS4200-2021-12-code-generation/CS4200-2021-12-code-generation.001.png"/>
|
||||
</a>
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Lecture 12: Instruction Selection & Register Allocation
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
Eelco Visser
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Lecture
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
| <a class="text-primary" href="../lectures/2021/12-instruction-selection/CS4200-2021-12-code-generation.pdf">PDF</a>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
November 25, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<h3 id="instruction-selection">Instruction Selection</h3>
|
||||
|
||||
<p>In the first part of this lecture we study target machine architecture and their instruction set, and we start looking and code generation. We study the operational semantics rules for arithmetic expressions in ChocoPy. And we explore the translation of arithmetic expressions consisting of integer constants and additions to RISC-V code. The code is somewhat naive, since it can run out of temporary registers. Possible solutions are to store temporary values on the stack or the use register allocation.
|
||||
We end with looking compilation schemas as an abstraction from the implementation details of transformation rules.</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="../lectures/2021/12-instruction-selection/CS4200-2021-12-code-generation.pdf">PDF</a></li>
|
||||
<li><a href="../lectures/2021/12-instruction-selection/CS4200-2021-12-code-generation-builds.pdf">PDF with builds</a></li>
|
||||
</ul>
|
||||
|
||||
<h3 id="register-allocation">Register Allocation</h3>
|
||||
|
||||
<p>In the second part of the lecture we look at register allocation, i.e. mapping symbolic variables to concrete machine registers.
|
||||
An interference graph represents the (simultaneous) use of variables, which we obtain from liveness analysis.
|
||||
Using graph coloring we assign concrete registers to variables such that no two variables that are live at the same time are assigned to the same register.
|
||||
When that is not possible variables need to be spilled to memory.</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="../lectures/2021/12-instruction-selection/CS4200-2021-12-register-allocation.pdf">PDF</a></li>
|
||||
<li><a href="../lectures/2021/12-instruction-selection/CS4200-2021-12-register-allocation-builds.pdf">PDF with builds</a></li>
|
||||
</ul>
|
||||
|
||||
<p><img src="../lectures/2021/12-instruction-selection/CS4200-2021-12-register-allocation/CS4200-2021-12-register-allocation.030.png" class="border border-dark" /></p>
|
||||
|
||||
|
||||
|
||||
|
||||
<ul class="list-group list-group-flush pb-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="11.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../lectures/index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="13.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<ul id="my_toc" class="toc list-group list-group-flush d-none d-lg-block d-xl-block p-0 ml-0 mt-3">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="12.html#instruction-selection">Instruction Selection</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="12.html#register-allocation">Register Allocation</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="11.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="13.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../lectures/index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
757
lecture/13.html
Normal file
|
|
@ -0,0 +1,757 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Lecture 13: Implementing Register Allocation & Control Flow & Memory Management</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
<a href="../lectures/2021/13-control-flow/CS4200-2021-13-control-flow.pdf">
|
||||
<img class="border border-dark" width="100%" src="../lectures/2021/13-control-flow/CS4200-2021-13-control-flow/CS4200-2021-13-control-flow.011.png"/>
|
||||
</a>
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Lecture 13: Implementing Register Allocation & Control Flow & Memory Management
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
Eelco Visser
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Lecture
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
| <a class="text-primary" href="../lectures/2021/13-control-flow/CS4200-2021-13-control-flow.pdf">PDF</a>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
December 02, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<h3 id="implementing-register-allocation">Implementing Register Allocation</h3>
|
||||
|
||||
<p>Last week we looked at the approach for using graph coloring for register allocation, conceptually.
|
||||
This week we study Stratego code for implementing register allocation (for straigh line code).
|
||||
Register allocation consists of liveness analysis, building an interference graph from the results of that analysis, coloring the nodes of that graph, and finally applying the coloring result to the program.</p>
|
||||
|
||||
<h3 id="control-flow">Control Flow</h3>
|
||||
|
||||
<p>We extend our compiler to handle boolean values and control flow constructs in the subject language.
|
||||
By desugaring the language we can reduce the constructs that the downstream compiler has to consider.</p>
|
||||
|
||||
<h3 id="memory-management">Memory Management</h3>
|
||||
|
||||
<p>We make a start with the safety considerations of memory management and consider automated memory management techniques.
|
||||
We study a range of garbage collection algorithms and study their properties.
|
||||
To be continued next week.</p>
|
||||
|
||||
<p>Slides:</p>
|
||||
<ul>
|
||||
<li><a href="../lectures/2021/13-control-flow/CS4200-2021-13-memory-management.pdf">PDF</a></li>
|
||||
</ul>
|
||||
|
||||
<p><img src="../lectures/2021/13-control-flow/CS4200-2021-13-memory-management/CS4200-2021-13-memory-management.022.png" class="border border-dark" /></p>
|
||||
|
||||
<h3 id="references">References</h3>
|
||||
|
||||
<p>See the memory management slide for references.</p>
|
||||
|
||||
<!-- In this lecture we study further code generation techniques.
|
||||
|
||||
### Calling Conventions
|
||||
|
||||
We first study functions in ChocoPy and the operational semantics rules that define their meaning.
|
||||
Then we look at activation records, what motivates their existence, and how they are used to implement function calls.
|
||||
We reconstruct the RISC-V calling convention described in the ChocoPy language implementation guide, looking in detail at the implementation of an example caller and callee.
|
||||
|
||||
### Dynamic Rewrite Rules
|
||||
|
||||
In the second part of the lecture, we study dynamic rewrite rules in Stratego, which can be used to define context-sensitive transformations. We look at examples for keeping track of stack offsets, and mapping variables to their offsets. See the paper by Bravenboer et al. (2006) for more information about dynamic rules.
|
||||
|
||||
-->
|
||||
|
||||
|
||||
|
||||
|
||||
<ul class="list-group list-group-flush pb-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="12.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../lectures/index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="14.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<ul id="my_toc" class="toc list-group list-group-flush d-none d-lg-block d-xl-block p-0 ml-0 mt-3">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="13.html#implementing-register-allocation">Implementing Register Allocation</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="13.html#control-flow">Control Flow</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="13.html#memory-management">Memory Management</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="13.html#references">References</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="12.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="14.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../lectures/index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
745
lecture/14.html
Normal file
|
|
@ -0,0 +1,745 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Lecture 14: More Memory Management & While Loops & Nested Functions</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
<a href="../lectures/2021/14-nested-functions/CS4200-2021-14-nested-functions.pdf">
|
||||
<img class="border border-dark" width="100%" src="../lectures/2021/14-nested-functions/CS4200-2021-14-nested-functions/CS4200-2021-14-nested-functions.006.png"/>
|
||||
</a>
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Lecture 14: More Memory Management & While Loops & Nested Functions
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
Eelco Visser
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Lecture
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
| <a class="text-primary" href="../lectures/2021/14-nested-functions/CS4200-2021-14-nested-functions.pdf">PDF</a>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
December 09, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<h3 id="memory-management">Memory Management</h3>
|
||||
|
||||
<p>In this lecture we continue the previous lecture on memory managagement in which we study memory safety, automated memory management, and several garbage collection algorithms.
|
||||
See the previous lecture for the slides.</p>
|
||||
|
||||
<h3 id="while-loops">While Loops</h3>
|
||||
|
||||
<p>We extend the study of control-flow statements by looking at the translation of while loops.
|
||||
Loops do not need additional constructs in the intermediate language since the can be expressed using (conditional) jumps.
|
||||
But register allocation for loops requires the extension of liveness analysis to compute a fixpoint of the analysis results.</p>
|
||||
|
||||
<h3 id="dynamic-rules-in-stratego">Dynamic Rules in Stratego</h3>
|
||||
|
||||
<p>To express context-sensitive transformations, Stratego provides dynamic rewrite rules.
|
||||
We provide several examples that are useful in your compiler.</p>
|
||||
|
||||
<h3 id="nested-functions">Nested Functions</h3>
|
||||
|
||||
<p>We then discuss code generation for functions, including:</p>
|
||||
|
||||
<ul>
|
||||
<li>The definition of a calling convention and that translates to building up a call frame.</li>
|
||||
<li>Renaming of functions and variables in order to get a program with unique names in order to deal with shadowing of names.</li>
|
||||
<li>The treatment of nested functions by adding a static link as extra parameter to nested functions, in order to provide access to variables in the call frame of an enclosing function. We show discuss a number of critical examples that point out issues to take into account. We illustrate a program transformation that makes explicit the number of static links to traverse in order to access the relevant call frame.</li>
|
||||
<li>A challenge to exend ChocoPy with functions as first-class citizens.</li>
|
||||
</ul>
|
||||
|
||||
<h3 id="slides">Slides</h3>
|
||||
|
||||
<ul>
|
||||
<li><a href="../lectures/2021/14-nested-functions/CS4200-2021-14-nested-functions.pdf">PDF</a></li>
|
||||
<li><a href="../lectures/2021/14-nested-functions/CS4200-2021-14-nested-functions-builds.pdf">PDF with builds</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<ul class="list-group list-group-flush pb-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="13.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../lectures/index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="15.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<ul id="my_toc" class="toc list-group list-group-flush d-none d-lg-block d-xl-block p-0 ml-0 mt-3">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="14.html#memory-management">Memory Management</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="14.html#while-loops">While Loops</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="14.html#dynamic-rules-in-stratego">Dynamic Rules in Stratego</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="14.html#nested-functions">Nested Functions</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="14.html#slides">Slides</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="13.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="15.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../lectures/index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
719
lecture/15.html
Normal file
|
|
@ -0,0 +1,719 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Lecture 15: Representing Objects</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
<a href="../lectures/2021/15-objects/CS4200-2021-15-objects.pdf">
|
||||
<img class="border border-dark" width="100%" src="../lectures/2021/15-objects/CS4200-2021-15-objects/CS4200-2021-15-objects.005.png"/>
|
||||
</a>
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Lecture 15: Representing Objects
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
Eelco Visser
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Lecture
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
| <a class="text-primary" href="../lectures/2021/15-objects/CS4200-2021-15-objects.pdf">PDF</a>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
December 16, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<p>In the first part of this lecture we study the implementation of objects.</p>
|
||||
|
||||
<p>We look at classes in ChocoPy with inheritance of attributes and methods, dynamic dispatch of method calls, object construction, and object initialization using <code class="language-plaintext highlighter-rouge">__init__</code> methods.</p>
|
||||
|
||||
<p>Objects are represented in memory in two parts.
|
||||
The encoding of a specific object stores its data attributes, the type of the object and its size.
|
||||
Since all objects of a type share the same methods, those are not store in the object itself, but in a separate dispatch table.
|
||||
The object representation includes a pointer to that dispatch table.</p>
|
||||
|
||||
<p>Implementing a class is a matter of creating a prototype object for the class, including a link to a separate dispatch table.
|
||||
Allocating an object is then a matter of copying the prototype.
|
||||
Each becomes a regular top-level function that takes the receiver object as an additional parameter.
|
||||
Accessing the attributes of a class requires its offset with respect to the object pointer.</p>
|
||||
|
||||
<p>In the second part of the lecture we make a start with the study of data-flow analysis.</p>
|
||||
|
||||
<!--
|
||||
In the second part of the lecture we study register allocation, i.e. the assignment of registers to temporaries in function bodies with the aim of using as little as possible memory to store temporaries using graph coloring. -->
|
||||
|
||||
|
||||
|
||||
|
||||
<ul class="list-group list-group-flush pb-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="14.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../lectures/index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="16.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="14.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="16.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../lectures/index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
934
lecture/16.html
Normal file
|
|
@ -0,0 +1,934 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Lecture 16: Data-Flow Analysis</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
<a href="../lectures/2021/16-data-flow-analysis/CS4200-2021-16-data-flow-analysis.pdf">
|
||||
<img class="border border-dark" width="100%" src="../lectures/2021/16-data-flow-analysis/CS4200-2021-16-data-flow-analysis/CS4200-2021-16-data-flow-analysis.031.png"/>
|
||||
</a>
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Lecture 16: Data-Flow Analysis
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
Eelco Visser
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Lecture
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
| <a class="text-primary" href="../lectures/2021/16-data-flow-analysis/CS4200-2021-16-data-flow-analysis.pdf">PDF</a>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
December 23, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<p>In this lecture we study data-flow analysis and the mathmetical framework of monotone frameworks, a foundation for the definition of data-flow analyses.</p>
|
||||
|
||||
<p>We also introduce the FlowSpec language for declarative definition of intra-procedural, flow-sensitive data-flow analyses.
|
||||
FlowSpec provides rules for mapping an AST to a control-flow graph and for defining the transfer functions associated with nodes in the graph.</p>
|
||||
|
||||
<h3 id="references">References</h3>
|
||||
|
||||
|
||||
|
||||
|
||||
<ul class="list-group list-group-flush pb-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item pl-lg-0 border-0 pb-0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-info pl-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<a name="MoellerS20"></a>
|
||||
|
||||
<a class="font-weight-bold text-dark" target="_blank" href="https://cs.au.dk/~amoeller/spa/">Static Program Analysis</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
<a class="text-secondary" href="https://researchr.org/alias/anders-m%C3%B8ller">Anders Møller</a>, <a class="text-secondary" href="http://www.brics.dk/~mis/">Michael I. Schwartzbach</a>.
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[<a class="text-secondary" href="https://cs.au.dk/~amoeller/spa/" target="_blank">doi</a>, <a class="text-secondary" target="_blank" href="https://researchr.org/publication/MoellerS20/bibtex">bib</a>, <a href="https://researchr.org/publication/MoellerS20" class="text-secondary" target="_blank">researchr</a>, <a class="text-secondary" data-toggle="collapse" href="16.html#AbstractMoellerS20" role="button" aria-expanded="false" aria-controls="AbstractMoellerS20"">abstract</a>]
|
||||
|
||||
<!-- MoellerS20 -->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="collapse mt-1 mb-2" id="AbstractMoellerS20">
|
||||
<div class="">
|
||||
Static program analysis is the art of reasoning about the behavior of computer programs without actually running them. This is useful not only in optimizing compilers for producing efficient code but also for automatic error detection and other tools that can help programmers. As known from Turing and Rice, all interesting properties of the behavior of programs written in common programming languages are mathematically undecidable. This means that automated reasoning of software generally must involve approximation. It is also well known that testing may reveal errors but not show their absence. In contrast, static program analysis can - with the right kind of approximations - check all possible executions of the programs and provide guarantees about their properties. The challenge when developing such analyses is how to ensure high precision and efficiency to be practically useful. This teaching material concisely presents the essential principles and algorithms for static program analysis. We emphasize a constraint-based approach where suitable constraint systems conceptually divide analysis into a front-end that generates constraints from program code and a back-end that solves the constraints to produce the analysis results. The style of presentation is intended to be precise but not overly formal. The readers are assumed to be familiar with advanced programming language concepts and the basics of compiler construction. The concepts are explained using a tiny imperative programming language, TIP, which suffices to illustrate the main challenges that arise with mainstream languages.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item pl-lg-0 border-0 pb-0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-danger pl-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<a name="SmitsWV20"></a>
|
||||
|
||||
<a class="font-weight-bold text-dark" target="_blank" href="https://doi.org/10.1016/j.cola.2019.100924">FlowSpec: A declarative specification language for intra-procedural flow-Sensitive data-flow analysis</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
<a class="text-secondary" href="https://researchr.org/profile/jeffsmits/publications">Jeff Smits</a>, <a class="text-secondary" href="https://www.linkedin.com/in/guidowachsmuth/">Guido Wachsmuth</a>, <a class="text-secondary" href="http://eelcovisser.org">Eelco Visser</a>.
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
|
||||
JCL (JVLC) 57 2020
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[<a class="text-secondary" href="https://doi.org/10.1016/j.cola.2019.100924" target="_blank">doi</a>, <a class="text-secondary" target="_blank" href="https://researchr.org/publication/SmitsWV20/bibtex">bib</a>, <a href="https://researchr.org/publication/SmitsWV20" class="text-secondary" target="_blank">researchr</a>, <a class="text-secondary" data-toggle="collapse" href="16.html#AbstractSmitsWV20" role="button" aria-expanded="false" aria-controls="AbstractSmitsWV20"">abstract</a>]
|
||||
|
||||
<!-- SmitsWV20 -->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="collapse mt-1 mb-2" id="AbstractSmitsWV20">
|
||||
<div class="">
|
||||
Data-flow analysis is the static analysis of programs to estimate their approximate run-time behavior or approximate intermediate run-time values. It is an integral part of modern language specifications and compilers. In the specification of static semantics of programming languages, the concept of data-flow allows the description of well-formedness such as definite assignment of a local variable before its first use. In the implementation of compiler back-ends, data-flow analyses inform optimizations. Data-flow analysis has an established theoretical foundation. What lags behind is implementations of data-flow analysis in compilers, which are usually ad-hoc. This makes such implementations difficult to extend and maintain. In previous work researchers have proposed higher-level formalisms suitable for whole-program analysis in a separate tool, incremental analysis within editors, or bound to a specific intermediate representation. In this paper, we present FlowSpec, an executable formalism for specification of data-flow analysis. FlowSpec is a domain-specific language that enables direct and concise specification of data-flow analysis for programming languages, designed to express flow-sensitive, intra-procedural analyses. We define the formal semantics of FlowSpec in terms of monotone frameworks. We describe the design of FlowSpec using examples of standard analyses. We also include a description of our implementation of FlowSpec. In a case study we evaluate FlowSpec with the static analyses for Green-Marl, a domain-specific programming language for graph analytics.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item pl-lg-0 border-0 pb-0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-primary pl-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<a name="SmitsV17"></a>
|
||||
|
||||
<a class="font-weight-bold text-dark" target="_blank" href="http://doi.acm.org/10.1145/3136014.3136029">FlowSpec: declarative dataflow analysis specification</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
<a class="text-secondary" href="https://researchr.org/profile/jeffsmits/publications">Jeff Smits</a>, <a class="text-secondary" href="http://eelcovisser.org">Eelco Visser</a>.
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
|
||||
|
||||
SLE 2017
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[<a class="text-secondary" href="http://doi.acm.org/10.1145/3136014.3136029" target="_blank">doi</a>, <a class="text-secondary" target="_blank" href="https://researchr.org/publication/SmitsV17/bibtex">bib</a>, <a href="https://researchr.org/publication/SmitsV17" class="text-secondary" target="_blank">researchr</a>, <a class="text-secondary" data-toggle="collapse" href="16.html#AbstractSmitsV17" role="button" aria-expanded="false" aria-controls="AbstractSmitsV17"">abstract</a>]
|
||||
|
||||
<!-- SmitsV17 -->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="collapse mt-1 mb-2" id="AbstractSmitsV17">
|
||||
<div class="">
|
||||
We present FlowSpec, a declarative specification language for the domain of dataflow analysis. FlowSpec has declarative support for the specification of control flow graphs of programming languages, and dataflow analyses on these control flow graphs. We define the formal semantics of FlowSpec, which is rooted in Monotone Frameworks. We also discuss a prototype implementation of the language, built in the Spoofax Language Workbench. Finally, we evaluate the expressiveness and conciseness of the language with two case studies. These case studies are analyses for Green-Marl, an industrial, domain-specific language for graph processing. The first case study is a classical dataflow analysis, scaled to this full language. The second case study is a domain-specific analysis of Green-Marl.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item pl-lg-0 border-0 pb-0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-info pl-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<a name="NielsenNH05"></a>
|
||||
|
||||
<a class="font-weight-bold text-dark" target="_blank" href="http://www.springer.com/computer/theoretical+computer+science/book/978-3-540-65410-0">Principles of program analysis (2. corr. print)</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
<a class="text-secondary" href="https://researchr.org/alias/flemming-nielson">Flemming Nielson</a>, <a class="text-secondary" href="https://researchr.org/alias/hanne-riis-nielson">Hanne Riis Nielson</a>, <a class="text-secondary" href="https://researchr.org/alias/chris-hankin">Chris Hankin</a>.
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[<a class="text-secondary" href="http://www.springer.com/computer/theoretical+computer+science/book/978-3-540-65410-0" target="_blank">doi</a>, <a class="text-secondary" target="_blank" href="https://researchr.org/publication/NielsenNH05/bibtex">bib</a>, <a href="https://researchr.org/publication/NielsenNH05" class="text-secondary" target="_blank">researchr</a>]
|
||||
|
||||
<!-- NielsenNH05 -->
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="15.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../lectures/index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="17.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<ul id="my_toc" class="toc list-group list-group-flush d-none d-lg-block d-xl-block p-0 ml-0 mt-3">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="16.html#references">References</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="15.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="17.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../lectures/index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
756
lecture/17.html
Normal file
|
|
@ -0,0 +1,756 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Lecture 17: CS4200-B: Code Generation Mechanics, Summary, Further Study</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
<a href="../lectures/2021/17-conclusion/CS4200-2022-17-code-generation-mechanics.pdf">
|
||||
<img class="border border-dark" width="100%" src="../lectures/2021/17-conclusion/CS4200-2022-17-code-generation-mechanics/CS4200-2022-17-code-generation-mechanics.001.png"/>
|
||||
</a>
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Lecture 17: CS4200-B: Code Generation Mechanics, Summary, Further Study
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
Eelco Visser
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Lecture
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
| <a class="text-primary" href="../lectures/2021/17-conclusion/CS4200-2022-17-code-generation-mechanics.pdf">PDF</a>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
January 14, 2022
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<h3 id="code-generation-mechanics">Code Generation Mechanics</h3>
|
||||
|
||||
<p>In the third part of the lecture, we take a broader look at mechanics for code generation, the properties we would like compilers to adhere to, and to what extend existing mechanisms support the verification of those properties out of the box.</p>
|
||||
|
||||
<ul>
|
||||
<li>Code generation by string manipulation
|
||||
<ul>
|
||||
<li>Stratego does support string templates, which can be useful to do quick code generation</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Code generation by term transformation
|
||||
<ul>
|
||||
<li>This is what we do in this course. A</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Guaranteeing syntactic correct target code
|
||||
<ul>
|
||||
<li>By means of type checking terms against signature; coming up for Stratego [SLE 2020]</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Program transformation with concrete object syntax
|
||||
<ul>
|
||||
<li>Quoting concrete syntax, while transforming the underlying abstract syntax; see [GPCE 2002, OOPSLA 2004, SCP 2010]</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Hygienic transformations (avoiding name capture)
|
||||
<ul>
|
||||
<li>Hygienic macros in Scheme/Racket ensure capture avoidance in binding constructs introduced by macros</li>
|
||||
<li>The namefix approach guarantees capture avoidance by checking after the fact</li>
|
||||
<li>We are working on avoiding capture in rename refactoring based on scope graphs</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Guaranteeing type correct target code
|
||||
<ul>
|
||||
<li>In intrinsically-typed interpreters/compilers, the type safety of the transformation is guaranteed by construction; see [POPL 2018, 2021] for explorations of this approach in Agda</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Preservation of dynamic semantics
|
||||
<ul>
|
||||
<li>The CompCert certified compiler proves that its code generation preserves the semantics of the source language in target programs; a challenge is how to realize such certified compilation with minimal effort</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>We only briefly touch on these topics. See the references for further information.</p>
|
||||
|
||||
<h4 id="slides">Slides</h4>
|
||||
|
||||
<ul>
|
||||
<li><a href="../lectures/2021/17-conclusion/CS4200-2022-17-code-generation-mechanics.pdf">PDF</a></li>
|
||||
</ul>
|
||||
|
||||
<h3 id="summary">Summary</h3>
|
||||
|
||||
<p>In the second part of the lecture we summarize the course and look at further study of compilers and programming languages.
|
||||
In particular, we list current research challenges in the language workbench group at TU Delft, and we list further courses to take in the master program.</p>
|
||||
|
||||
<h4 id="slides-1">Slides</h4>
|
||||
|
||||
<ul>
|
||||
<li><a href="../lectures/2021/17-conclusion/CS4200-2022-17-conclusion.pdf">PDF</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<ul class="list-group list-group-flush pb-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="16.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../lectures/index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<ul id="my_toc" class="toc list-group list-group-flush d-none d-lg-block d-xl-block p-0 ml-0 mt-3">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="17.html#code-generation-mechanics">Code Generation Mechanics</a>
|
||||
<ul class="toc-sub pl-0">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="17.html#slides">Slides</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="17.html#summary">Summary</a>
|
||||
<ul class="toc-sub pl-0">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="17.html#slides-1">Slides</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="16.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../lectures/index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
922
lecture/2.html
Normal file
|
|
@ -0,0 +1,922 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Lecture 2: Declarative Syntax Definition</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
<a href="../lectures/2021/02-syntax-definition/CS4200-2021-2-syntax-definition.pdf">
|
||||
<img class="border border-dark" width="100%" src="../lectures/2021/02-syntax-definition/CS4200-2021-2-syntax-definition/CS4200-2021-2-syntax-definition.001.png"/>
|
||||
</a>
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Lecture 2: Declarative Syntax Definition
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
Eelco Visser
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Lecture
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
| <a class="text-primary" href="../lectures/2021/02-syntax-definition/CS4200-2021-2-syntax-definition.pdf">PDF</a>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
September 03, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<p>In this lecture we study declarative syntax definition.</p>
|
||||
|
||||
<h3 id="slides">Slides</h3>
|
||||
|
||||
<ul>
|
||||
<li><a href="../lectures/2021/02-syntax-definition/CS4200-2021-2-syntax-definition.pdf">Slides</a></li>
|
||||
<li><a href="../lectures/2021/02-syntax-definition/CS4200-2021-2-syntax-definition-builds.pdf">Slides with builds</a></li>
|
||||
</ul>
|
||||
|
||||
<h3 id="reading-material">Reading Material</h3>
|
||||
|
||||
<p>The [SEFM 2020] paper gives an overview of SDF3, the language we will use for syntax definition.</p>
|
||||
|
||||
<p>The [LDTA 2012] paper introduced ‘template-based syntax definition’. (This was one of the results of the master’s thesis work of Tobi Vollebregt.)</p>
|
||||
|
||||
<h3 id="tutorial-and-talk-on-sdf3">Tutorial and Talk on SDF3</h3>
|
||||
|
||||
<iframe width="560" height="315" src="https://www.youtube.com/embed/7by2tVSz4mk" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>
|
||||
|
||||
<p>This is part of a <a href="https://pldi20.sigplan.org/details/pldi-2020-tutorials/3/Declarative-Language-Definition-with-Spoofax">tutorial on Spoofax</a> at the <a href="https://pldi20.sigplan.org/">PLDI 2020</a> conference in June 2020.</p>
|
||||
|
||||
<iframe width="560" height="315" src="https://www.youtube.com/embed/SgP4GlWuUr4" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>
|
||||
|
||||
<p>This is a talk for the <a href="https://icfp20.sigplan.org/home/ocaml-2020">OCAML 2020</a> workshop at the <a href="https://icfp20.sigplan.org/">ICFP 2020</a> conference.</p>
|
||||
|
||||
<h3 id="references">References</h3>
|
||||
|
||||
|
||||
|
||||
|
||||
<ul class="list-group list-group-flush pb-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item pl-lg-0 border-0 pb-0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-primary pl-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<a name="AmorimV20"></a>
|
||||
|
||||
<a class="font-weight-bold text-dark" target="_blank" href="https://doi.org/10.1007/978-3-030-58768-0_1">Multi-purpose Syntax Definition with SDF3</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
<a class="text-secondary" href="https://www.linkedin.com/profile/view?id=136481548">Luis Eduardo de Souza Amorim</a>, <a class="text-secondary" href="http://eelcovisser.org">Eelco Visser</a>.
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
|
||||
|
||||
SEFM 2020
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[<a class="text-secondary" href="https://doi.org/10.1007/978-3-030-58768-0_1" target="_blank">doi</a>, <a class="text-secondary" target="_blank" href="https://researchr.org/publication/AmorimV20/bibtex">bib</a>, <a href="https://researchr.org/publication/AmorimV20" class="text-secondary" target="_blank">researchr</a>, <a class="text-secondary" data-toggle="collapse" href="2.html#AbstractAmorimV20" role="button" aria-expanded="false" aria-controls="AbstractAmorimV20"">abstract</a>]
|
||||
|
||||
<!-- AmorimV20 -->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="collapse mt-1 mb-2" id="AbstractAmorimV20">
|
||||
<div class="">
|
||||
SDF3 is a syntax definition formalism that extends plain context-free grammars with features such as constructor declarations, declarative disambiguation rules, character-level grammars, permissive syntax, layout constraints, formatting templates, placeholder syntax, and modular composition. These features support the multi-purpose interpretation of syntax definitions, including derivation of type schemas for abstract syntax tree representations, scannerless generalized parsing of the full class of context-free grammars, error recovery, layout-sensitive parsing, parenthesization and formatting, and syntactic completion. This paper gives a high level overview of SDF3 by means of examples and provides a guide to the literature for further details.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item pl-lg-0 border-0 pb-0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-primary pl-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<a name="VollebregtKV12"></a>
|
||||
|
||||
<a class="font-weight-bold text-dark" target="_blank" href="http://doi.acm.org/10.1145/2427048.2427056">Declarative specification of template-based textual editors</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
<a class="text-secondary" href="http://www.tobivollebregt.nl/">Tobi Vollebregt</a>, <a class="text-secondary" href="http://www.lclnet.nl/">Lennart C. L. Kats</a>, <a class="text-secondary" href="http://eelcovisser.org">Eelco Visser</a>.
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
|
||||
|
||||
LDTA 2012
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[<a href="../publications/2012/VollebregtKV12.pdf" class="text-secondary" target="_blank">pdf</a>, <a class="text-secondary" href="http://doi.acm.org/10.1145/2427048.2427056" target="_blank">doi</a>, <a class="text-secondary" target="_blank" href="https://researchr.org/publication/VollebregtKV12/bibtex">bib</a>, <a href="https://researchr.org/publication/VollebregtKV12" class="text-secondary" target="_blank">researchr</a>, <a class="text-secondary" data-toggle="collapse" href="2.html#AbstractVollebregtKV12" role="button" aria-expanded="false" aria-controls="AbstractVollebregtKV12"">abstract</a>]
|
||||
|
||||
<!-- -->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="collapse mt-1 mb-2" id="AbstractVollebregtKV12">
|
||||
<div class="">
|
||||
Syntax discoverability has been a crucial advantage of structure editors for new users of a language. Despite this advantage, structure editors have not been widely adopted. Based on immediate parsing and analyses, modern textual code editors are also increasingly syntax-aware: structure and textual editors are converging into a new editing paradigm that combines text and templates. Current text-based language workbenches require redundant specification of the ingredients for a template-based editor, which is detrimental to the quality of syntactic completion, as consistency and completeness of the definition cannot be guaranteed. In this paper we describe the design and implementation of a specification language for syntax definition based on templates. It unifies the specification of parsers, unparsers and template-based editors. We evaluate the template language by application to two domain-specific languages used for tax benefits and mobile applications.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../lectures/index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="3.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<ul id="my_toc" class="toc list-group list-group-flush d-none d-lg-block d-xl-block p-0 ml-0 mt-3">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="2.html#slides">Slides</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="2.html#reading-material">Reading Material</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="2.html#tutorial-and-talk-on-sdf3">Tutorial and Talk on SDF3</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="2.html#references">References</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="1.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="3.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../lectures/index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
951
lecture/3.html
Normal file
|
|
@ -0,0 +1,951 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Lecture 3: Disambiguation and Layout Sensitive Syntax</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
<a href="../lectures/2021/03-disambiguation/CS4200-2021-3-disambiguation.pdf">
|
||||
<img class="border border-dark" width="100%" src="../lectures/2021/03-disambiguation/CS4200-2021-3-disambiguation/CS4200-2021-3-disambiguation.001.png"/>
|
||||
</a>
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Lecture 3: Disambiguation and Layout Sensitive Syntax
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
Eelco Visser
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Lecture
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
| <a class="text-primary" href="../lectures/2021/03-disambiguation/CS4200-2021-3-disambiguation.pdf">PDF</a>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
September 09, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<p>In this lecture we study the declarative disambiguation of <a href="2.html">declarative syntax definitions</a> using associativity and priority rules.
|
||||
As a prelimary to understanding disambiguation, we first study the semantics of context-free grammars in terms of sentence and tree derivation.
|
||||
We discuss the semantics of such rules in terms of subtree exclusion and how (simple) disambiguations can be expressed by means of grammar transformation.</p>
|
||||
|
||||
<p>We end with a discussion of disambiguation using layout constraints, in order to express layout-sensitive syntax.</p>
|
||||
|
||||
<h3 id="slides">Slides</h3>
|
||||
|
||||
<ul>
|
||||
<li><a href="../lectures/2021/03-disambiguation/CS4200-2021-3-disambiguation.pdf">Slides</a></li>
|
||||
<li><a href="../lectures/2021/03-disambiguation/CS4200-2021-3-disambiguation-builds.pdf">Slides with builds</a></li>
|
||||
</ul>
|
||||
|
||||
<h3 id="references">References</h3>
|
||||
|
||||
|
||||
|
||||
|
||||
<ul class="list-group list-group-flush pb-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item pl-lg-0 border-0 pb-0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-primary pl-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<a name="AmorimSEV18"></a>
|
||||
|
||||
<a class="font-weight-bold text-dark" target="_blank" href="https://doi.org/10.1145/3276604.3276607">Declarative specification of indentation rules: a tooling perspective on parsing and pretty-printing layout-sensitive languages</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
<a class="text-secondary" href="https://www.linkedin.com/profile/view?id=136481548">Luis Eduardo de Souza Amorim</a>, <a class="text-secondary" href="http://michael.steindorfer.name">Michael J. Steindorfer</a>, <a class="text-secondary" href="http://www.informatik.uni-marburg.de/~seba/">Sebastian Erdweg</a>, <a class="text-secondary" href="http://eelcovisser.org">Eelco Visser</a>.
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
|
||||
|
||||
SLE 2018
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[<a class="text-secondary" href="https://doi.org/10.1145/3276604.3276607" target="_blank">doi</a>, <a class="text-secondary" target="_blank" href="https://researchr.org/publication/AmorimSEV18/bibtex">bib</a>, <a href="https://researchr.org/publication/AmorimSEV18" class="text-secondary" target="_blank">researchr</a>, <a class="text-secondary" data-toggle="collapse" href="3.html#AbstractAmorimSEV18" role="button" aria-expanded="false" aria-controls="AbstractAmorimSEV18"">abstract</a>]
|
||||
|
||||
<!-- AmorimSEV18 -->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="collapse mt-1 mb-2" id="AbstractAmorimSEV18">
|
||||
<div class="">
|
||||
In layout-sensitive languages, the indentation of an expression or statement can influence how a program is parsed. While some of these languages (e.g., Haskell and Python) have been widely adopted, there is little support for software language engineers in building tools for layout-sensitive languages. As a result, parsers, pretty-printers, program analyses, and refactoring tools often need to be handwritten, which decreases the maintainability and extensibility of these tools. Even state-of-the-art language workbenches have little support for layout-sensitive languages, restricting the development and prototyping of such languages. In this paper, we introduce a novel approach to declarative specification of layout-sensitive languages using layout declarations. Layout declarations are high-level specifications of indentation rules that abstract from low-level technicalities. We show how to derive an efficient layout-sensitive generalized parser and a corresponding pretty-printer automatically from a language specification with layout declarations. We validate our approach in a case-study using a syntax definition for the Haskell programming language, investigating the performance of the generated parser and the correctness of the generated pretty-printer against 22191 Haskell files.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item pl-lg-0 border-0 pb-0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-primary pl-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<a name="ErdwegRKO12"></a>
|
||||
|
||||
<a class="font-weight-bold text-dark" target="_blank" href="http://dx.doi.org/10.1007/978-3-642-36089-3_14">Layout-Sensitive Generalized Parsing</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
<a class="text-secondary" href="http://www.informatik.uni-marburg.de/~seba/">Sebastian Erdweg</a>, <a class="text-secondary" href="https://researchr.org/alias/tillmann-rendel">Tillmann Rendel</a>, <a class="text-secondary" href="https://researchr.org/alias/christian-k%C3%A4stner">Christian Kästner</a>, <a class="text-secondary" href="https://researchr.org/alias/klaus-ostermann">Klaus Ostermann</a>.
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
|
||||
|
||||
SLE 2012
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[<a class="text-secondary" href="http://dx.doi.org/10.1007/978-3-642-36089-3_14" target="_blank">doi</a>, <a class="text-secondary" target="_blank" href="https://researchr.org/publication/ErdwegRKO12/bibtex">bib</a>, <a href="https://researchr.org/publication/ErdwegRKO12" class="text-secondary" target="_blank">researchr</a>]
|
||||
|
||||
<!-- ErdwegRKO12 -->
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item pl-lg-0 border-0 pb-0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-primary pl-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<a name="ErdwegRRO12"></a>
|
||||
|
||||
<a class="font-weight-bold text-dark" target="_blank" href="http://doi.acm.org/10.1145/2364506.2364526">Layout-sensitive language extensibility with SugarHaskell</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
<a class="text-secondary" href="http://www.informatik.uni-marburg.de/~seba/">Sebastian Erdweg</a>, <a class="text-secondary" href="https://researchr.org/alias/felix-rieger">Felix Rieger</a>, <a class="text-secondary" href="https://researchr.org/alias/tillmann-rendel">Tillmann Rendel</a>, <a class="text-secondary" href="https://researchr.org/alias/klaus-ostermann">Klaus Ostermann</a>.
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
|
||||
|
||||
haskell 2012
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[<a class="text-secondary" href="http://doi.acm.org/10.1145/2364506.2364526" target="_blank">doi</a>, <a class="text-secondary" target="_blank" href="https://researchr.org/publication/ErdwegRRO12/bibtex">bib</a>, <a href="https://researchr.org/publication/ErdwegRRO12" class="text-secondary" target="_blank">researchr</a>]
|
||||
|
||||
<!-- ErdwegRRO12 -->
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="2.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../lectures/index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="4.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<ul id="my_toc" class="toc list-group list-group-flush d-none d-lg-block d-xl-block p-0 ml-0 mt-3">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="3.html#slides">Slides</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="3.html#references">References</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="2.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="4.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../lectures/index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
967
lecture/4.html
Normal file
|
|
@ -0,0 +1,967 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Lecture 4: Type Checking and Type Constraints</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
<a href="../lectures/2021/04-type-constraints/CS4200-2021-4-type-checking.pdf">
|
||||
<img class="border border-dark" width="100%" src="../lectures/2021/04-type-constraints/CS4200-2021-4-type-checking/CS4200-2021-4-type-checking.047.png"/>
|
||||
</a>
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Lecture 4: Type Checking and Type Constraints
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
Eelco Visser
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Lecture
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
| <a class="text-primary" href="../lectures/2021/04-type-constraints/CS4200-2021-4-type-checking.pdf">PDF</a>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
September 16, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<p>In this lecture we study types and relations in types in programming languages, and discuss the motivation for having types.</p>
|
||||
|
||||
<p>Next we look at the way type systems are formalized. In particular, we look at the inference rules in the ChocoPy reference manual.</p>
|
||||
|
||||
<p>Finally, we start our study of the Statix meta-language for the specification of type systems. Ending with a demonstration of the <a href="https://github.com/MetaBorgCube/statix-sandbox/tree/master/chicago">Chicago</a> project (available on github), as an example of the use of Statix.</p>
|
||||
|
||||
<p>There are no papers that give concrete examples of Statix code, but the <a href="https://eelcovisser.org/publications/2016/AntwerpenNTVW16.pdf">PEPM 2016</a> paper gives a good introduction to the use of constraints and scope graphs, albeit in a somewhat more limited language than Statix.</p>
|
||||
|
||||
<h3 id="slides">Slides</h3>
|
||||
|
||||
<ul>
|
||||
<li><a href="../lectures/2021/04-type-constraints/CS4200-2021-4-type-checking.pdf">Slides</a></li>
|
||||
<li><a href="../lectures/2021/04-type-constraints/CS4200-2021-4-type-checking-builds.pdf">Slides with builds</a></li>
|
||||
</ul>
|
||||
|
||||
<h3 id="statix-tutorial">Statix Tutorial</h3>
|
||||
|
||||
<p>This is a recording of a tutorial on Statix at the PLDI conference.</p>
|
||||
|
||||
<iframe width="560" height="315" src="https://www.youtube.com/embed/0GPZiZF5znA" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>
|
||||
|
||||
<h3 id="references">References</h3>
|
||||
|
||||
|
||||
|
||||
|
||||
<ul class="list-group list-group-flush pb-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item pl-lg-0 border-0 pb-0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-danger pl-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<a name="AntwerpenPRV18"></a>
|
||||
|
||||
<a class="font-weight-bold text-dark" target="_blank" href="https://doi.org/10.1145/3276484">Scopes as types</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
<a class="text-secondary" href="https://nl.linkedin.com/in/hendrikvanantwerpen">Hendrik van Antwerpen</a>, <a class="text-secondary" href="http://www.casperbp.net">Casper Bach Poulsen</a>, <a class="text-secondary" href="https://www.linkedin.com/in/arjen-rouvoet-760347a5/">Arjen Rouvoet</a>, <a class="text-secondary" href="http://eelcovisser.org">Eelco Visser</a>.
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
|
||||
PACMPL 2(OOPSLA) 2018
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[<a href="../publications/2018/AntwerpenPRV18.pdf" class="text-secondary" target="_blank">pdf</a>, <a class="text-secondary" href="https://doi.org/10.1145/3276484" target="_blank">doi</a>, <a class="text-secondary" target="_blank" href="https://researchr.org/publication/AntwerpenPRV18/bibtex">bib</a>, <a href="https://researchr.org/publication/AntwerpenPRV18" class="text-secondary" target="_blank">researchr</a>, <a class="text-secondary" data-toggle="collapse" href="4.html#AbstractAntwerpenPRV18" role="button" aria-expanded="false" aria-controls="AbstractAntwerpenPRV18"">abstract</a>]
|
||||
|
||||
<!-- -->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="collapse mt-1 mb-2" id="AbstractAntwerpenPRV18">
|
||||
<div class="">
|
||||
Scope graphs are a promising generic framework to model the binding structures of programming languages, bridging formalization and implementation, supporting the definition of type checkers and the automation of type safety proofs. However, previous work on scope graphs has been limited to simple, nominal type systems. In this paper, we show that viewing scopes as types enables us to model the internal structure of types in a range of non-simple type systems (including structural records and generic classes) using the generic representation of scopes. Further, we show that relations between such types can be expressed in terms of generalized scope graph queries. We extend scope graphs with scoped relations and queries. We introduce Statix, a new domain-specific meta-language for the specification of static semantics, based on scope graphs and constraints. We evaluate the scopes as types approach and the Statix design in case studies of the simply-typed lambda calculus with records, System F, and Featherweight Generic Java.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item pl-lg-0 border-0 pb-0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-primary pl-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<a name="AntwerpenNTVW16"></a>
|
||||
|
||||
<a class="font-weight-bold text-dark" target="_blank" href="http://doi.acm.org/10.1145/2847538.2847543">A constraint language for static semantic analysis based on scope graphs</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
<a class="text-secondary" href="https://nl.linkedin.com/in/hendrikvanantwerpen">Hendrik van Antwerpen</a>, <a class="text-secondary" href="https://researchr.org/profile/pierrejeanmichelneron/publications">Pierre Néron</a>, <a class="text-secondary" href="http://www.cs.pdx.edu/~apt">Andrew P. Tolmach</a>, <a class="text-secondary" href="http://eelcovisser.org">Eelco Visser</a>, <a class="text-secondary" href="https://www.linkedin.com/in/guidowachsmuth/">Guido Wachsmuth</a>.
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
|
||||
|
||||
PEPM 2016
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[<a href="../publications/2016/AntwerpenNTVW16.pdf" class="text-secondary" target="_blank">pdf</a>, <a class="text-secondary" href="http://doi.acm.org/10.1145/2847538.2847543" target="_blank">doi</a>, <a class="text-secondary" target="_blank" href="https://researchr.org/publication/AntwerpenNTVW16/bibtex">bib</a>, <a href="https://researchr.org/publication/AntwerpenNTVW16" class="text-secondary" target="_blank">researchr</a>, <a class="text-secondary" data-toggle="collapse" href="4.html#AbstractAntwerpenNTVW16" role="button" aria-expanded="false" aria-controls="AbstractAntwerpenNTVW16"">abstract</a>]
|
||||
|
||||
<!-- -->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="collapse mt-1 mb-2" id="AbstractAntwerpenNTVW16">
|
||||
<div class="">
|
||||
In previous work, we introduced scope graphs as a formalism for describing program binding structure and performing name resolution in an AST-independent way. In this paper, we show how to use scope graphs to build static semantic analyzers. We use constraints extracted from the AST to specify facts about binding, typing, and initialization. We treat name and type resolution as separate building blocks, but our approach can handle language constructs -- such as record field access -- for which binding and typing are mutually dependent. We also refine and extend our previous scope graph theory to address practical concerns including ambiguity checking and support for a wider range of scope relationships. We describe the details of constraint generation for a model language that illustrates many of the interesting static analysis issues associated with modules and records.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item pl-lg-0 border-0 pb-0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-primary pl-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<a name="NeronTVW15"></a>
|
||||
|
||||
<a class="font-weight-bold text-dark" target="_blank" href="http://dx.doi.org/10.1007/978-3-662-46669-8\_9">A Theory of Name Resolution</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
<a class="text-secondary" href="https://researchr.org/profile/pierrejeanmichelneron/publications">Pierre Néron</a>, <a class="text-secondary" href="http://www.cs.pdx.edu/~apt">Andrew P. Tolmach</a>, <a class="text-secondary" href="http://eelcovisser.org">Eelco Visser</a>, <a class="text-secondary" href="https://www.linkedin.com/in/guidowachsmuth/">Guido Wachsmuth</a>.
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
|
||||
|
||||
ESOP 2015
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[<a href="../publications/2015/NeronTVW15.pdf" class="text-secondary" target="_blank">pdf</a>, <a class="text-secondary" href="http://dx.doi.org/10.1007/978-3-662-46669-8\_9" target="_blank">doi</a>, <a class="text-secondary" target="_blank" href="https://researchr.org/publication/NeronTVW15/bibtex">bib</a>, <a href="https://researchr.org/publication/NeronTVW15" class="text-secondary" target="_blank">researchr</a>, <a class="text-secondary" data-toggle="collapse" href="4.html#AbstractNeronTVW15" role="button" aria-expanded="false" aria-controls="AbstractNeronTVW15"">abstract</a>]
|
||||
|
||||
<!-- -->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="collapse mt-1 mb-2" id="AbstractNeronTVW15">
|
||||
<div class="">
|
||||
We describe a language-independent theory for name binding and resolution, suitable for programming languages with complex scoping rules including both lexical scoping and modules. We formulate name resolution as a two-stage problem. First a language-independent scope graph is constructed using language-specific rules from an abstract syntax tree. Then references in the scope graph are resolved to corresponding declarations using a language-independent resolution process. We introduce a resolution calculus as a concise, declarative, and languageindependent specification of name resolution. We develop a resolution algorithm that is sound and complete with respect to the calculus. Based on the resolution calculus we develop language-independent definitions of α-equivalence and rename refactoring. We illustrate the approach using a small example language with modules. In addition, we show how our approach provides a model for a range of name binding patterns in existing languages.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="3.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../lectures/index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="5.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<ul id="my_toc" class="toc list-group list-group-flush d-none d-lg-block d-xl-block p-0 ml-0 mt-3">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="4.html#slides">Slides</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="4.html#statix-tutorial">Statix Tutorial</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="4.html#references">References</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="3.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="5.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../lectures/index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
974
lecture/5.html
Normal file
|
|
@ -0,0 +1,974 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Lecture 5: Name Binding and Name Resolution</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
<a href="../lectures/2021/05-name-binding/CS4200-2020-5-name-binding.pdf">
|
||||
<img class="border border-dark" width="100%" src="../lectures/2021/05-name-binding/CS4200-2021-5-name-binding/CS4200-2021-5-name-binding.001.png"/>
|
||||
</a>
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Lecture 5: Name Binding and Name Resolution
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
Eelco Visser
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Lecture
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
| <a class="text-primary" href="../lectures/2021/05-name-binding/CS4200-2020-5-name-binding.pdf">PDF</a>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
September 23, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<p>In this lecture we study name binding and name resolution. We introduce the notion of a <em>scope graph</em> to represent the bindings in a program and name resolution queries in a scope graph to resolve references (uses of names) to declarations (definitions of names).</p>
|
||||
|
||||
<p>In addition to the lecture (see the recording on BrightSpace), see the talks about scope graphs below.
|
||||
The <em>Curry On 2017</em> talk provides a somewhat higher-level presentation of the resolution calculus that is at the basis of resolution scope graphs.
|
||||
See also to Statix tutorial listed on the page of the previous lecture.</p>
|
||||
|
||||
<h3 id="slides">Slides</h3>
|
||||
|
||||
<ul>
|
||||
<li><a href="../lectures/2021/05-name-binding/CS4200-2020-5-name-binding.pdf">Slides</a></li>
|
||||
<li><a href="https://tudelft-cs4200.github.io/2021/lectures/2021/05-name-binding/CS4200-2020-5-name-binding-builds.pdf">Slides with builds</a></li>
|
||||
</ul>
|
||||
|
||||
<h3 id="scopes-as-types">Scopes as Types</h3>
|
||||
|
||||
<p>Presentation of the OOPSLA’18 paper that introduced Statix.</p>
|
||||
|
||||
<iframe width="560" height="315" src="https://www.youtube.com/embed/4BPlVCYuKDo" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>
|
||||
|
||||
<h3 id="scope-graphs">Scope Graphs</h3>
|
||||
|
||||
<p>A high-level introduction to scope graphs and the resolution calculus.</p>
|
||||
|
||||
<iframe width="560" height="315" src="https://www.youtube.com/embed/0Eg6RDUJGJQ" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>
|
||||
|
||||
<h3 id="towards-semantic-editor-services">Towards Semantic Editor Services</h3>
|
||||
|
||||
<p>Explores alternative interpretation of Statix specifications for editor services such as semantic completion.</p>
|
||||
|
||||
<iframe width="560" height="315" src="https://www.youtube.com/embed/YfU8EheUCAk" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>
|
||||
|
||||
<h3 id="references">References</h3>
|
||||
|
||||
|
||||
|
||||
|
||||
<ul class="list-group list-group-flush pb-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item pl-lg-0 border-0 pb-0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-danger pl-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<a name="AntwerpenPRV18"></a>
|
||||
|
||||
<a class="font-weight-bold text-dark" target="_blank" href="https://doi.org/10.1145/3276484">Scopes as types</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
<a class="text-secondary" href="https://nl.linkedin.com/in/hendrikvanantwerpen">Hendrik van Antwerpen</a>, <a class="text-secondary" href="http://www.casperbp.net">Casper Bach Poulsen</a>, <a class="text-secondary" href="https://www.linkedin.com/in/arjen-rouvoet-760347a5/">Arjen Rouvoet</a>, <a class="text-secondary" href="http://eelcovisser.org">Eelco Visser</a>.
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
|
||||
PACMPL 2(OOPSLA) 2018
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[<a href="../publications/2018/AntwerpenPRV18.pdf" class="text-secondary" target="_blank">pdf</a>, <a class="text-secondary" href="https://doi.org/10.1145/3276484" target="_blank">doi</a>, <a class="text-secondary" target="_blank" href="https://researchr.org/publication/AntwerpenPRV18/bibtex">bib</a>, <a href="https://researchr.org/publication/AntwerpenPRV18" class="text-secondary" target="_blank">researchr</a>, <a class="text-secondary" data-toggle="collapse" href="5.html#AbstractAntwerpenPRV18" role="button" aria-expanded="false" aria-controls="AbstractAntwerpenPRV18"">abstract</a>]
|
||||
|
||||
<!-- -->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="collapse mt-1 mb-2" id="AbstractAntwerpenPRV18">
|
||||
<div class="">
|
||||
Scope graphs are a promising generic framework to model the binding structures of programming languages, bridging formalization and implementation, supporting the definition of type checkers and the automation of type safety proofs. However, previous work on scope graphs has been limited to simple, nominal type systems. In this paper, we show that viewing scopes as types enables us to model the internal structure of types in a range of non-simple type systems (including structural records and generic classes) using the generic representation of scopes. Further, we show that relations between such types can be expressed in terms of generalized scope graph queries. We extend scope graphs with scoped relations and queries. We introduce Statix, a new domain-specific meta-language for the specification of static semantics, based on scope graphs and constraints. We evaluate the scopes as types approach and the Statix design in case studies of the simply-typed lambda calculus with records, System F, and Featherweight Generic Java.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item pl-lg-0 border-0 pb-0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-primary pl-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<a name="AntwerpenNTVW16"></a>
|
||||
|
||||
<a class="font-weight-bold text-dark" target="_blank" href="http://doi.acm.org/10.1145/2847538.2847543">A constraint language for static semantic analysis based on scope graphs</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
<a class="text-secondary" href="https://nl.linkedin.com/in/hendrikvanantwerpen">Hendrik van Antwerpen</a>, <a class="text-secondary" href="https://researchr.org/profile/pierrejeanmichelneron/publications">Pierre Néron</a>, <a class="text-secondary" href="http://www.cs.pdx.edu/~apt">Andrew P. Tolmach</a>, <a class="text-secondary" href="http://eelcovisser.org">Eelco Visser</a>, <a class="text-secondary" href="https://www.linkedin.com/in/guidowachsmuth/">Guido Wachsmuth</a>.
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
|
||||
|
||||
PEPM 2016
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[<a href="../publications/2016/AntwerpenNTVW16.pdf" class="text-secondary" target="_blank">pdf</a>, <a class="text-secondary" href="http://doi.acm.org/10.1145/2847538.2847543" target="_blank">doi</a>, <a class="text-secondary" target="_blank" href="https://researchr.org/publication/AntwerpenNTVW16/bibtex">bib</a>, <a href="https://researchr.org/publication/AntwerpenNTVW16" class="text-secondary" target="_blank">researchr</a>, <a class="text-secondary" data-toggle="collapse" href="5.html#AbstractAntwerpenNTVW16" role="button" aria-expanded="false" aria-controls="AbstractAntwerpenNTVW16"">abstract</a>]
|
||||
|
||||
<!-- -->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="collapse mt-1 mb-2" id="AbstractAntwerpenNTVW16">
|
||||
<div class="">
|
||||
In previous work, we introduced scope graphs as a formalism for describing program binding structure and performing name resolution in an AST-independent way. In this paper, we show how to use scope graphs to build static semantic analyzers. We use constraints extracted from the AST to specify facts about binding, typing, and initialization. We treat name and type resolution as separate building blocks, but our approach can handle language constructs -- such as record field access -- for which binding and typing are mutually dependent. We also refine and extend our previous scope graph theory to address practical concerns including ambiguity checking and support for a wider range of scope relationships. We describe the details of constraint generation for a model language that illustrates many of the interesting static analysis issues associated with modules and records.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item pl-lg-0 border-0 pb-0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-primary pl-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<a name="NeronTVW15"></a>
|
||||
|
||||
<a class="font-weight-bold text-dark" target="_blank" href="http://dx.doi.org/10.1007/978-3-662-46669-8\_9">A Theory of Name Resolution</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
<a class="text-secondary" href="https://researchr.org/profile/pierrejeanmichelneron/publications">Pierre Néron</a>, <a class="text-secondary" href="http://www.cs.pdx.edu/~apt">Andrew P. Tolmach</a>, <a class="text-secondary" href="http://eelcovisser.org">Eelco Visser</a>, <a class="text-secondary" href="https://www.linkedin.com/in/guidowachsmuth/">Guido Wachsmuth</a>.
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
|
||||
|
||||
ESOP 2015
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[<a href="../publications/2015/NeronTVW15.pdf" class="text-secondary" target="_blank">pdf</a>, <a class="text-secondary" href="http://dx.doi.org/10.1007/978-3-662-46669-8\_9" target="_blank">doi</a>, <a class="text-secondary" target="_blank" href="https://researchr.org/publication/NeronTVW15/bibtex">bib</a>, <a href="https://researchr.org/publication/NeronTVW15" class="text-secondary" target="_blank">researchr</a>, <a class="text-secondary" data-toggle="collapse" href="5.html#AbstractNeronTVW15" role="button" aria-expanded="false" aria-controls="AbstractNeronTVW15"">abstract</a>]
|
||||
|
||||
<!-- -->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="collapse mt-1 mb-2" id="AbstractNeronTVW15">
|
||||
<div class="">
|
||||
We describe a language-independent theory for name binding and resolution, suitable for programming languages with complex scoping rules including both lexical scoping and modules. We formulate name resolution as a two-stage problem. First a language-independent scope graph is constructed using language-specific rules from an abstract syntax tree. Then references in the scope graph are resolved to corresponding declarations using a language-independent resolution process. We introduce a resolution calculus as a concise, declarative, and languageindependent specification of name resolution. We develop a resolution algorithm that is sound and complete with respect to the calculus. Based on the resolution calculus we develop language-independent definitions of α-equivalence and rename refactoring. We illustrate the approach using a small example language with modules. In addition, we show how our approach provides a model for a range of name binding patterns in existing languages.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="4.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../lectures/index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="6.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<ul id="my_toc" class="toc list-group list-group-flush d-none d-lg-block d-xl-block p-0 ml-0 mt-3">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="5.html#slides">Slides</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="5.html#scopes-as-types">Scopes as Types</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="5.html#scope-graphs">Scope Graphs</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="5.html#towards-semantic-editor-services">Towards Semantic Editor Services</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="5.html#references">References</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="4.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="6.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../lectures/index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
1063
lecture/6.html
Normal file
1039
lecture/7.html
Normal file
989
lecture/8.html
Normal file
|
|
@ -0,0 +1,989 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Lecture 8a: From Context-Free Grammars to Parsers</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
<a href="../lectures/2021/07-parsing/CS4200-2021-7-parsing.pdf">
|
||||
<img class="border border-dark" width="100%" src="../lectures/2021/07-parsing/CS4200-2020-7-parsing-slr-table.png"/>
|
||||
</a>
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Lecture 8a: From Context-Free Grammars to Parsers
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
Eelco Visser
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Lecture
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
| <a class="text-primary" href="../lectures/2021/07-parsing/CS4200-2021-7-parsing.pdf">PDF</a>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
October 14, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<p>In this lecture we study how we can derive parsers from context-free grammars.
|
||||
We start with looking again at the semantics of context-free grammars as derivations.
|
||||
Then we observe that parsing is the inverse of derivation, i.e. reducing a sentence to a (start) symbol or parse tree.
|
||||
A shift-reduce parsers computes a right-most derivation for a sentence.
|
||||
The question is then how to make that process deterministic and efficient.
|
||||
First we see how item sets encode the state of a shift-reduce parser and make it clear what actions can be undertaking without consulting the grammar.
|
||||
Next, we compute the FOLLOW set of a grammar in order to determine which action to take next in case there are multiple possible actions in a state.
|
||||
This approach yields a linear deterministic parser for grammars in the the SLR(1) format, i.e. those grammars for which this method produces a parse table without shift/reduce conflicts.</p>
|
||||
|
||||
<!-- <img src="/2021/lectures/2021/07-parsing/CS4200-2020-7-parsing-slr-table.png" style="border: solid 1px black;"/> -->
|
||||
|
||||
<h3 id="slides">Slides</h3>
|
||||
|
||||
<ul>
|
||||
<li><a href="../lectures/2021/07-parsing/CS4200-2021-7-parsing.pdf">Slides</a></li>
|
||||
<li><a href="../lectures/2021/07-parsing/CS4200-2021-7-parsing-builds.pdf">Slides with builds</a></li>
|
||||
</ul>
|
||||
|
||||
<h3 id="references">References</h3>
|
||||
|
||||
|
||||
|
||||
|
||||
<ul class="list-group list-group-flush pb-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item pl-lg-0 border-0 pb-0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-primary pl-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<a name="KatsVW10"></a>
|
||||
|
||||
<a class="font-weight-bold text-dark" target="_blank" href="http://doi.acm.org/10.1145/1869459.1869535">Pure and declarative syntax definition: paradise lost and regained</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
<a class="text-secondary" href="http://www.lclnet.nl/">Lennart C. L. Kats</a>, <a class="text-secondary" href="http://eelcovisser.org">Eelco Visser</a>, <a class="text-secondary" href="https://www.linkedin.com/in/guidowachsmuth/">Guido Wachsmuth</a>.
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
|
||||
|
||||
OOPSLA 2010
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[<a class="text-secondary" href="http://doi.acm.org/10.1145/1869459.1869535" target="_blank">doi</a>, <a class="text-secondary" target="_blank" href="https://researchr.org/publication/KatsVW10/bibtex">bib</a>, <a href="https://researchr.org/publication/KatsVW10" class="text-secondary" target="_blank">researchr</a>, <a class="text-secondary" data-toggle="collapse" href="8.html#AbstractKatsVW10" role="button" aria-expanded="false" aria-controls="AbstractKatsVW10"">abstract</a>]
|
||||
|
||||
<!-- KatsVW10 -->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="collapse mt-1 mb-2" id="AbstractKatsVW10">
|
||||
<div class="">
|
||||
Syntax definitions are pervasive in modern software systems, and serve as the basis for language processing tools like parsers and compilers. Mainstream parser generators pose restrictions on syntax definitions that follow from their implementation algorithm. They hamper evolution, maintainability, and compositionality of syntax definitions. The pureness and declarativity of syntax definitions is lost. We analyze how these problems arise for different aspects of syntax definitions, discuss their consequences for language engineers, and show how the pure and declarative nature of syntax definitions can be regained.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item pl-lg-0 border-0 pb-0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-info pl-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<a name="AhoLSU2006"></a>
|
||||
|
||||
Compilers: Principles, Techniques, and Tools (2nd Edition)
|
||||
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
<a class="text-secondary" href="https://researchr.org/alias/a.-v.-aho">A. V. Aho</a>, <a class="text-secondary" href="https://researchr.org/alias/m.-s.-lam"> M. S. Lam</a>, <a class="text-secondary" href="https://researchr.org/alias/r.-sethi">R. Sethi</a>, <a class="text-secondary" href="https://researchr.org/alias/j.-d.-ullman"> J. D. Ullman</a>.
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[<a class="text-secondary" target="_blank" href="https://researchr.org/publication/AhoLSU2006/bibtex">bib</a>, <a href="https://researchr.org/publication/AhoLSU2006" class="text-secondary" target="_blank">researchr</a>]
|
||||
|
||||
<!-- AhoLSU2006 -->
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item pl-lg-0 border-0 pb-0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-primary pl-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<a name="Visser97-IWPT"></a>
|
||||
|
||||
A Case Study in Optimizing Parsing Schemata by Disambiguation Filters
|
||||
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
<a class="text-secondary" href="http://eelcovisser.org">Eelco Visser</a>.
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
|
||||
|
||||
International Workshop on Parsing Technology (IWPT 1997) 1997
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[<a class="text-secondary" target="_blank" href="https://researchr.org/publication/Visser97-IWPT/bibtex">bib</a>, <a href="https://researchr.org/publication/Visser97-IWPT" class="text-secondary" target="_blank">researchr</a>, <a class="text-secondary" data-toggle="collapse" href="8.html#AbstractVisser97-IWPT" role="button" aria-expanded="false" aria-controls="AbstractVisser97-IWPT"">abstract</a>]
|
||||
|
||||
<!-- Visser97-IWPT -->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="collapse mt-1 mb-2" id="AbstractVisser97-IWPT">
|
||||
<div class="">
|
||||
Disambiguation methods for context-free grammars enable concise specification of programming languages by ambiguous grammars. A disambiguation filter is a function that selects a subset from a set of parse trees---the possible parse trees for an ambiguous sentence. The framework of filters provides a declarative description of disambiguation methods independent of parsing. Although filters can be implemented straightforwardly as functions that prune the parse forest produced by some generalized, this can be too inefficient for practical applications. In this paper the optimization of parsing schemata, a framework for high-level description of parsing algorithms, by disambiguation filters is considered in order to find efficient parsing algorithms for declaratively specified disambiguation methods. As a case study the optimization of the parsing schema of Earley's parsing algorithm by two filters is investigated. The main result is a technique for generation of efficient LR-like parsers for ambiguous grammars modulo priorities.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-group-item pl-lg-0 border-0 pb-0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="bd-callout border-success pl-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<a name="Sikkel93-thesis"></a>
|
||||
|
||||
<a class="font-weight-bold text-dark" target="_blank" href="https://www.base-search.net/Record/019acdb54fd1d19c305a35f7d2572a792c9ad3314ad3ae087a66267f15cadd33">Parsing Schemata</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
<a class="text-secondary" href="https://researchr.org/alias/klaas-sikkel">Klaas Sikkel</a>.
|
||||
</div>
|
||||
|
||||
<div class="font-weight-light text-secondary" style="font-size:90%;">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
PhD thesis, University of Twente, Enschede, Netherlands, 1993
|
||||
|
||||
[<a href="https://tudelft-cs4200.github.io/2021https://research.utwente.nl/files/6041692/Sikkel93thesis.pdf" class="text-secondary" target="_blank">pdf</a>, <a class="text-secondary" href="https://www.base-search.net/Record/019acdb54fd1d19c305a35f7d2572a792c9ad3314ad3ae087a66267f15cadd33" target="_blank">doi</a>, <a class="text-secondary" target="_blank" href="https://researchr.org/publication/Sikkel93-thesis/bibtex">bib</a>, <a href="https://researchr.org/publication/Sikkel93-thesis" class="text-secondary" target="_blank">researchr</a>]
|
||||
|
||||
<!-- -->
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="7.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../lectures/index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="8b.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<ul id="my_toc" class="toc list-group list-group-flush d-none d-lg-block d-xl-block p-0 ml-0 mt-3">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="8.html#slides">Slides</a></li>
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="8.html#references">References</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="7.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="8b.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../lectures/index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
1100
lecture/8b.html
Normal file
743
lecture/9.html
Normal file
|
|
@ -0,0 +1,743 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Eelco Visser">
|
||||
<meta name="generator" content="Jekyll v3.8.5">
|
||||
<title>Lecture 9: CS4200-A: Summary and Q&A</title>
|
||||
<!-- <base href="/2021"> -->
|
||||
|
||||
<!--link rel="canonical" href="https://getbootstrap.com/docs/4.3/examples/starter-template/"-->
|
||||
|
||||
<link rel="icon" href="../img/logo/pl_ico2_2B3_icon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!--link href="https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="../css/main.css" rel="stylesheet">
|
||||
<link href="../css/borders-responsive.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="../css/pl.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
|
||||
<a class="navbar-brand" href="../index.html">
|
||||
TU Delft | CS4200
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../lectures/index.html" tabindex="-1" aria-disabled="true">Lectures</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../homework/index.html" tabindex="-1" aria-disabled="true">Homework</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../project/index.html" tabindex="-1" aria-disabled="true">Project</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../news/index.html" tabindex="-1" aria-disabled="true">News</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="../blog/index.html" tabindex="-1" aria-disabled="true">Blog</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
|
||||
<a href="../lectures/2021/09-summary/CS4200-2021-9-summary.pdf">
|
||||
<img class="border border-dark" width="100%" src="../lectures/2021/09-summary/CS4200-2021-9-summary/CS4200-2021-9-summary.001.png"/>
|
||||
</a>
|
||||
|
||||
|
||||
<div class="mt-3 mb-3 pt-3 pb-3 text-dark border-top border-bottom border-grey">
|
||||
<div class="text-dark font-weight-bold">
|
||||
<h1>
|
||||
|
||||
Lecture 9: CS4200-A: Summary and Q&A
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
Eelco Visser
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
Lecture
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
| <a class="text-primary" href="../lectures/2021/09-summary/CS4200-2021-9-summary.pdf">PDF</a>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
October 21, 2021
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-9 border-lg-right border-grey">
|
||||
<p>In this lecture we look back at what we have studied in the course and I answer questions about the material.</p>
|
||||
|
||||
<p>If you have questions please submit them by Wednesday morning October 21.</p>
|
||||
|
||||
<h3 id="slides">Slides</h3>
|
||||
|
||||
<ul>
|
||||
<li><a href="../lectures/2021/09-summary/CS4200-2021-9-summary.pdf">Slides</a></li>
|
||||
<li><a href="../lectures/2021/09-summary/CS4200-2021-9-summary-builds.pdf">Slides with builds</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<ul class="list-group list-group-flush pb-3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-3 col-xl-3 " >
|
||||
<div class="sticky-top top70 d-none d-lg-block d-xl-block">
|
||||
<div class="pb4 mb3 border-bottom border-grey ">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-left">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="8b.html">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../lectures/index.html">
|
||||
^
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="10.html">»</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<ul id="my_toc" class="toc list-group list-group-flush d-none d-lg-block d-xl-block p-0 ml-0 mt-3">
|
||||
<li class="list-group-item pl-0 ml-0 border-0 pl-0 pt-0 pb-1 pr-0 m-0 mr-3"><a href="9.html#slides">Slides</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="border-top border-bottom border-grey mt-3 pt-3">
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="8b.html">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="10.html">Next</a>
|
||||
</li>
|
||||
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="../lectures/index.html">
|
||||
Index
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
BIN
lectures/2021/01-introduction/CS4200-2021-1-introduction.pdf
Normal file
|
After Width: | Height: | Size: 167 KiB |
|
After Width: | Height: | Size: 247 KiB |
BIN
lectures/2021/03-disambiguation/CS4200-2021-3-disambiguation.pdf
Normal file
|
After Width: | Height: | Size: 235 KiB |
|
After Width: | Height: | Size: 144 KiB |
BIN
lectures/2021/05-name-binding/CS4200-2020-5-name-binding.pdf
Normal file
|
After Width: | Height: | Size: 278 KiB |
|
After Width: | Height: | Size: 261 KiB |
BIN
lectures/2021/07-parsing/CS4200-2020-7-parsing-slr-table.png
Normal file
|
After Width: | Height: | Size: 292 KiB |
BIN
lectures/2021/07-parsing/CS4200-2021-7-parsing-builds.pdf
Normal file
BIN
lectures/2021/07-parsing/CS4200-2021-7-parsing.pdf
Normal file
BIN
lectures/2021/08-more-parsing/CS4200-2020-8-parsing-builds.pdf
Normal file
BIN
lectures/2021/08-more-parsing/CS4200-2020-8-parsing.pdf
Normal file
BIN
lectures/2021/08-more-parsing/title.png
Normal file
|
After Width: | Height: | Size: 96 KiB |
BIN
lectures/2021/09-summary/CS4200-2021-9-summary-builds.pdf
Normal file
BIN
lectures/2021/09-summary/CS4200-2021-9-summary.pdf
Normal file
|
After Width: | Height: | Size: 227 KiB |
|
After Width: | Height: | Size: 120 KiB |
|
After Width: | Height: | Size: 127 KiB |
|
After Width: | Height: | Size: 143 KiB |