parsing-upec: Add.

This commit is contained in:
Sergiu Ivanov 2018-09-23 01:00:59 +02:00
parent 5978657f85
commit 461ac602b7
8 changed files with 157 additions and 2 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -69,7 +69,7 @@ Jump to:
- [[file:togit.org][To Git or Not to Git]]
- [[file:h4life.org][Haskell for Life]]
- [[file:os-upec.org][operating systems and networks]]
- basic parsing
- [[file:parsing-upec.org][basic parsing]]
#+ATTR_HTML: :alt image of Creative Commons Attribution Alone licence :class ccby
[[https://en.wikipedia.org/wiki/Creative_Commons_license][file:../content/imgs/ccby.png]]

77
en/parsing-upec.org Normal file
View File

@ -0,0 +1,77 @@
#+TITLE: Basic Parsing
#+LANGUAGE: en
#+ATTR_HTML: :alt in French :class lang-lifted
[[file:../fr/parsing-upec.org][file:../content/imgs/fr.png]]
#+ATTR_HTML: :alt return home :class home
[[file:home.org][file:../content/imgs/home.png]]
I taught the part of a course on formal languages which was related to
the [[http://en.wikipedia.org/wiki/Chomsky%2520hierarchy][Chomsky hierarchy]] and [[http://en.wikipedia.org/wiki/Parsing][parsing]].
#+ATTR_HTML: :alt image of Creative Commons Attribution Alone licence :class ccby
[[https://en.wikipedia.org/wiki/Creative_Commons_license][file:../content/imgs/ccby.png]]
The materials of my course are distributed under the [[https://en.wikipedia.org/wiki/Creative_Commons_license][Creative Commons
Attribution Alone licence]].
* Slides
The slides for this course are available [[file:../content/courses/parsing-upec/parsing.pdf][here]] (in French).
* Practical assignment
The exercises for the practical assignment (in French) can be
downloaded [[file:../content/courses/parsing-upec/parsing-tp.pdf][here]].
* Source code
In this course I show a simple interpreter for a language of
variable assignments. The variables can either be strings or integer
numbers. A program in this language may look as follows:
#+BEGIN_SRC
String var1 = "hello world 1 + 2";
int var2 = 1 - (2 + 3);
int var3 = 4 + var2;
#+END_SRC
[[file:../content/courses/parsing-upec/parsing.zip][This archive]] contains the complete source code of the interpreter as
well as several example programs.
To build the project, run the following commands:
#+BEGIN_SRC
jflex arith.flex
jacc arith.jacc
javac ArithEval.java
#+END_SRC
The following command runs just the scanner on the first example:
#+BEGIN_SRC
java Yylex examples/example1.duck
#+END_SRC
The following command runs the interpreter on the first example:
#+BEGIN_SRC
java ArithEval examples/example1.duck
#+END_SRC
* Toolchain
The project relies on [[http://jflex.de/download.html][JFlex]] scanner generator and [[http://web.cecs.pdx.edu/~mpj/jacc/][Jacc]] parser
generator. Both tools generate Java code. [[file:../content/courses/parsing-upec/parsing-workflow.pdf][Here]] is a short overview
of a typical workflow.
This toolchain was suggested by [[http://lacl.univ-paris12.fr/gava/actuel.htm][Frédéric Gava]] (section Parsing de
fichiers en Java). This page also contains other slides about
parsing.
* Local Variables :noexport:
# Local Variables:
# org-link-file-path-type: relative
# eval: (auto-fill-mode)
# ispell-local-dictionary: "en"
# End:

View File

@ -72,7 +72,7 @@ Liens rapides :
- [[file:togit.org][To Git or Not to Git]]
- [[file:h4life.org][Haskell for Life]]
- [[file:os-upec.org][introduction au systèmes d'exploitation et réseaux]]
- bases de l'analyse syntaxique
- [[file:parsing-upec.org][bases de l'analyse syntaxique]]
#+ATTR_HTML: :alt image de la licence Creative Commons Attribution Alone :class ccby
[[https://fr.wikipedia.org/wiki/Licence_Creative_Commons][file:../content/imgs/ccby.png]]

78
fr/parsing-upec.org Normal file
View File

@ -0,0 +1,78 @@
#+TITLE: Analyse syntaxique
#+LANGUAGE: fr
#+ATTR_HTML: :alt en anglais :class lang-lifted
[[file:../en/parsing-upec.org][file:../content/imgs/en.png]]
#+ATTR_HTML: :alt return home :class home
[[file:home.org][file:../content/imgs/home.png]]
J'ai assuré la partie d'un cours sur la théorie des langages formels
portant sur la [[https://fr.wikipedia.org/wiki/Hi%25C3%25A9rarchie_de_Chomsky][hiérarchie de Chomsky]] et sur l'[[https://fr.wikipedia.org/wiki/Analyse_syntaxique][analyse syntaxique]].
#+ATTR_HTML: :alt image de la licence Creative Commons Attribution Alone :class ccby
[[https://fr.wikipedia.org/wiki/Licence_Creative_Commons][file:../content/imgs/ccby.png]]
Mes supports de cours sont distribués sous la [[https://fr.wikipedia.org/wiki/Licence_Creative_Commons][licence Creative Commons
Paternité]].
* Diapositives
Les diapositives sont disponibles [[file:../content/courses/parsing-upec/parsing.pdf][ici]].
* Travaux Pratiques
L'énonce du TP est disponible [[file:../content/courses/parsing-upec/parsing-tp.pdf][ici]].
* Exemples de code
Dans ce cours nous développons un interpréteur pour un langage
simple d'affectations de variables de types nombre entier ou chaîne
de caractère. Un programme dans ce langage a la forme suivante :
#+BEGIN_SRC
String var1 = "hello world 1 + 2";
int var2 = 1 - (2 + 3);
int var3 = 4 + var2;
#+END_SRC
Le code source ainsi que quelques exemples sont inclus dans [[file:../content/courses/parsing-upec/parsing.zip][cette
archive]].
Pour tout compiler, il faut effectuer la séquence d'actions
suivante :
#+BEGIN_SRC
jflex arith.flex
jacc arith.jacc
javac ArithEval.java
#+END_SRC
La commande suivante lance uniquement le scanner sur le premier
exemple :
#+BEGIN_SRC
java Yylex examples/example1.duck
#+END_SRC
La commande suivante lance l'interpréteur sur le premier exemple :
#+BEGIN_SRC
java ArithEval examples/example1.duck
#+END_SRC
* Outils
Nous utilisons le générateur de scanners [[http://jflex.de/download.html][JFlex]] et le générateur
d'analyseurs [[http://web.cecs.pdx.edu/~mpj/jacc/][Jacc]]. Les deux outils génèrent du code Java. [[file:../content/courses/parsing-upec/parsing-workflow.pdf][Voici]] une
présentation courte de la façon dont JFlex et Jacc sont utilisés.
Ce choix d'outils a été proposé par [[http://lacl.univ-paris12.fr/gava/actuel.htm][Frédéric Gava]] (section Parsing
de fichiers en Java). Cette page contient également d'autres
diapositives au sujet de l'analyse syntaxique.
* Local Variables :noexport:
# Local Variables:
# org-link-file-path-type: relative
# eval: (auto-fill-mode)
# ispell-local-dictionary: "fr"
# End: