Commit Graph

301 Commits (05c5a353787ad9901e8471d355cb25332c9c5c9e)

Author SHA1 Message Date
Chris Double 943b02ab2f Fix performance regression in pegs
delay parser is improved to use a memoized quotation so the
construction and compilation of the parser at runtime only
occurs once.
Changed compile so it would use equality rather than identity
for memoization purposes.
2008-03-22 01:59:16 +13:00
Chris Double d1e0aa6e80 Get peg subvocabs working again 2008-03-22 00:58:53 +13:00
Chris Double a14854520d Compile pegs down to words 2008-03-21 03:05:21 +13:00
Chris Double 1c6882b32c Rip out packrat stuff
It was broken since the transition to generating compiled quotations. As far as I know, no one was using packrat-parse anyway.
Rework in progress...
2008-03-21 01:26:20 +13:00
Chris Double d1e7ede35d Add support for & syntax in ebnf 2008-03-20 17:25:27 +13:00
Chris Double dbd0583044 Tidy up expr groups 2008-03-20 17:19:41 +13:00
Chris Double 8ade4f9b5b Fix vocab name in expr tests 2008-03-20 17:16:50 +13:00
Chris Double 44954753bd Change <EBNF .. EBNF> to [EBNF .. EBNF] 2008-03-20 17:13:27 +13:00
Chris Double e7980ebc61 More refactoring of EBNF
<EBNF .. EBNF> now produces a quotation that when called does the parsing
EBNF: foo ... ;EBNF creates a 'foo' word with stack effect (string -- result)
when called it parses the string and returns the result.
2008-03-20 17:11:09 +13:00
Chris Double 7dc772db26 Refactor ebnf parser generation 2008-03-20 16:05:10 +13:00
Chris Double c1f69f01be Change ordering of [[ ... ]] 2008-03-20 14:57:12 +13:00
Chris Double 39c228db6d Update peg.pl0 to use range pattern syntax
This allows removing the words for ident and number, replacing them
with EBNF expressions.
2008-03-20 14:22:14 +13:00
Chris Double 68388fbed9 Updated peg.expr to use range-pattern for digits 2008-03-20 14:15:06 +13:00
Chris Double ec4f964e4f Fix pl0 for EBNF syntax changes 2008-03-20 14:06:21 +13:00
Chris Double 795ef0ae3b Add ranges to EBNF syntax
This works:
  <EBNF letter = [a-zA-Z] EBNF>
and
  <EBNF not-digit = [^0-9] EBNF>
2008-03-20 13:55:19 +13:00
Chris Double 264284d0c4 Add range-pattern parser 2008-03-20 13:40:22 +13:00
Chris Double 97b58580a7 Add expression evaluator example for EBNF 2008-03-20 03:30:53 +13:00
Chris Double 92d8140d87 Change ebnf-action to properly nest with attached parser
This allows removal of last-parser hack. Syntax of EBNF changes though.
Now an action must attach to a group:

  <EBNF foo = (a b c) [[ ...act on group... ]] EBNF>
2008-03-20 03:05:40 +13:00
Chris Double 65fabeec11 remove => action and replace it with [[ code ]] in EBNF
Previously the action had to be a factor word and could only appear at the end of a rule:

  : aword ( ast -- ast ) drop V{ 1 2 } ;
  <EBNF foo = "a" "b" => aword EBNF>

Now actions can appear anywhere after an element, and can be any factor code between [[ ... ]] delimiters:

  <EBNF foo = "a" "b" [[ drop V{ 1 2 } ]] EBNF>
  <EBNF foo = "a" [[ drop 1 ]] "b" [[ drop 2 ]] EBNF>

Unfortunately since this means the ebnf>quot code uses the equivalent of eval, it no longer compiles nicely since it can't be inferred. The generated parsers however do compile.
2008-03-20 02:16:30 +13:00
Chris Double c0b7bdf823 Add *, + and ? to list of non-allowed ebnf identifier characteres 2008-03-20 01:25:57 +13:00
Chris Double 82d54d3776 EBNF syntax change
[ ... ] is now ( ... )?
{ ... } is now ( ... )*
Added ( ... )+
2008-03-20 01:18:09 +13:00
Chris Double 64135b73e1 Add support for ensure-not and parsing any single character to EBNF
This allows, for example:
  foo = {!("_" | "-") .}

This will match zero or more of any character, except for _ or -
2008-03-19 19:15:52 +13:00
Chris Double 208c88c449 Update pl0 for ebnf changes, and add more tests 2008-03-19 18:35:45 +13:00
Chris Double eef6ae7827 Remove need for '.' to terminate rule lines in EBNF 2008-03-19 18:07:31 +13:00
Chris Double 9403d97e22 Add syntax-pack and grouped to ebnf refactoring 2008-03-19 17:52:22 +13:00
Chris Double 708d55fb8e Add syntax word for ebnf 2008-03-19 17:37:08 +13:00
Chris Double 7578538122 Minor tidyup of ebnf 2008-03-19 17:34:47 +13:00
Chris Double cc9a17b551 Use choice* and seq* in ebnf 2008-03-19 17:00:53 +13:00
Chris Double 4b37c9098e Use multiline for parsing EBNF string 2008-03-19 16:54:42 +13:00
Doug Coleman ef437c96da add 1token and docs 2008-03-12 10:43:18 -05:00
Slava Pestov 5af2be3798 More documentation fixes 2008-03-11 21:01:39 -05:00
Slava Pestov 32526206f1 Help fixes 2008-03-11 19:51:58 -05:00
dharmatech a336cb7570 Unit test fixes 2008-03-06 13:46:15 -06:00
Doug Coleman f84761ae0c fix docs for delay 2008-03-05 18:15:28 -06:00
Slava Pestov 47a96775d8 Add PEG: word 2008-03-03 16:57:30 -06:00
Slava Pestov 05a02ade7a Unix <process-stream> now compiles 2008-03-03 16:45:18 -06:00
Doug Coleman 6378d38d63 add missing usings 2008-03-03 14:32:37 -06:00
Doug Coleman 2f48327b47 move non-core peg parsers to peg.parsers
document and unit test peg.parsers
add just parser
2008-03-03 13:28:53 -06:00
Slava Pestov e98cd1fd59 New convention for unit tests 2008-03-01 17:00:45 -05:00
Doug Coleman 635b02ca27 implement list-of, list-of* in terms of (list-of)
add 2choice 3choice
2008-02-26 17:13:15 -06:00
Doug Coleman 11147c7bc0 add 2seq, 3seq 2008-02-26 15:17:17 -06:00
Slava Pestov d165f29b36 Merge git://double.co.nz/git/factor 2008-02-25 16:32:36 -06:00
Daniel Ehrenberg f6845d43d3 Massive name change in files, string streams 2008-02-15 22:20:31 -06:00
Chris Double 8542dc5812 Add seq* and choice* to peg 2008-02-14 10:39:37 +13:00
Slava Pestov 2541c62e29 Fix code for math.parser changes 2008-02-06 21:15:47 -06:00
Chris Double c977d4a7fd Merge git://factorcode.org/git/factor 2008-02-02 18:47:15 +13:00
Eduardo Cavazos bff385269c Lot's of USING: fixes for ascii or unicode 2008-02-01 18:26:32 -06:00
Slava Pestov af13a47485 Adding tags 2008-01-31 23:04:11 -06:00
Chris Double f272d54e49 Allow dashes in non-terminal names 2008-01-18 15:45:08 +13:00
Chris Double 2d79bdb09a Fix peg.search for recent factor changes 2008-01-17 11:08:13 +13:00
Chris Double 0f3160cc5d Merge commit 'chris/master' 2008-01-17 11:05:38 +13:00
Chris Double 240217f39e Fix peg issues with recent factor changes 2008-01-13 04:38:59 -05:00
Slava Pestov 8285eeda9a Fix conflict 2008-01-06 13:30:23 -04:00
Chris Double e7cf83a57a First attempt at compiling peg parsers to quotations 2007-12-21 13:16:14 +13:00
Chris Double b655d4c759 Add tags to peg, peg.ebnf and peg.pl0 2007-12-20 17:11:37 +13:00
Chris Double a376cb6cc3 Add summary, author and tags to peg.search 2007-12-20 17:10:45 +13:00
Chris Double 6a8bfad475 Rename peg.replace to peg.search 2007-12-20 17:09:12 +13:00
Chris Double 6bd283ffa3 Convert parser-combinators.replace to pegs 2007-12-20 17:06:21 +13:00
Chris Double d45ed669f8 Add digit, number and string parser to peg 2007-12-20 11:54:17 +13:00
Slava Pestov d7217801c3 Documentation fixes 2007-12-11 22:36:40 -05:00
Chris Double 38beaac720 Infinite left recursion now causes a failed parser rather than a call stack error 2007-11-30 00:01:03 +13:00
Chris Double 3003911e07 Make some parsers uses MEMO: 2007-11-29 23:49:34 +13:00
Chris Double 362f2d3436 Fix packrat caching issue 2007-11-29 23:42:46 +13:00
Chris Double b51e4f642e Fix broken ebnf actions 2007-11-29 17:41:58 +13:00
Chris Double a4461ae408 Tidy up ebnf compilation 2007-11-29 17:24:02 +13:00
Chris Double f94c280e06 Fix pl0 tests 2007-11-29 12:49:51 +13:00
Chris Double 89bbd21362 Add packrat caching to peg 2007-11-29 12:35:45 +13:00
Chris Double d3ac10aefc Redo PL/0 parser using ebnf 2007-11-28 16:07:23 +13:00
Chris Double e0adc1a7fa Add optional to ebnf 2007-11-28 15:49:14 +13:00
Chris Double d68a78c4a6 fix grouping of repeat0 in ebnf 2007-11-28 15:32:04 +13:00
Chris Double 3372ad8f68 Fix some peg breakage 2007-11-28 15:27:35 +13:00
Chris Double 0ef96c87d9 Add grouping operators for ebnf 2007-11-28 15:26:25 +13:00
Chris Double 15b1533f20 Fix precedence between choice/sequence in ebnf 2007-11-28 15:14:11 +13:00
Chris Double 28e9c0e6e0 Fix ebnf tests 2007-11-28 13:05:53 +13:00
Chris Double 35f96d1c85 Use words instead of quotations in ebnf actions 2007-11-28 13:03:16 +13:00
Chris Double e5e430be4f Remove ebnf debug 2007-11-28 12:52:05 +13:00
Chris Double c455336da6 Add action rule to ebnf 2007-11-28 12:50:04 +13:00
Chris Double 4f0c40c05a Change EBNF: to <EBNF ... EBNF> 2007-11-28 11:52:17 +13:00
Chris Double 88e93446b2 Add EBNF: word 2007-11-28 11:46:06 +13:00
Chris Double 7a414869de Support for repeat0 in ebnf 2007-11-28 11:33:21 +13:00
Chris Double 16a0cc9eb1 add ebnf>quot 2007-11-28 11:25:34 +13:00
Chris Double 38806885e6 Compile ebnf->factor 2007-11-28 11:07:17 +13:00
Chris Double ed359b6623 Syntax tree for ebnf 2007-11-28 10:45:21 +13:00
Chris Double 31d57422da Start of EBNF parser 2007-11-27 18:13:36 +13:00
Chris Double 9f2f45cd71 More peg.pl0 additions
This parser is currently really ugly. The goal is to tidy up peg
so this parser looks more like the EBNF.
2007-11-27 16:45:32 +13:00
Chris Double e49d84ce97 Add 'delay' parser to peg 2007-11-27 16:16:21 +13:00
Chris Double ea2d4ea261 Work on PL/0 Grammar as a PEG example 2007-11-27 15:56:26 +13:00
Chris Double 5fb6af754b Add hide combinator 2007-11-27 15:45:00 +13:00
Chris Double 055276ca25 Add 'sp' parser to skip whitespace 2007-11-27 15:36:26 +13:00
Chris Double e6b6bb8a5c Add satisfy parser in peg 2007-11-27 15:08:16 +13:00
Chris Double 1eed006a29 Add author information to peg 2007-11-27 12:36:14 +13:00
Chris Double 99b39e0351 Some help for pegs 2007-11-27 12:22:33 +13:00
Chris Double 6476eb765e remove parse-state from peg 2007-11-27 11:57:08 +13:00
Chris Double 167f2d716d add action parser 2007-11-22 11:19:16 +13:00
Chris Double 2a464ea2c6 add ensure-not parser 2007-11-22 11:19:16 +13:00
Chris Double 129f68d428 add ensure parser 2007-11-22 11:19:16 +13:00
Chris Double ffa71ef86f add optional parser 2007-11-22 11:19:16 +13:00
Chris Double e9df13dad5 remove match from parse results 2007-11-22 11:19:16 +13:00
Chris Double 691c62501f add repeat0 and repeat1 2007-11-22 11:19:16 +13:00
Chris Double 2d3fe08403 Add choice parser 2007-11-22 11:19:15 +13:00
Chris Double aacf88a72d First cut at peg style packrat parser 2007-11-22 11:19:15 +13:00