Commit Graph

679 Commits

Author SHA1 Message Date
Robby Findler
6cacd57ebc add check-redundancy, a parameter that causes redex to print some
debugging information about ambiguous matching (when the ambiguity
matters)
2012-01-09 12:57:24 -06:00
Robby Findler
a12df9cea6 redex: misc cleanups:
- remove cache instrumentation code
 - make hole->not-hole parsimonous
 - change the cache size back to 63
2012-01-09 12:57:23 -06:00
Robby Findler
0c6e0a11cf removed ambiguity from the cont-mark-transform's "a" non-terminal
Redex no longer has extra checks to eliminate redundant matches
(as those checks are prohibitively expensive for the lambdajs model)
so redundancy in the grammar can, when combined with context
decomposition or named patterns, lead to significant slowdowns
2012-01-09 12:57:22 -06:00
Robby Findler
4fab7f76af tweak the compiled representation of lw structs so they take less space
this shrinks the size of redex/examples/r6rs/r6rs.rkt's .zo file by about 25%
2012-01-09 12:57:21 -06:00
Robby Findler
2afda360d0 redex: adjust the test suites to clean up a few things; also make the
hole and the-not-hole equal? to each other (like they used to be)
2012-01-09 12:57:20 -06:00
Robby Findler
93c21e34de added a cycle check to define-language so grammars like this one:
(define-language L
     (e e))

are rejected as syntax errors
2012-01-09 12:57:19 -06:00
Robby Findler
fbed2d5af7 remove (broken) attempt at optimization Jay suggested
also clean up some test cases that I wasn't sure about earlier
2012-01-08 12:13:37 -06:00
Robby Findler
0459e4fbcd redex: when there are no duplicate names in a pattern, don't do the
same-name-same-bindings check

this seems to speed up the r6rs test suite by about 12% and the
lambdajs benchmark by about 25%
2012-01-08 12:13:36 -06:00
Robby Findler
ddecad0575 redex: adjust the way metafunction tracing is printed so you
don't see (list 'lambda (list 'x) 'x) but instead (lambda (x) x)
2012-01-08 12:13:36 -06:00
Robby Findler
160fcacad6 redex: fix bug introduced in recent optimization attempts 2012-01-02 22:21:21 -06:00
Robby Findler
83758881c3 Don't attempt to drop duplicates in the non-terminal case
This speeds up the lambdajs model considerably because the computation
to determine duplicates is expensive and no duplicates are really
ever dropped (and, in general, I think that duplicates will only
be dropped when the grammar is ambiguous; so maybe a better thing
is to just rewrite the grammar when that happens)
2012-01-02 10:08:34 -06:00
Robby Findler
6bf42855b8 adjust plug to be parsimonious and actually shortcircuit
when one hole has been found

This improves the lambdajs model example's running time, presumably
because the hole is generally found near the "beginning" of the
term
2012-01-02 10:08:33 -06:00
Robby Findler
5dcbedc768 redex: adjust the caching strategy
Instead of using a hash-table, use the equal-hash-code directly;
this lets me evict entries only when they clobber each other,
and generally keep good cache utilization.

Also, cut the cache size by a factor of 5 while still having a
slight performance improvement on the r6rs test suite benchmark.
On that same benchmark, there are 1714812 misses in the cache, but
only 3485 times is an entry in the cache clobbered
2012-01-02 10:08:31 -06:00
Robby Findler
a6a01fd7b8 redex: fix arity-1 cache key computation 2012-01-02 10:08:31 -06:00
Robby Findler
a7a70cbca9 redex: improved the definitely-not-list definitely-not-non-list
computation to be more accurate
2012-01-02 10:08:30 -06:00
Robby Findler
fe1df742b3 Tried to improve redex by detecting when a pattern does not
have any holes, hide-holes, or names and, in that case, just
combining booleans instead of building of mtch structs.

This does seem to work on a simple benchmark. The code below
gets about 6x faster. But on the r6rs test suite, there is
no substantial change (possibly because the caching obviates
this optimization?)

lang racket/base
(require redex/reduction-semantics)
(caching-enabled? #f)
(define-language L (e (+ e e) number))
(define t
  (let loop ([n 100])
    (cond
      [(zero? n) 1]
      [else `(+ 11 ,(loop (- n 1)))])))
(define f (redex-match L e))
(time (for ([x (in-range 1000)]) (f t)))
2012-01-02 10:08:29 -06:00
Robby Findler
6f97a3a783 disable attempt at Jay's optimization
When I enabled this, I don't see any speedup, on the R6RS test suite
benchmark (I see minor slowdown). Here are the numbers I get, on my
laptop:

   nt cache:  35537 msec
    neither: 844933 msec
 Jay's idea: 875306 msec

And with both on, I see a similar, minor slowdown (as compared to the
version with the nt cache).

The main difference seems to be that I'm getting about 6 "hits" per
test case on the nt-match structs (that is, I avoid work by finding an
nt-match struct) and I'm getting about 8,800 hits in the cache per
test case.
2012-01-02 10:08:29 -06:00
Robby Findler
424a535cf4 first attempt at Jay's optimization for redex
(only did enough to get the r6rs tests running)
2012-01-02 10:08:28 -06:00
Robby Findler
4c86e2fe86 redex: memoize only the non-terminal patterns
remarkably, this seems to cut the time for running
the r6rs test suite in about 1/2
2011-12-29 11:01:21 -06:00
Robby Findler
57f51cf5c8 redex: use predicate/c instead of (-> any/c boolean?)
and a few other, minor changes
2011-12-29 10:58:26 -06:00
Robby Findler
d6ce2b61bc redex: inline lookup-binding 2011-12-29 10:32:02 -06:00
Robby Findler
9bcb86eb0c redex: minor cleanup 2011-12-29 10:15:52 -06:00
Robby Findler
5b2d378a77 fixed a bug in recent Redex internal pattern rewrite
(discovered by the random testing done for the racket machine model)
2011-12-28 23:52:56 -06:00
Robby Findler
f1bacffbdc Adjusted rewrite-side-condition/check-errs so that it normalizes the internal
redex patterns a bunch:

- repeats are turned into wrappers in sequences,
- names are all explicit,
- non-terminals are wrapped with `nt',
- cross patterns always have the hyphens in them.
- ellipses names are normalized (so there are no "hidden"
  name equalities); this also means that repeat patterns
  can have both a regular name and a mismatch name

Also, added a match-a-pattern helper macro that checks to make sure
that functions that process patterns don't miss any cases
2011-12-28 09:46:43 -06:00
Robby Findler
a88d9ca116 missed a place to add an undatum 2011-12-15 08:44:39 -06:00
Robby Findler
c91d004729 more cleanup of the rendering for the case when (format "~s" x)
and (format "~a" x) are different (when 'x' is a symbol)
2011-12-15 08:44:39 -06:00
Matthew Flatt
25dd8727cb add datum-case', etc. as syntax/datum'
This library is used by Redex, which wants a `syntax'-like template
language, but for datum values instead of syntax objects. Using
`datum-case' and `datum' generates much less code. Redex uses
only a small part of the general functionality, so adding
`syntax/datum' could be overkill. It's implemented by generalizing
the `syntax-case' and `syntax' pattern matching and template
constructing code, though; it's not a lot of extra code, and it's
easiest to generalize completely. We may find other uses for
datum templates, too.
2011-12-12 08:13:20 -07:00
Robby Findler
622bec0719 avoid (format "~s" x) in favor of (symbol->string x) for symbols
when doing typesetting stuff in Redex, as the former seems to have
some kind of context dependency that makes it insert ||s around
some upper-case symbols sometimes
2011-12-10 02:55:47 -06:00
Robby Findler
f8cbe1ad23 add the List Machine benchmark by Appel, Dockins, and Leroy 2011-12-10 01:34:58 -06:00
Robby Findler
e55ed2dc25 improve syntax error reporting for judgment-holds in reduction relations (and
probably elsewhere)
2011-12-08 20:35:46 -06:00
Robby Findler
447bd44a0c minor rackety 2011-12-05 01:14:54 -06:00
Robby Findler
f725066bf9 fix bug in the handling of side-conditions 2011-12-05 01:14:54 -06:00
Robby Findler
ce7523f01f more atoms can be shared now, so wrap 'em up 2011-12-02 16:38:56 -06:00
Robby Findler
458e2c2282 some long overdue Rackety: renaming the 'scheme:' exports of the framework to 'racket:' 2011-11-30 06:45:50 -06:00
Robby Findler
9db206b231 add in keymap mixin 2011-11-29 18:43:37 -06:00
Robby Findler
e788c6f49e adjust define-judgment-form so that it
a) avoids creating big intermediate lists of the same things over and over
   (this closes PR 12380)
b) generates less code (by generating calls to local functions)
c) normalizes its output (sorts by the printed representation)
2011-11-20 22:50:07 -06:00
Robby Findler
0a75219438 added support for where & side-condition & judgment-holds to define-relation
closes PR 12382
2011-11-20 21:34:22 -06:00
Robby Findler
b93486ed69 compile the left-hand sides of define-judgment only once, not during each time we try to check a judgment
related to PR 12380
2011-11-17 20:55:05 -06:00
Robby Findler
755dc28e55 Fixes define-relation's handling of ellipses across clauses
closes PR 12378
2011-11-17 17:00:11 -06:00
Robby Findler
3379fb8df6 fix some redex bugs caught by drdr tests 2011-11-09 06:47:38 -06:00
Robby Findler
0ce6c75591 Rackety (mostly letrec-values => define and minimizing dependencies) 2011-10-31 09:14:34 -05:00
Robby Findler
64dfdb3c7f Change the expansion of reduction-relation so that it generates less code
(by expanding into a call to a 30 or so line procedure, instead of putting
that code directly into the result of the macro).

This produces about a 6x speedup on this reduction-relation

  (reduction-relation L (--> 0 1) (--> 1 2) ... (--> 99 100))

where L is

  (define-language L)

The time it takes to run "racket r6rs.rkt" in the shell from the
directory collects/redex/examples/r6rs speeds up by about 10% (15%
with errortrace enabled), in the case where all .zo files are built,
except the ones in the r6rs directory. (Also worth noting that "racket
-l redex" takes more than 50% of that time.) And the change has no
noticeable effect on the time it takes to run r6rs-test.rkt.
2011-10-31 08:53:09 -05:00
Robby Findler
41f68af64a delay the construction of the compatible-closure grammar (the 'cross' thing)
until it is actually used. (This can make a big difference for large grammars
in models that don't actually use the compatible closure stuff.)
2011-10-30 22:36:53 -05:00
Robby Findler
9d371153fd add the #:stop-when argument to apply-reduction-relation* 2011-10-23 12:10:56 -05:00
Casey Klein
57a8ed5c79 Fixes matching of prefab struct literals
Fixes PR 12298
2011-10-17 19:37:16 -05:00
Robby Findler
9ab6a93127 fix the error check
closes PR 12290
2011-10-15 14:00:16 -05:00
Robby Findler
db2e13a09b add a "Step Until Choice" option into the redex stepper 2011-10-14 13:37:12 -05:00
Robby Findler
a43973157b add call to 'test-results' 2011-10-12 20:46:20 -05:00
Ryan Culpepper
7cc1476170 syntax/parse: fix bug: integrated stxclass might not bind pvar to syntax 2011-09-21 16:58:52 -06:00
Casey Klein
83451fea98 Add evaluation contexts for by-need letrec calculus as an example 2011-09-19 12:20:45 -05:00
Eli Barzilay
16cd1ad78d Make `defproc' throw an error if two arguments have the same name.
Related to the already fixed PR 12114 and PR 12133, which motivated the
error, and a few additional typos of the same kind.

(Note that it uses the symbols, but that's how they'll render anyway.)
2011-09-16 11:14:18 -04:00
Casey Klein
9944e6b3f6 Adds missing test image 2011-09-08 10:43:23 -05:00
Casey Klein
634f5c9e0c Removes now outdated comment 2011-09-08 09:11:52 -05:00
Casey Klein
97e792200f Gives a function a better name 2011-09-08 09:11:52 -05:00
Casey Klein
6d43376f9c Adds support for `judgment-holds' clauses in metafunctions 2011-09-08 09:11:52 -05:00
Casey Klein
ac7856a377 Moves metafunction construction to later expansion step 2011-09-08 09:11:51 -05:00
Casey Klein
2b4f604776 Replaces use of `define-syntax-set' 2011-09-08 09:11:51 -05:00
Casey Klein
145828527f Fixes handling of pattern variables that look like metafunctions 2011-08-31 11:20:02 -05:00
Casey Klein
ecdd50da09 Tests defined-checks directly 2011-08-30 15:10:50 -05:00
Casey Klein
c25c0b2868 Deletes duplicate tests 2011-08-30 15:10:50 -05:00
Casey Klein
c0625dc30c Adds define-term form 2011-08-30 15:10:50 -05:00
Eli Barzilay
1db5ad97f8 Fix another bunch of "language" typos. 2011-08-26 05:26:46 -04:00
Casey Klein
2eced78000 Fixes indentation 2011-08-17 11:59:43 -05:00
Casey Klein
cee4566ed4 Makes test work when compilation strips source locations 2011-08-16 19:18:18 -05:00
Casey Klein
e485e9f348 Tests define-judgment-form and metafunction renaming
Closes PR 11469
2011-08-16 14:32:34 -05:00
Casey Klein
9e2e11e9c4 Tests metafunction Check Syntax arrows 2011-08-16 14:32:33 -05:00
Casey Klein
efa04066c6 Tests define-judgment-form's Check Syntax interaction 2011-08-16 14:32:33 -05:00
Casey Klein
a0f2db7574 Drops `traces' call to make the file DrDr-friendly 2011-08-15 12:46:14 -05:00
Casey Klein
98eaaebc65 Improves error messages for Redex definition forms 2011-08-15 12:46:14 -05:00
Eli Barzilay
d61eb53686 Lots of documentation formatting.
Started as fixing misindented definitions, then more indentations, then
a bunch of similar things (square brackets, huge spaces at end-of-lines,
etc).
2011-08-15 07:50:04 -04:00
Casey Klein
cd1281fa65 Changes example from arithmetic to pairs 2011-08-12 04:33:38 -05:00
Casey Klein
66be55215a Fixes Redex doc's links to examples 2011-08-10 15:20:13 -05:00
Casey Klein
4d1651645a Improves error message for premise typos 2011-08-10 12:24:02 -05:00
Casey Klein
a2dc2d9540 Fixes arity checks outside define-judgment-form 2011-08-10 12:24:02 -05:00
Casey Klein
d66c48ecf7 Updates STLC example to use define-judgment-form 2011-08-10 12:24:01 -05:00
Casey Klein
87f3541979 Adds support for ellipsis-repeated premises 2011-08-10 12:24:01 -05:00
Casey Klein
f803f187bd Adds bigger define-judgment-form examples 2011-08-10 12:24:01 -05:00
Casey Klein
31ec46170d Adds STLC example to README 2011-08-10 12:24:01 -05:00
Casey Klein
88cd7cd303 Adds with-compound-rewriters typesetting form 2011-08-10 12:24:00 -05:00
Casey Klein
29ffea3b76 Uses examples' in explanation of judgment form where' clauses 2011-08-10 12:24:00 -05:00
Casey Klein
d2a58bc05f Restores the explanation of define-relation contracts. 2011-08-10 12:24:00 -05:00
Casey Klein
52c50dd67e Adds an alternative syntax for define-judgment-form rules
The conclusion may come last instead of first when a sequence of
dashes precedes it.
2011-08-10 12:24:00 -05:00
Casey Klein
dbfbf59256 Changes syntax for define-judgment-form mode and contract specs 2011-08-10 12:23:59 -05:00
Casey Klein
d58a743b89 Fixes define-judgment-form at the top-level with errortrace enabled 2011-08-10 12:23:59 -05:00
Casey Klein
576272362b Adds define-judgment-form form 2011-08-05 07:19:23 -05:00
Casey Klein
8887ea2ef3 Refactors meta-function implementation further 2011-08-05 07:19:22 -05:00
Casey Klein
6e38233286 Deletes dead code 2011-08-05 07:19:22 -05:00
Casey Klein
7898018cad Factors out name-consistency check 2011-08-05 07:19:22 -05:00
Casey Klein
24dc005ff4 Removes special case for typesetting recursive calls
This case doesn't appear necessary, since LWs are constructed in an
expansion step that occurs after all of the meta-function names
(including the current one) are bound.
2011-08-05 07:19:21 -05:00
Casey Klein
c1198d0687 Makes tests executable from outside their directory 2011-08-05 07:19:21 -05:00
Casey Klein
3dc677d270 Factors out parsing of relation contracts 2011-08-05 07:19:21 -05:00
Casey Klein
c9c2bb8ad7 Refactors construction of meta-function and relation lws 2011-08-05 07:19:20 -05:00
Casey Klein
6ff5dc779b Fixes keyword tests 2011-07-16 18:19:22 -05:00
Eli Barzilay
3157955d40 ".ss" -> ".rkt" scan done. 2011-07-02 10:37:53 -04:00
Ryan Culpepper
1b702a2ae3 docs reorganization
added tutorial, racket categories
  relabeled some other categories
  normalized manual names: de-bolded, changed some names
2011-07-01 17:16:53 -06:00
Eli Barzilay
78dacef817 Get rid of "defaultly"s. 2011-06-28 02:11:24 -04:00
Eli Barzilay
40124a0619 A long overdue scan to eliminate files without terminating newlines.
(DrRacket should really do that.)
2011-06-28 02:01:41 -04:00
Eli Barzilay
ac26fe7554 A ton of @scheme*' -> @racket*' and related updates.
Also, updates some of the mzlib files to point at `racket/*' libraries
rather than to `scheme/*' ones.
2011-06-25 04:08:47 -04:00
Robby Findler
78006b5720 redex: adjust the 'horizontal rule-pict-style so that it doesn't add space after the last rule
extend render-reduction-relation-rules so you can specify rule indicies instead of just
         the names of the rules
2011-06-21 06:32:51 +08:00
Robby Findler
58b60a6a87 fixed lw-test.rkt test suite 2011-06-15 09:25:50 +08:00
Robby Findler
b43e956c7b Redex: added to-lw/stx
plus improved the redex docs slightly and Rackety
2011-05-30 21:33:55 -05:00
Robby Findler
d74810a08b fix broken earlier commit 2011-05-25 14:57:04 -05:00
Robby Findler
33e68022db make the two-argument version of redex-match use the right name for the procedure it returns 2011-05-25 12:45:06 -05:00
Casey Klein
e8e2898359 Fixes rendering of relations with `name' patterns 2011-05-24 11:58:54 -05:00
Robby Findler
040bd371b6 adjust the lw construction in Redex so that it uses the width of the
"canonical" way to write symbols, instead of the way they are displayed.
This makes a difference for symbols that have spaces in them or symbols
that, when displayed, look like numbers or other non-symbol things.
2011-05-20 21:52:09 -05:00
Robby Findler
c163e75023 make the generated name used for languages (introduced by define-language
and define-extended-language) be based on the name of the language so the
error message is better (but not as good as it should be)
2011-05-11 18:38:10 -05:00
Casey Klein
cafcb47549 Refactored reduction-relation-procs 2011-05-08 06:19:45 -05:00
Casey Klein
dd58b457a9 Fixes domain checking of unioned reduction relations 2011-05-08 05:04:16 -05:00
Robby Findler
33c848fcda added current-cache-all?, a parameter that controls the caching strategy
that apply-reduction-relation* (and thus test-->>) uses
also make apply-reduction-relation* call remove-duplicates
  on the result of apply-reduction-relation
2011-05-07 20:06:38 -05:00
Robby Findler
507b1cd8fd moved the docs-complete library into rackunit
to avoid having a separate, new manual for the
  one library
2011-05-05 16:10:42 -05:00
Casey Klein
4b03ddccb1 Fixes Redex stepper's handling of symbols quoted with || 2011-05-04 10:34:01 -05:00
Casey Klein
3187cac716 Updates to lam's new toplevel-map field 2011-05-03 17:59:52 -05:00
Matthew Flatt
6f1aa7bc00 adjust Redex example after bytecode-structure change 2011-05-03 08:53:49 -06:00
Casey Klein
fd401ce98e Adds docs test to the test script 2011-05-02 06:02:50 -05:00
Casey Klein
b592017d05 Documents or deletes all Redex exports 2011-05-02 06:02:50 -05:00
Casey Klein
4e68a5019f Moved rewriters documentation into typesetting section 2011-05-02 06:02:49 -05:00
Casey Klein
775d31d04a Sets up the right modpaths for Redex exports 2011-05-02 06:02:49 -05:00
Robby Findler
37c7ad81ed fixed redex.scrbl bugs 2011-04-29 08:12:51 -05:00
Robby Findler
8fbefb0b6d added typesetting support for relations 2011-04-28 22:20:14 -05:00
Robby Findler
499852087d stlc bug fix 2011-04-28 14:51:29 -05:00
Casey Klein
1d1cdd03f5 Adds a form like term-let but using Redex patterns 2011-04-26 12:13:17 -05:00
Casey Klein
b3f45d3c84 Refactors to eliminate copied code 2011-04-26 12:13:17 -05:00
Robby Findler
e7d0029aea added lots of new tests that our documentation is complete 2011-04-25 13:24:43 -05:00
Casey Klein
50f14dea18 Adds start term to test-->>E failure message
Closes PR 11867
2011-04-22 09:49:41 -05:00
Casey Klein
73c5d2a546 Fixes typo in redex-check docs
Closes PR 11868
2011-04-22 09:49:41 -05:00
Casey Klein
1c8c6ddbee Adds generate-term option for LHS-based generation 2011-04-22 04:43:11 -05:00
Casey Klein
362a6d75a5 Changes redex-match to suppress ..._x bindings 2011-04-22 04:43:11 -05:00
Casey Klein
24d697e83c Fixes bug in STLC example 2011-04-22 04:43:11 -05:00
Casey Klein
7319bd1884 Fixes test-->>E documentation 2011-04-15 04:57:01 -05:00
Casey Klein
0b9db752ca Fixes test-->>E failure message
Fixes PR 11853
2011-04-15 04:52:13 -05:00
Casey Klein
46b3a9d13d Fixes generation of any' within in-hole' context position 2011-04-14 18:32:06 -05:00
Casey Klein
319ae5f825 Deletes code that should have been deleted when named holes went away 2011-04-14 18:32:05 -05:00
Casey Klein
ff7aba9750 Moves `term-let' test to proper file 2011-04-14 18:32:05 -05:00
Casey Klein
989103c3a1 Improves term-let's "too few ellipses" error
Fixes PR 10837
2011-04-07 13:17:15 -05:00
Casey Klein
143e1e66fd Improves error for references to not-yet-defined metafunctions
Fixes PR 11041
2011-04-07 13:17:15 -05:00
Ryan Culpepper
73ab167522 created racket/syntax from parts of unstable/syntax 2011-04-07 09:47:20 -06:00
Casey Klein
6fc20125b0 Adds the STLC example to the test script 2011-04-06 11:11:43 -05:00
Casey Klein
1ad2b1b938 Makes cross' work better with hide-hole'
Fixes PR 11579
2011-04-06 10:17:15 -05:00
Casey Klein
e8130a2fd1 Fixes bug in `cross' pattern handling 2011-04-06 10:17:15 -05:00
Robby Findler
77c25430af added an example with a type checker 2011-04-02 13:36:29 -05:00
Casey Klein
a4644d4d49 Disallows unquote in Redex patterns
Fixes PR 11296
2011-04-01 14:00:45 -05:00
Casey Klein
121f1761bd Fixes redex/gui typos
Closes PR 11174
2011-04-01 14:00:45 -05:00
Casey Klein
8a283650c4 Updates typesetting tests
Spacing is now different by a few pixels. The change does not seem to
be Redex specific
2011-03-30 13:59:39 -05:00
Casey Klein
1312a2e52e Improves `reduction-relation' documentation
Fixes PR 10665
2011-03-30 13:59:39 -05:00
Casey Klein
6cdfa2ff73 Updates typesetting tests for new arrow drawing 2011-03-30 10:20:53 -05:00
Casey Klein
d97a2b505c Fixes matching of ..._x and ..._!_x inside ellipses 2011-03-30 10:15:17 -05:00
Casey Klein
0839f763ec Fixes a bug in the deref rule 2011-03-29 16:05:54 -05:00
Casey Klein
8f006f1a1f Fixes bugs in error transitions 2011-03-29 15:57:50 -05:00
Casey Klein
b958e21f46 Fixes another bug in the stepper's diff highlighting 2011-03-29 13:05:03 -05:00
Casey Klein
df3bc8980b Fixes a bug in the stepper's diff highlighting 2011-03-29 13:05:02 -05:00