-
Notifications
You must be signed in to change notification settings - Fork 4
/
COOLTHINGS
67 lines (49 loc) · 2.71 KB
/
COOLTHINGS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
One of the really cool things about Perl 6 is that it contains the means
of parsing its own source code into an abstract syntax tree, which can
then be inspected and modified in various ways from inside the language
runtime.
That dream still hasn't come true, though. GGE is being built with the
explicit purpose of showing what can be done when Perl 6 can read and
modify Perl 6 on the syntax tree level. Like proto, GGE's more of a
proof-of-concept than a long-term solution. Specifically, the feature
provided by GGE (matching on text and returning a reliable AST)
should be provided by any sufficiently advanced Perl 6 implementation,
since "grammatical introspection" is one of the big selling-points of
Perl 6. Until that day, though, GGE helps us probe ahead.
The purpose of this file is to share a bit of the enthusiasm, by listing
the set of possible applications that become possible with a fully
functioning GGE.
In order of increasing ambitiousness:
= A CLI grammar debugger
Basically, a clone of the debugging feature in Damian Conway's
Regexp::Grammars. This is possible because GGE can easily be made to contain
hooks in the right places for debug output.
= A Web.pm grammar debugger
An interactive web form where people modify their grammar and get feedback
on a given input in real time, seeing what happens when the grammar tries
to match the input text. Specifically, the user will see where the match
*fails*, which is something that is missing from the current set of tools.
The applications below also require that we have a fully operational Perl
6 parser atop GGE.
= A Perl 6 macro preprocessor
A simple filter which parses macros and applies them to the source code,
generating a new source code with the macros applied -- and which even a
Rakudo not implementing macros can run. A sort of a 'have the cake and
eat it' scenario.
= A static code analyzer
This is one of my favorites. I have a list of things I'd like to check
statically in Perl 6 code, such as mis-use of some features, possible
(or certain!) value errors, unreachable code etc. Sort of a Perl::Critic
for Perl 6.
= A runtime
Running Perl 6 on top of Perl 6? The thought is too attainable to resist.
= A coverage tool
As long as we have a runtime, we might as well construct it so that it
keeps track of coverage information.
= A time-travelling debugger
As long as we have a runtime, we might as well construct it so that it
can be rewinded and fast-forwarded at will. This is a goal only reached
a few times in computer history. Wondering why that variable got the
value it did? No need to re-run the program; just rewind it to its last
assignment. Changed a value at some past point in the running history? No
prob; we'll just re-run things from that point onwards.