[icfp] size of elab fucntions
This commit is contained in:
parent
56cf0b3ffc
commit
0250b7b109
|
@ -1,15 +1,52 @@
|
|||
\newcommand{\twoline}[2]{\parbox[s]{1.44cm}{\flushright\hfill #1\newline#2}}
|
||||
\begin{tabular}{l r r r}
|
||||
Module & LOC & $\interp$ & $\trans$ \\\hline
|
||||
Module & LOC & $\interp$ (LOC) & $\elab$ (LOC) \\\hline
|
||||
\mod{db} & 263 & 2 (78) & 2 (101) \\
|
||||
\mod{format} & 66 & 1 (33) & 1 \,~(21) \\
|
||||
\mod{function} & 31 & 1 ~~(8) & 1 \,~(11) \\
|
||||
\mod{function} & 117 & 1 (11) & 2 \,~(51) \\
|
||||
\mod{math} & 90 & 1 ~~(3) & 5 \,~(46) \\
|
||||
\mod{regexp} & 122 & 6 (60) & 5 \,~(33) \\
|
||||
\mod{regexp} & 137 & 6 (60) & 5 \,~(33) \\
|
||||
\mod{vector} & 228 & 1 (19) & 13 (163) \\\hline
|
||||
{\bf Total} & 800 & 12 (201) & 27 (375) \\
|
||||
{\bf Total} & 901 & 12 (204) & 27 (415) \\
|
||||
\end{tabular}
|
||||
%% AVG
|
||||
% loc : 228.5
|
||||
% int : 33.5
|
||||
% trn : 62.5
|
||||
|
||||
%% elab frontends
|
||||
%% mean 10, median 7
|
||||
%db
|
||||
%- query 35
|
||||
%- connect 7
|
||||
%
|
||||
%fromat
|
||||
%- fmt 16
|
||||
%- pf 5
|
||||
%
|
||||
%curry
|
||||
%- c 12
|
||||
%- m 40
|
||||
%
|
||||
%math
|
||||
%- 1 1 1 1
|
||||
%- e 8
|
||||
%
|
||||
%rx
|
||||
%- 1 1 1 1
|
||||
%- m 16
|
||||
%
|
||||
%v
|
||||
%- len 5
|
||||
%- ref 10
|
||||
%- set 10
|
||||
%- map 19
|
||||
%- map! 15
|
||||
%- app 29
|
||||
%- ls 14
|
||||
%- im 8
|
||||
%- fll 13
|
||||
%- t 2
|
||||
%- tr 2
|
||||
%- d 2
|
||||
%- dr 2
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
@; TODO this is all so boring right now, need to revise heavily
|
||||
|
||||
@Figure-ref{fig:stats} gives a few statistics regarding our implementation.
|
||||
The purpose of this section is to explain why the numbers are low.
|
||||
The purpose of this section is to explain why the line counts are low.
|
||||
@; Ode to macros, implementation a symphony
|
||||
|
||||
@figure["fig:stats"
|
||||
|
@ -19,16 +19,16 @@ The purpose of this section is to explain why the numbers are low.
|
|||
@exact|{\input{fig-stats}}|
|
||||
]
|
||||
|
||||
In total, our six applications comprise 800 lines of code (LOC).
|
||||
In total, the code for our six applications described in @Secref{sec:usage}
|
||||
comprise 901 lines of code (LOC).
|
||||
Another 145 lines implement common functionality, putting the grand total
|
||||
just under 1000 LOC.
|
||||
just over 1000 LOC.
|
||||
|
||||
Except for @exact|{\mod{db}}| and @exact|{\mod{regexp}}|, each of the
|
||||
core modules defines a single function in @exact|{$\interp$}|.
|
||||
In @exact|{\mod{db}}| the two functions are the schema predicate and @tt{SQL}
|
||||
query parser (we omit the trivial interpreter for connections).
|
||||
@; TODO no parentheses?
|
||||
On the other hand, @exact|{\mod{regexp}}| implements six group-parsing functions
|
||||
core modules defines a single interpretation function (in @exact|{$\interp$}|).
|
||||
In @exact|{\mod{db}}|, the two functions are the schema predicate and @tt{SQL}
|
||||
query parser.
|
||||
In @exact|{\mod{regexp}}|, we have six group-parsing functions
|
||||
to match the six string-like input types
|
||||
@;@note{Strings, Regex literals, Posix Regex literls, and byte-string variations of each.}
|
||||
accepted by Racket's @racket[regexp-match].
|
||||
|
@ -39,11 +39,13 @@ The smallest interpreter is the composition of Racket's @racket[number?] predica
|
|||
The largest is the query parser (35 LOC), though the analyses for
|
||||
format strings and regular expressions are approximately the same size.
|
||||
|
||||
The @exact{$\trans$} functions are aliases for standard library procedures.
|
||||
@; TODO much better to show off short code. But let's draft it first.
|
||||
In many cases we are able to re-use code between similar functions.
|
||||
For instance, the arithmetic operators @racket[+ - * /] are implemented by
|
||||
a single fold.
|
||||
The elaboration functions are aliases for standard library procedures.
|
||||
Typically, these functions match a syntactic pattern, check for value errors,
|
||||
and elaborate to a specialized Typed Racket procedure call.
|
||||
All these tasks can be expressed concisely; the average size of a function in
|
||||
@exact{$\elab$} is 10 lines and the median is 7 lines.
|
||||
Much of the brevity is due to amortizing helper functions, so we include helpers'
|
||||
line counts in the figure.
|
||||
|
||||
|
||||
@; -----------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue
Block a user