author | Christian Urban <christian.urban@kcl.ac.uk> |
Sat, 29 Jan 2022 23:53:21 +0000 | |
changeset 400 | 46e5566ad4ba |
parent 398 | dac6d27c99c6 |
child 401 | 8bbe2468fedc |
permissions | -rwxr-xr-x |
396 | 1 |
\documentclass[runningheads]{lipics-v2021} |
2 |
\usepackage{times} |
|
3 |
\usepackage{isabelle} |
|
4 |
\usepackage{isabellesym} |
|
5 |
\usepackage{amsmath} |
|
6 |
\usepackage{amssymb} |
|
7 |
\usepackage{mathpartir} |
|
8 |
\usepackage{tikz} |
|
9 |
\usepackage{pgf} |
|
10 |
\usetikzlibrary{positioning} |
|
11 |
%\usepackage{pdfsetup} |
|
12 |
%\usepackage{stmaryrd} |
|
13 |
%\usepackage{url} |
|
14 |
%\usepackage{color} |
|
15 |
%\usepackage[safe]{tipa} |
|
16 |
%\usepackage[sc]{mathpazo} |
|
17 |
%\usepackage{fontspec} |
|
18 |
%\setmainfont[Ligatures=TeX]{Palatino Linotype} |
|
19 |
||
20 |
||
21 |
||
22 |
||
23 |
\urlstyle{rm} |
|
24 |
\isabellestyle{it} |
|
25 |
\renewcommand{\isastyleminor}{\it}% |
|
26 |
\renewcommand{\isastyle}{\normalsize\it}% |
|
27 |
||
28 |
||
29 |
\def\dn{\,\stackrel{\mbox{\scriptsize def}}{=}\,} |
|
30 |
\renewcommand{\isasymequiv}{$\dn$} |
|
31 |
\renewcommand{\isasymemptyset}{$\varnothing$} |
|
32 |
\renewcommand{\isacharunderscore}{\mbox{$\_\!\_$}} |
|
33 |
\renewcommand{\isasymiota}{\makebox[0mm]{${}^{\prime}$}} |
|
34 |
\renewcommand{\isasymin}{\ensuremath{\,\in\,}} |
|
35 |
||
36 |
||
37 |
\def\Brz{Brzozowski} |
|
38 |
\def\der{\backslash} |
|
39 |
\newtheorem{falsehood}{Falsehood} |
|
40 |
\newtheorem{conject}{Conjecture} |
|
41 |
||
42 |
\bibliographystyle{plainurl} |
|
43 |
||
44 |
\title{{POSIX} {L}exing with {B}itcoded {D}erivatives} |
|
45 |
\titlerunning{POSIX Lexing with Bitcoded Derivatives} |
|
46 |
\author{Chengsong Tan}{King's College London}{chengsong.tan@kcl.ac.uk}{}{} |
|
47 |
\author{Christian Urban}{King's College London}{christian.urban@kcl.ac.uk}{}{} |
|
398 | 48 |
\authorrunning{C.~Tan and C.~Urban} |
397
e1b74d618f1b
updated Sizebound4
Christian Urban <christian.urban@kcl.ac.uk>
parents:
396
diff
changeset
|
49 |
\keywords{POSIX matching, Derivatives of Regular Expressions, Isabelle/HOL} |
e1b74d618f1b
updated Sizebound4
Christian Urban <christian.urban@kcl.ac.uk>
parents:
396
diff
changeset
|
50 |
\category{} |
e1b74d618f1b
updated Sizebound4
Christian Urban <christian.urban@kcl.ac.uk>
parents:
396
diff
changeset
|
51 |
\ccsdesc[100]{Design and analysis of algorithms} |
e1b74d618f1b
updated Sizebound4
Christian Urban <christian.urban@kcl.ac.uk>
parents:
396
diff
changeset
|
52 |
\ccsdesc[100]{Formal languages and automata theory} |
e1b74d618f1b
updated Sizebound4
Christian Urban <christian.urban@kcl.ac.uk>
parents:
396
diff
changeset
|
53 |
\Copyright{\mbox{}} |
e1b74d618f1b
updated Sizebound4
Christian Urban <christian.urban@kcl.ac.uk>
parents:
396
diff
changeset
|
54 |
\nolinenumbers |
396 | 55 |
|
56 |
||
57 |
\begin{document} |
|
58 |
\maketitle |
|
59 |
||
60 |
\begin{abstract} |
|
397
e1b74d618f1b
updated Sizebound4
Christian Urban <christian.urban@kcl.ac.uk>
parents:
396
diff
changeset
|
61 |
Sulzmann and Lu described a lexing algorithm that calculates |
400 | 62 |
Brzozowski derivatives using bitcodes annotated to regular |
397
e1b74d618f1b
updated Sizebound4
Christian Urban <christian.urban@kcl.ac.uk>
parents:
396
diff
changeset
|
63 |
expressions. Their algorithm generates POSIX values which encode |
e1b74d618f1b
updated Sizebound4
Christian Urban <christian.urban@kcl.ac.uk>
parents:
396
diff
changeset
|
64 |
the information of \emph{how} a regular expression matches a |
e1b74d618f1b
updated Sizebound4
Christian Urban <christian.urban@kcl.ac.uk>
parents:
396
diff
changeset
|
65 |
string---that is, which part of the string is matched by which part |
400 | 66 |
of the regular expression. The purpose of the bitcodes in Sulzmann |
67 |
and Lu's algorithm is to generate POSIX values incrementally while |
|
68 |
derivatives are calculated. However they also help with designing |
|
69 |
`aggressive' simplification methods that keep the size of |
|
70 |
derivatives small. Without simplification derivatives can grow |
|
71 |
exponentially resulting in an extremely slow lexing algorithm. In this |
|
72 |
paper we describe a variant of Sulzmann and Lu's algorithm: Our |
|
73 |
algorithm is a small, recursive functional program, whereas Sulzmann |
|
74 |
and Lu's version involves a fixpoint construction. We \textit{(i)} |
|
75 |
prove in Isabelle/HOL that our program is correct and generates |
|
76 |
unique POSIX values; we also \textit{(ii)} establish a polynomial |
|
77 |
bound for the size of the derivatives. The size can be seen as a |
|
78 |
proxy measure for the effeciency of the lexing algorithm---that means |
|
79 |
our algorithm does not suffer from the exponential blowup. |
|
397
e1b74d618f1b
updated Sizebound4
Christian Urban <christian.urban@kcl.ac.uk>
parents:
396
diff
changeset
|
80 |
|
400 | 81 |
% Brzozowski introduced the notion of derivatives for regular |
82 |
% expressions. They can be used for a very simple regular expression |
|
83 |
% matching algorithm. Sulzmann and Lu cleverly extended this |
|
84 |
% algorithm in order to deal with POSIX matching, which is the |
|
85 |
% underlying disambiguation strategy for regular expressions needed |
|
86 |
% in lexers. Their algorithm generates POSIX values which encode |
|
87 |
% the information of \emph{how} a regular expression matches a |
|
88 |
% string---that is, which part of the string is matched by which |
|
89 |
% part of the regular expression. In this paper we give our |
|
90 |
% inductive definition of what a POSIX value is and show $(i)$ that |
|
91 |
% such a value is unique (for given regular expression and string |
|
92 |
% being matched) and $(ii)$ that Sulzmann and Lu's algorithm always |
|
93 |
% generates such a value (provided that the regular expression |
|
94 |
% matches the string). We show that $(iii)$ our inductive definition |
|
95 |
% of a POSIX value is equivalent to an alternative definition by |
|
96 |
% Okui and Suzuki which identifies POSIX values as least elements |
|
97 |
% according to an ordering of values. We also prove the correctness |
|
98 |
% of Sulzmann's bitcoded version of the POSIX matching algorithm and |
|
99 |
% extend the results to additional constructors for regular |
|
100 |
% expressions. \smallskip |
|
396 | 101 |
\end{abstract} |
102 |
||
103 |
||
104 |
||
105 |
\input{session} |
|
106 |
||
107 |
||
108 |
||
109 |
\end{document} |
|
110 |
||
111 |
%%% Local Variables: |
|
112 |
%%% mode: latex |
|
113 |
%%% TeX-master: t |
|
114 |
%%% End: |