Commit Graph

76 Commits (7a408dcf5510891eaf70efa4def882bbed2655bd)

Author SHA1 Message Date
Doug Coleman f706b50ac7 remove dipd, it's 2dip 2008-05-23 22:48:58 -05:00
Slava Pestov 26aa656123 with-locals no longer necessary 2008-05-07 08:48:51 -05:00
Chris Double e1f82caf83 Use accessors in places for peg 2008-04-29 14:19:14 +12:00
Chris Double c671ccce99 { ... } whitespace grouping 2008-04-29 14:15:05 +12:00
Chris Double 7319dd5165 Add ~ grouping operator to ignore whitespace between elements in group 2008-04-29 12:37:26 +12:00
Doug Coleman b7c1f9dbe8 extra changes:
index* -> index-from
last-index* -> last-index-from
1 tail -> rest
1 tail-slice -> rest-slice
subset -> filter
prepose
find* -> find-from
find-last* -> find-last-from
before, after generic, < for integers
make between? work for timestamps
2008-04-25 23:17:08 -05:00
Chris Double 9f0f2d0bbc peg delay parsers now infer 2008-04-14 22:42:45 +12:00
Chris Double a641c6d332 Add \r to ebnf escape rules 2008-04-07 14:39:18 +12:00
Chris Double 719376e412 Remove w-c-u from ebnf transform 2008-04-07 13:17:09 +12:00
Chris Double 970f0055c2 Fix failing ebnf unit test 2008-04-03 17:33:37 +13:00
Chris Double cc7d945a80 Change ebnf variables to not use namespaces 2008-04-03 17:28:09 +13:00
Chris Double 27f2992dc5 Add failing ebnf test 2008-04-03 16:09:03 +13:00
Chris Double eac450bdcf Add ebnf rule word 2008-04-02 15:55:18 +13:00
Chris Double bbcc84862f Tweak ast from sequences in ebnf 2008-04-02 15:47:21 +13:00
Chris Double 6b454eed36 Various peg/ebnf fixes
- Box parsers were broken when involved in left recursion detection
- ebnf no longer implicitly ignores white space between terminates/non-terminals
- ebnf now handles \t and \n in grammars so productions to detect white space work
- reset-delegates is now reset-pegs
2008-04-02 12:59:12 +13:00
Chris Double 122fd50d4a Throw error when ebnf uses a non-existant non-terminal 2008-04-01 14:49:20 +13:00
Chris Double 72bfd57f30 Make ebnf forgiving of whitespace at end of expression 2008-04-01 11:28:14 +13:00
Chris Double f66774e875 Add tests for semantic and add syntax for it to ebnf
Syntax is ?[ ...]?
For example:
[EBNF num=. ?[ number? ]? list=list:x num:y => [[ drop x y + ]] | num EBNF] { 1 2 3 4 5 6 } swap call .
2008-03-31 16:50:05 +13:00
Chris Double 729ac1d6dc Some ebnf tweaks and tests to do with variables 2008-03-31 14:59:22 +13:00
Chris Double ee2194d1dc Allow variable names on elements 2008-03-31 14:03:16 +13:00
Chris Double 55a69392fa First cut at variables in ebnf 2008-03-31 13:52:42 +13:00
Chris Double bb8198d3d0 Declare stack effects for compiled parsers 2008-03-30 23:24:02 +13:00
Chris Double 78633e03a0 Allow var names in ebnf but ignore them for now 2008-03-30 19:01:47 +13:00
Chris Double af9e27823a Add => action rule for an entire sequence 2008-03-30 17:17:31 +13:00
Chris Double 86653e7a46 Don't use 'delay' parser in ebnf 2008-03-29 17:42:21 +13:00
Chris Double 0db0d9cd44 Move towards having ebnf infer 2008-03-29 16:24:13 +13:00
Chris Double 7bf27a5eb2 EBNF test using Java Primary production 2008-03-29 03:41:40 +13:00
Chris Double 25eea7ea1b Fix ebnf tests for left recursion 2008-03-29 02:51:49 +13:00
Chris Double 010ce80076 Handle left recursion by failing again 2008-03-29 00:49:39 +13:00
Chris Double cca4700e49 Fix ebnf for peg changes 2008-03-29 00:41:41 +13:00
Chris Double fa8b311b27 Add packrat-parse, etc 2008-03-28 00:04:08 +13:00
Chris Double f6b7f8197e Add tests for left recusion in pegs 2008-03-27 23:54:34 +13:00
Chris Double 1ec945ba4c Use new slots in peg.ebnf 2008-03-26 16:16:23 +13:00
Chris Double d1e0aa6e80 Get peg subvocabs working again 2008-03-22 00:58:53 +13:00
Chris Double d1e7ede35d Add support for & syntax in ebnf 2008-03-20 17:25:27 +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 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 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 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