Commit Graph

49 Commits (da8b6328de99d2968ac71b5a54b26d343b71c6ef)

Author SHA1 Message Date
Slava Pestov 4cb64aaeb8 Fixing unit tests for eval word being moved 2008-07-29 00:05:01 -05:00
Chris Double 3f68fb4618 Fix regression where multiply defined ebnf rules didn't result in an error 2008-07-15 15:42:13 +12:00
Chris Double f3145c5961 [EBNF and EBNF: now return ast 2008-07-10 13:56:06 +12:00
Chris Double 72bd6b4dc8 Fix peg tests 2008-07-10 13:56:06 +12:00
Chris Double 8aa7bc6d78 [EBNF ... EBNF] now does an implicit call 2008-07-10 13:56:06 +12:00
Chris Double acb6d3a312 Fix peg.ebnf tests. Handle \ in EBNF 2008-07-10 13:56:06 +12:00
Chris Double 6b83ab9d90 Fix terminal parser with non-default tokenizers 2008-06-21 01:49:07 +12:00
Chris Double eca8260799 peg.ebnf syntax for tokenizers 2008-06-21 00:28:13 +12:00
Chris Double 7239c4d79f Make replace-escapes infer and fix remaining unit test breakage in ebnf 2008-06-20 15:14:30 +12:00
Chris Double d22a24a90e Fix some failing ebnf unit tests 2008-06-20 14:13:50 +12:00
Chris Double 6bd761e460 Another breaking unit test for ebnf 2008-06-20 12:35:33 +12:00
Chris Double 91768f171c Rule 'x' defined more than once unit test 2008-06-20 11:53:07 +12:00
Chris Double 001e866b13 Add yet another failing ebnf unit test 2008-06-20 11:49:08 +12:00
Chris Double 179ea21c11 Add a couple of failing peg.ebnf tests 2008-06-19 01:10:44 +12:00
Chris Double fea65df1df Fix ebnf foreign call breakage and add tests 2008-06-18 23:07:26 +12:00
Chris Double 0841dbb4ad Fix ebnf unit test 2008-06-18 20:35:32 +12:00
Chris Double 1b8943a8e0 Add failing peg.ebnf tests 2008-06-18 20:35:31 +12: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
Chris Double 9f0f2d0bbc peg delay parsers now infer 2008-04-14 22:42:45 +12:00
Chris Double 27f2992dc5 Add failing ebnf test 2008-04-03 16:09:03 +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 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 af9e27823a Add => action rule for an entire sequence 2008-03-30 17:17:31 +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 f6b7f8197e Add tests for left recusion in pegs 2008-03-27 23:54:34 +13:00
Chris Double d1e0aa6e80 Get peg subvocabs working again 2008-03-22 00:58:53 +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 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 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 7578538122 Minor tidyup of ebnf 2008-03-19 17:34:47 +13:00
Slava Pestov e98cd1fd59 New convention for unit tests 2008-03-01 17:00:45 -05: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 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 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