Commit graph

138 commits

Author SHA1 Message Date
David Majda 7d1261c0fc Regenerate lib/metagrammar.js (forgot to do it in previous commit) 2010-05-07 17:45:25 +02:00
David Majda cc7f1d96eb Avoid |call| when calling actions with one parameter.
This speeds up the benchmark suite execution by 0.18%, which may just be a
measurement error. (Standrad statistic tests would tell more, but I don't want
to mess with them now.) The code is little bit nicer this way though.

Going further and avoiding |apply| seems to slow thigs down a bit, possibly
because multiple array accesses. I may try improved version without array
accesses (where Action passes the Sequence variable names to save the results
into) sometime later.

Detailed results (benchmark suite totals):

---------------------------------
 Test #     Before       After
---------------------------------
      1   29.08 kB/s   28.91 kB/s
      2   28.72 kB/s   28.75 kB/s
      3   28.78 kB/s   28.88 kB/s
      4   28.57 kB/s   28.90 kB/s
      5   28.84 kB/s   28.81 kB/s
---------------------------------
Average   28.80 kB/s   28.85 kB/s
---------------------------------

Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.9 Safari/533.2
2010-04-25 16:50:44 +02:00
David Majda e3aa4df090 Changed action parameter processing to avoid the arguments object.
The action now computes the number of passed parameters during the code
generation and the parameters are declared directly as $1, $2, etc. in the
generated function.

This does not speed up the benchmark suite execution statistically significantly
on V8.

Detailed results (benchmark suite totals):

---------------------------------
 Test #     Before       After
---------------------------------
      1   28.68 kB/s   29.08 kB/s
      2   28.77 kB/s   28.72 kB/s
      3   28.89 kB/s   28.78 kB/s
      4   28.84 kB/s   28.57 kB/s
      5   28.86 kB/s   28.84 kB/s
---------------------------------
Average   28.81 kB/s   28.80 kB/s
---------------------------------

Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.9 Safari/533.2
2010-04-24 14:35:05 +02:00
David Majda a1dcd245bb Action AST node no longer accepts functions as actions (only strings). 2010-04-21 21:26:45 +02:00
David Majda b2f230fad2 Added Optional AST node.
This does not speed up the benchmark suite execution statistically significantly
on V8.

Detailed results (benchmark suite totals):

---------------------------------
 Test #     Before       After
---------------------------------
      1   28.84 kB/s   28.75 kB/s
      2   28.76 kB/s   28.69 kB/s
      3   28.72 kB/s   28.69 kB/s
      4   28.84 kB/s   28.93 kB/s
      5   28.82 kB/s   28.70 kB/s
---------------------------------
Average   28.80 kB/s   28.75 kB/s
---------------------------------

Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/533.2 (KHTML, like Gecko)
Chrome/5.0.342.9 Safari/533.2
2010-04-21 21:19:48 +02:00
David Majda e5df8284b5 Added AndPredicate AST node.
This does not speed up the benchmark suite execution statistically significantly
on V8.

Detailed results (benchmark suite totals):

---------------------------------
 Test #     Before       After
---------------------------------
      1   28.72 kB/s   28.84 kB/s
      2   28.84 kB/s   28.76 kB/s
      3   28.83 kB/s   28.72 kB/s
      4   28.81 kB/s   28.84 kB/s
      5   28.76 kB/s   28.82 kB/s
---------------------------------
Average   28.79 kB/s   28.80 kB/s
---------------------------------

Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.9 Safari/533.2
2010-04-21 12:02:45 +02:00
David Majda c3c1c79665 Added OneOrMore AST node.
This speeds up the benchmark suite execution by 1.08% on V8.

Detailed results (benchmark suite totals):

---------------------------------
 Test #     Before       After
---------------------------------
      1   28.38 kB/s   28.72 kB/s
      2   28.52 kB/s   28.84 kB/s
      3   28.41 kB/s   28.83 kB/s
      4   28.47 kB/s   28.81 kB/s
      5   28.64 kB/s   28.76 kB/s
---------------------------------
Average   28.48 kB/s   28.79 kB/s
---------------------------------

Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.9 Safari/533.2
2010-04-20 21:09:23 +02:00
David Majda 8f59e21c8d Renamed an iterator variable: "key" -> "rule". 2010-04-19 20:45:27 +02:00
David Majda 3f5cb8850c Fixed PEG.buildParser's documentation and added a test. 2010-04-19 20:43:03 +02:00
David Majda 48da65d08e PEG.buildParser now accepts grammars only in string format. 2010-04-19 20:39:59 +02:00
David Majda 927f2d65c9 Exception tests also test exception messages. 2010-04-19 20:18:15 +02:00
David Majda b5ac4f0c4a Refactored helpers for testing of thrown exceptions. 2010-04-19 20:07:48 +02:00
David Majda de7536fd94 Added notes about ECMA-262, 5th ed. compatibility to the JSON example grammar. 2010-04-19 20:00:22 +02:00
David Majda a86e06a216 Add "Generated by ..." message to the generated parsers. 2010-04-19 19:54:28 +02:00
David Majda f37ca3fcdb Updated version to 0.4 2010-04-17 12:31:38 +02:00
David Majda 870144b439 Added CHANGELOG. 2010-04-17 12:29:49 +02:00
David Majda 7214de6dc8 README.md: Removed unnecessary "id" attribute from the example. 2010-04-17 11:54:47 +02:00
David Majda db4cc71f2c README.md: Fixed formatting. 2010-04-17 11:52:36 +02:00
David Majda 7822379c70 Rewrote the "Usage" section. 2010-04-17 11:49:18 +02:00
David Majda c9a5e283e7 README.md: Renamed the "Requirements" section to "Compatibility" and moved it at the end. 2010-04-17 11:17:37 +02:00
David Majda 3752fe211a README.md: Added the "Features" section. 2010-04-17 11:15:49 +02:00
David Majda b4bf906cf8 Modified README.md to indicate that IE6+ is supported. 2010-04-16 20:28:24 +02:00
David Majda 09291d6f0f Use "charAt(...)" instead of "[...]" for accessing string characters (compatibility with IE < 8). 2010-04-16 11:06:29 +02:00
David Majda 28459236aa Removed trailing comma that caused error in IE. 2010-04-16 09:26:51 +02:00
David Majda 4b51e6a6d3 Quote null characters in regexps, IE does not like them. 2010-04-16 08:53:02 +02:00
David Majda 7fc491412d Work around the fact that IE does not recognize "\v" in strings. 2010-04-14 21:29:05 +02:00
David Majda 6abda95a99 Made regexps generated for empty character classes ("[]" and "[^]") work in IE. 2010-04-14 21:08:35 +02:00
David Majda e79e869993 Compensate for IE's lack of Array.prototype.indexOf function. 2010-04-14 21:00:09 +02:00
David Majda 05381fedfa Fixed the inverted empty character class handling test. 2010-04-14 20:59:41 +02:00
David Majda e63f64a3d5 Make the generated parsers standalone (no runtime is required).
This and also speeds up the benchmark suite execution by 7.83 % on V8.

Detailed results (benchmark suite totals):

---------------------------------
 Test #     Before       After
---------------------------------
      1   26.17 kB/s   28.16 kB/s
      2   26.05 kB/s   28.16 kB/s
      3   25.99 kB/s   28.10 kB/s
      4   26.13 kB/s   28.11 kB/s
      5   26.14 kB/s   28.07 kB/s
---------------------------------
Average   26.10 kB/s   28.14 kB/s
---------------------------------

Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.7 Safari/533.2
2010-04-12 19:06:04 +02:00
David Majda 3f85a9ca84 Regenerated the metaparser with one-level rule cache. 2010-04-11 17:02:53 +02:00
David Majda 24d38f74b9 Replaced two-level rule cache with a one-level one.
This leads to simpler code and also speeds up the benchmark suite execution by
5,89 % on V8.

Detailed results (benchmark suite totals):

---------------------------------
 Test #     Before       After
---------------------------------
      1   24,70 kB/s   26,14 kB/s
      2   24,49 kB/s   26,05 kB/s
      3   24,67 kB/s   25,99 kB/s
      4   24,65 kB/s   26,13 kB/s
      5   24,71 kB/s   26,14 kB/s
---------------------------------
Average   24,64 kB/s   26.10 kB/s
---------------------------------

Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.7 Safari/533.2
2010-04-11 16:46:45 +02:00
David Majda 74830d4f8f Sort expected strings in the error messages. 2010-04-11 15:34:30 +02:00
David Majda 37521cffa5 Error messages now do not contain duplicities. 2010-04-11 15:30:02 +02:00
David Majda 714512f232 Implemented generic AST node extension mechanism. 2010-04-11 14:48:52 +02:00
David Majda 1aa3d8e07e Implemented a nop (no operation) function and used it on few places. 2010-04-11 14:16:38 +02:00
David Majda 6a194e8f68 Added example JavaScript parser. 2010-04-11 13:18:23 +02:00
David Majda 16f238a64d Fixed comment heading. 2010-04-11 12:41:25 +02:00
David Majda 3291c70d97 Added \uFEFF (BOM) to the definition of whitespace in the metagrammar.
The Rhino bug that prevented inclusion of \uFEFF among the whitespace characters
is no longer relevant here because we compile character classes into regexps
now, which avoids the infinite recursion.
2010-04-11 11:45:05 +02:00
David Majda 383c5acaa6 Replaced \xA0 by \u00A0 in the whitespace definition in the metagrammar.
This is purely stylistic change.
2010-04-11 11:18:42 +02:00
David Majda db616f0b77 Made the "version" variable scope smaller. 2010-04-11 11:15:40 +02:00
David Majda c5cc545209 "rake metaparser" and "rake minify" now always generate the target files.
Until now, these tasks looked at the file times and generated the target files
only when they were older than the source files. This caused problems when I
mainupulated the lib/metagrammar.* files by hand sometimes, replaced them from
backups after screw-ups, etc.
2010-04-11 11:05:44 +02:00
David Majda 51232fd652 I don't like the .txt extension after all :-) 2010-04-11 10:59:13 +02:00
David Majda 9488291ac0 Converted README to GitHub Flavored Markdown.
Also added ".txt" extension to VERSION and LICENSE for more consistency.
2010-04-09 18:29:43 +02:00
David Majda 85bd98d846 Replaced .hgignore with .gitignore. 2010-04-09 17:30:32 +02:00
David Majda cfd46b622a Added a benchmark suite. 2010-03-29 20:18:54 +02:00
David Majda 751a33715d Added example CSS parser. 2010-03-29 12:44:32 +02:00
David Majda a1adbf0607 Added example JSON parser. 2010-03-22 12:18:58 +01:00
David Majda 20e230ca0e Killed *MatchFailure classes => simpler code. 2010-03-21 15:48:28 +01:00
David Majda f87bcd6332 Added tests for error messages displayed when a character class match fails. 2010-03-21 15:24:03 +01:00