Rename project to `yaragg`.

remotes/jackfirth/master
Jack Firth 3 years ago
parent 36306b57d4
commit 386052ac68

@ -37,11 +37,11 @@ jobs:
variant: ${{ matrix.racket-variant }}
- name: Install packages
run: raco pkg install --auto ./br-parser-tools-lib
run: raco pkg install --auto ./br-parser-tools-doc
run: raco pkg install --auto ./br-parser-tools
run: raco pkg install --auto ./brag-lib
run: raco pkg install --auto ./brag
run: raco pkg install --auto ./yaragg-parser-tools-lib
run: raco pkg install --auto ./yaragg-parser-tools-doc
run: raco pkg install --auto ./yaragg-parser-tools
run: raco pkg install --auto ./yaragg-lib
run: raco pkg install --auto ./yaragg
- name: Run the br-parser-tools tests
run: xvfb-run raco test --drdr -p br-parser-tools-lib br-parser-tools-doc br-parser-tools brag-lib brag
- name: Run the yaragg-parser-tools tests
run: xvfb-run raco test --drdr -p yaragg-parser-tools-lib yaragg-parser-tools-doc yaragg-parser-tools yaragg-lib yaragg

19
.gitignore vendored

@ -1,19 +1,2 @@
# for Racket
compiled/
*~
# for Mac OS X
.DS_Store
.AppleDouble
.LSOverride
Icon
# Thumbnails
._*
# Files that might appear on external disk
.Spotlight-V100
.Trashes
brag/*.html
brag/*.css
brag/*.js
doc/

@ -1,9 +1,7 @@
MIT License for `brag` (code only)
Copyright 2022 Jack Firth
© 2017-2020 Matthew Butterick
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

@ -1,18 +1,11 @@
## brag ![Build Status](https://github.com/jackfirth/brag/workflows/CI/badge.svg)
Racket DSL for generating parsers from BNF grammars.
## yaragg ![Build Status](https://github.com/jackfirth/yaragg/workflows/CI/badge.svg)
Yet Another Racket AST-Generator Generator. Racket DSL for generating parsers from BNF grammars. Fork of [`brag`](https://pkgs.racket-lang.org/package/brag), which is itself a fork of [`ragg`](https://pkgs.racket-lang.org/package/ragg).
## Install
`raco pkg install brag`
## Documentation
http://docs.racket-lang.org/brag/
`raco pkg install --auto yaragg`
## License

@ -0,0 +1,11 @@
`yaragg` contains substantial portions of the software [`brag`](https://github.com/mbutterick/brag)
MIT License for `brag` (code only)
© 2017-2020 Matthew Butterick
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

@ -1,4 +1,4 @@
`brag` contains substantial portions of the software [`ragg`](https://github.com/jbclements/ragg)
`yaragg` contains substantial portions of the software [`ragg`](https://github.com/jbclements/ragg)
MIT License for `ragg`

@ -1,3 +0,0 @@
#lang info
(define scribblings '(("br-parser-tools.scrbl" (multi-page) (parsing-library))))

@ -1,12 +0,0 @@
#lang info
(define collection 'multi)
(define deps '("br-parser-tools-lib"
"br-parser-tools-doc"))
(define implies '("br-parser-tools-lib"
"br-parser-tools-doc"))
(define pkg-desc "Lex- and Yacc-style parsing tools")
(define pkg-authors '(mflatt))

@ -1,4 +0,0 @@
#lang brag/examples/simple-line-drawing
3 9 X;
6 3 b 3 X 3 b;
3 9 X;

@ -1,26 +0,0 @@
#lang racket/base
(require brag/test/test-0n1
brag/test/test-0n1n
brag/test/test-01-equal
brag/test/test-baby-json
brag/test/test-baby-json-hider
brag/test/test-curly-quantifier
brag/test/test-cutter
brag/test/test-empty-symbol
brag/test/test-errors
brag/test/test-flatten
brag/test/test-hide-and-splice
brag/test/test-lexer
brag/test/test-nested-repeats
brag/test/test-old-token
brag/test/test-parser
brag/test/test-quotation-marks-and-backslashes
brag/test/test-simple-arithmetic-grammar
brag/test/test-simple-line-drawing
brag/test/test-start-and-atok
brag/test/test-top-level-cut
brag/test/test-weird-grammar
brag/test/test-whitespace
brag/test/test-wordy
(submod brag/codegen/satisfaction test))

@ -1,11 +0,0 @@
#lang racket/base
(require (prefix-in 1: brag/examples/top-level-cut-1)
(prefix-in 2: brag/examples/top-level-cut-2)
(prefix-in 3: brag/examples/top-level-cut-3)
brag/support
rackunit)
(check-equal? (1:parse-to-datum "x") '((sub "x")))
(check-equal? (2:parse-to-datum "x") '(("x")))
(check-equal? (3:parse-to-datum "x") '("x"))

@ -1,4 +0,0 @@
#lang info
(define scribblings '(("brag.scrbl")))

@ -3,8 +3,8 @@
(define collection 'multi)
(define deps '(["base" #:version "6.3"]
"br-parser-tools-lib"
"yaragg-parser-tools-lib"
"rackunit-lib"
"syntax-color-lib"))
(define implies '("br-parser-tools-lib"))
(define implies '("yaragg-parser-tools-lib"))

@ -1,16 +1,16 @@
#lang racket/base
(require racket/list
racket/syntax
brag/rules/stx-types
yaragg/rules/stx-types
syntax/id-table
(prefix-in sat: brag/codegen/satisfaction)
(prefix-in sat: yaragg/codegen/satisfaction)
(for-template racket/base
brag/codegen/runtime
brag/private/internal-support))
yaragg/codegen/runtime
yaragg/private/internal-support))
(provide (all-defined-out)
(for-template (all-from-out brag/codegen/runtime
brag/private/internal-support)))
(for-template (all-from-out yaragg/codegen/runtime
yaragg/private/internal-support)))
;; Given a flattened rule, returns a syntax for the code that
;; preserves as much source location as possible.

@ -1,12 +1,12 @@
#lang racket/base
(require (for-syntax racket/base
racket/list
brag/codegen/codegen
brag/codegen/runtime
brag/codegen/flatten)
br-parser-tools/lex
br-parser-tools/cfg-parser
(prefix-in bs: brag/support)
yaragg/codegen/codegen
yaragg/codegen/runtime
yaragg/codegen/flatten)
yaragg-parser-tools/lex
yaragg-parser-tools/cfg-parser
(prefix-in bs: yaragg/support)
racket/set)
(provide (except-out (all-from-out racket/base) #%module-begin)
@ -39,7 +39,7 @@
[((TOKEN-TYPE . TOKEN-TYPE-CONSTRUCTOR) ...)
(for/list ([tt (in-list (rules->token-types rules))])
(cons tt (string->symbol (format "token-~a" tt))))]
;; Flatten rules to use the yacc-style ruleset that br-parser-tools supports
;; Flatten rules to use the yacc-style ruleset that yaragg-parser-tools supports
[GENERATED-RULE-CODES (map flat-rule->yacc-rule (flatten-rules rules))]
;; main exports. Break hygiene so they're also available at top-level / repl
[(PARSE PARSE-TO-DATUM PARSE-TREE MAKE-RULE-PARSER ALL-TOKEN-TYPES)
@ -54,7 +54,7 @@
#'(#%module-begin
(provide PARSE PARSE-TO-DATUM PARSE-TREE MAKE-RULE-PARSER ALL-TOKEN-TYPES)
;; handle brag/support `token` with special identifier
;; handle yaragg/support `token` with special identifier
;; so it doesn't conflict with brag's internal `token` macro
;; defined but deliberately not provided so it's available at repl, but not on import
(define TOKEN bs:token)

@ -1,5 +1,5 @@
#lang racket/base
(require brag/rules/stx-types
(require yaragg/rules/stx-types
racket/list
(for-syntax racket/base))
(provide flatten-rule

@ -1,14 +1,14 @@
#lang s-exp syntax/module-reader
brag/codegen/expander
yaragg/codegen/expander
#:read my-read
#:read-syntax my-read-syntax
#:info my-get-info
#:whole-body-readers? #t
(require brag/rules/parser
brag/rules/lexer
brag/rules/stx
brag/rules/rule-structs)
(require yaragg/rules/parser
yaragg/rules/lexer
yaragg/rules/stx
yaragg/rules/rule-structs)
(define (my-read in) (syntax->datum (my-read-syntax #f in)))
@ -41,7 +41,7 @@ brag/codegen/expander
(define (my-get-info key default default-filter)
(case key
[(color-lexer) (dynamic-require 'brag/private/colorer 'color-brag (λ () #f))]
[(drracket:indentation) (dynamic-require 'brag/private/indenter 'indent-brag (λ () #f))]
[(color-lexer) (dynamic-require 'yaragg/private/colorer 'color-brag (λ () #f))]
[(drracket:indentation) (dynamic-require 'yaragg/private/indenter 'indent-brag (λ () #f))]
[else (default-filter key default)]))

@ -2,9 +2,9 @@
(require racket/match
racket/list
racket/generator
(prefix-in lex: br-parser-tools/lex)
brag/support
brag/private/internal-support)
(prefix-in lex: yaragg-parser-tools/lex)
yaragg/support
yaragg/private/internal-support)
(provide the-error-handler

@ -0,0 +1,4 @@
#lang yaragg/examples/simple-line-drawing
3 9 X;
6 3 b 3 X 3 b;
3 9 X;

@ -1,12 +1,12 @@
#lang s-exp syntax/module-reader
brag/examples/simple-line-drawing/semantics
yaragg/examples/simple-line-drawing/semantics
#:read my-read
#:read-syntax my-read-syntax
#:info my-get-info
#:whole-body-readers? #t
(require brag/examples/simple-line-drawing/lexer
brag/examples/simple-line-drawing/grammar)
(require yaragg/examples/simple-line-drawing/lexer
yaragg/examples/simple-line-drawing/grammar)
(define (my-read in)
(syntax->datum (my-read-syntax #f in)))

@ -3,8 +3,8 @@
(provide tokenize)
;; A simple lexer for simple-line-drawing.
(require brag/support
br-parser-tools/lex)
(require yaragg/support
yaragg-parser-tools/lex)
(define (tokenize ip)
(port-count-lines! ip)

@ -1,8 +1,8 @@
#lang racket/base
(module reader racket/base
(require brag/codegen/reader)
(provide (all-from-out brag/codegen/reader)))
(require yaragg/codegen/reader)
(provide (all-from-out yaragg/codegen/reader)))
;; this creates dummy identifiers
;; so cross-refs in `brag` docs will work

@ -1,5 +1,5 @@
#lang racket/base
(require brag/support (submod brag/rules/lexer lex-abbrevs) racket/match)
(require yaragg/support (submod yaragg/rules/lexer lex-abbrevs) racket/match)
(provide color-brag)
(define brag-syntax-lexer

@ -1,6 +1,6 @@
#lang racket/base
(require brag/support)
(require yaragg/support)
(provide current-source
current-parser-error-handler

@ -1,10 +1,10 @@
#lang racket/base
(require (for-syntax racket/base brag/rules/parser))
(require br-parser-tools/lex
(prefix-in : br-parser-tools/lex-sre)
brag/rules/parser
brag/rules/rule-structs
(only-in brag/support from/to)
(require (for-syntax racket/base yaragg/rules/parser))
(require yaragg-parser-tools/lex
(prefix-in : yaragg-parser-tools/lex-sre)
yaragg/rules/parser
yaragg/rules/rule-structs
(only-in yaragg/support from/to)
racket/string
syntax-color/racket-lexer
racket/match)
@ -163,7 +163,7 @@
(values "" end-pos)]))
;; position->pos: position -> pos
;; Converts position structures from br-parser-tools/lex to our own pos structures.
;; Converts position structures from yaragg-parser-tools/lex to our own pos structures.
(define (position->pos a-pos)
(pos (position-offset a-pos)
(position-line a-pos)

@ -1,9 +1,9 @@
#lang racket/base
(require br-parser-tools/yacc
br-parser-tools/lex
(require yaragg-parser-tools/yacc
yaragg-parser-tools/lex
racket/list
racket/match
brag/rules/rule-structs)
yaragg/rules/rule-structs)
;; A parser for grammars.
@ -265,7 +265,7 @@
;; position->pos: position -> pos
;; Coerses position structures from br-parser-tools/lex to our own pos structures.
;; Coerses position structures from yaragg-parser-tools/lex to our own pos structures.
(define (position->pos a-pos)
(pos (position-offset a-pos)
(position-line a-pos)

@ -2,7 +2,7 @@
(provide (all-defined-out))
;; We keep our own position structure because br-parser-tools/lex's position
;; We keep our own position structure because yaragg-parser-tools/lex's position
;; structure is non-transparent, hence highly resistant to unit testing.
(struct pos (offset line col)
#:transparent)

@ -1,7 +1,7 @@
#lang racket/base
(require brag/rules/rule-structs
br-parser-tools/lex
(require yaragg/rules/rule-structs
yaragg-parser-tools/lex
racket/match
syntax/strip-context)

@ -1,11 +1,11 @@
#lang racket/base
(require br-parser-tools/lex
(require yaragg-parser-tools/lex
racket/string
racket/struct
(prefix-in : br-parser-tools/lex-sre)
(prefix-in : yaragg-parser-tools/lex-sre)
(for-syntax racket/base))
(provide (all-from-out br-parser-tools/lex)
(all-from-out br-parser-tools/lex-sre)
(provide (all-from-out yaragg-parser-tools/lex)
(all-from-out yaragg-parser-tools/lex-sre)
[struct-out token-struct]
token
[struct-out exn:fail:parsing])

@ -1,6 +1,6 @@
#lang racket/base
(require brag/examples/01-equal
(require yaragg/examples/01-equal
rackunit)
(check-equal? (syntax->datum (parse ""))

@ -1,7 +1,7 @@
#lang racket/base
(require brag/examples/0n1
brag/support
(require yaragg/examples/0n1
yaragg/support
rackunit)
(define (lex ip)

@ -1,6 +1,6 @@
#lang racket/base
(require brag/examples/0n1n
brag/support
(require yaragg/examples/0n1n
yaragg/support
rackunit)
(define (lex ip)

@ -0,0 +1,26 @@
#lang racket/base
(require yaragg/test/test-0n1
yaragg/test/test-0n1n
yaragg/test/test-01-equal
yaragg/test/test-baby-json
yaragg/test/test-baby-json-hider
yaragg/test/test-curly-quantifier
yaragg/test/test-cutter
yaragg/test/test-empty-symbol
yaragg/test/test-errors
yaragg/test/test-flatten
yaragg/test/test-hide-and-splice
yaragg/test/test-lexer
yaragg/test/test-nested-repeats
yaragg/test/test-old-token
yaragg/test/test-parser
yaragg/test/test-quotation-marks-and-backslashes
yaragg/test/test-simple-arithmetic-grammar
yaragg/test/test-simple-line-drawing
yaragg/test/test-start-and-atok
yaragg/test/test-top-level-cut
yaragg/test/test-weird-grammar
yaragg/test/test-whitespace
yaragg/test/test-wordy
(submod yaragg/codegen/satisfaction test))

@ -1,6 +1,6 @@
#lang racket/base
(require brag/examples/baby-json-hider
brag/support
(require yaragg/examples/baby-json-hider
yaragg/support
rackunit)
(define parse-result (parse (list "{"

@ -1,7 +1,7 @@
#lang racket/base
(require brag/examples/baby-json
(prefix-in alt: brag/examples/baby-json-alt)
brag/support
(require yaragg/examples/baby-json
(prefix-in alt: yaragg/examples/baby-json-alt)
yaragg/support
rackunit)
(let ([str (list "{"

@ -1,6 +1,6 @@
#lang racket/base
(require brag/examples/codepoints
(require yaragg/examples/codepoints
rackunit)
(check-equal? (parse-to-datum '("\"A\\" "'c\\" "*d\\\"\\ef\"" "hello world"))

@ -1,6 +1,6 @@
#lang racket/base
(require brag/examples/curly-quantifier
brag/support
(require yaragg/examples/curly-quantifier
yaragg/support
rackunit)
(check-exn exn:fail:parsing? (λ () (parse-to-datum "a")))

@ -1,6 +1,6 @@
#lang racket/base
(require brag/examples/cutter-another
brag/support
(require yaragg/examples/cutter-another
yaragg/support
rackunit)
(check-equal? (parse-tree "w") '(top (w)))

@ -1,6 +1,6 @@
#lang racket/base
(require brag/examples/cutter
brag/support
(require yaragg/examples/cutter
yaragg/support
rackunit)
;; related to rule-flattening problem

@ -1,6 +1,6 @@
#lang racket/base
(require brag/examples/empty-symbol
brag/support
(require yaragg/examples/empty-symbol
yaragg/support
rackunit)
(check-true (and (member (parse-to-datum "") (list '(top (xs)) '(top (ys)) '(top (zs)))) #t))

@ -130,7 +130,7 @@ EOF
(check-compile-error #<<EOF
#lang racket/base
(require brag/examples/simple-line-drawing)
(require yaragg/examples/simple-line-drawing)
(define bad-parser (make-rule-parser crunchy))
EOF
"Rule crunchy is not defined in the grammar"

@ -1,6 +1,6 @@
#lang racket/base
(require brag/rules/stx-types
brag/codegen/flatten
(require yaragg/rules/stx-types
yaragg/codegen/flatten
rackunit)

@ -1,6 +1,6 @@
#lang racket/base
(require brag/examples/hide-and-splice
brag/support
(require yaragg/examples/hide-and-splice
yaragg/support
rackunit)
;; check that an id with both a splice and hide is handled correctly

@ -1,7 +1,7 @@
#lang racket/base
(require brag/rules/lexer
(require yaragg/rules/lexer
rackunit
br-parser-tools/lex)
yaragg-parser-tools/lex)
(define (l s)
(define t (lex/1 (open-input-string s)))

@ -1,7 +1,7 @@
#lang racket/base
(require rackunit
brag/support
brag/examples/subrule)
yaragg/support
yaragg/examples/subrule)
(define parse-next (make-rule-parser next))
(define parse-start (make-rule-parser start))

@ -1,5 +1,5 @@
#lang racket/base
(require brag/examples/nested-repeats
(require yaragg/examples/nested-repeats
rackunit)
(check-equal?

@ -2,11 +2,11 @@
;; Make sure the old token type also works fine.
(require brag/examples/simple-line-drawing
brag/support
(require yaragg/examples/simple-line-drawing
yaragg/support
racket/list
br-parser-tools/lex
(prefix-in : br-parser-tools/lex-sre)
yaragg-parser-tools/lex
(prefix-in : yaragg-parser-tools/lex-sre)
rackunit)
(define-tokens tokens (INTEGER STRING |;| EOF))
@ -72,5 +72,5 @@ EOF
;; FIXME: add tests to make sure location is as we expect.
;;
;; FIXME: handle the EOF issue better. Something in cfg-parser
;; appears to deviate from br-parser-tools/yacc with regards to the stop
;; appears to deviate from yaragg-parser-tools/yacc with regards to the stop
;; token.

@ -2,10 +2,10 @@
(require rackunit
br-parser-tools/lex
brag/rules/parser
brag/rules/lexer
brag/rules/rule-structs)
yaragg-parser-tools/lex
yaragg/rules/parser
yaragg/rules/lexer
yaragg/rules/rule-structs)
;; quick-and-dirty helper for pos construction.

@ -1,6 +1,6 @@
#lang racket/base
(require brag/examples/quotation-marks-and-backslashes
brag/support
(require yaragg/examples/quotation-marks-and-backslashes
yaragg/support
rackunit)
(check-equal? (parse-tree "a\"'\\a\"'\\") '(start "a" "\"" "'" "\\" "a" "\"" "'" "\\"))

@ -1,8 +1,8 @@
#lang racket/base
(require brag/examples/simple-arithmetic-grammar
brag/support
(require yaragg/examples/simple-arithmetic-grammar
yaragg/support
racket/set
br-parser-tools/lex
yaragg-parser-tools/lex
racket/list
rackunit)

@ -1,10 +1,10 @@
#lang racket/base
(require brag/examples/simple-line-drawing
brag/support
(require yaragg/examples/simple-line-drawing
yaragg/support
racket/list
br-parser-tools/lex
(prefix-in : br-parser-tools/lex-sre)
yaragg-parser-tools/lex
(prefix-in : yaragg-parser-tools/lex-sre)
rackunit)
(define (make-tokenizer ip)
@ -68,5 +68,5 @@ EOF
;; FIXME: add tests to make sure location is as we expect.
;;
;; FIXME: handle the EOF issue better. Something in cfg-parser
;; appears to deviate from br-parser-tools/yacc with regards to the stop
;; appears to deviate from yaragg-parser-tools/yacc with regards to the stop
;; token.

@ -1,7 +1,7 @@
#lang racket/base
(require brag/examples/start-and-atok
brag/support
(require yaragg/examples/start-and-atok
yaragg/support
rackunit)
;; make sure that "start" and "atok" work as terminals.

@ -0,0 +1,11 @@
#lang racket/base
(require (prefix-in 1: yaragg/examples/top-level-cut-1)
(prefix-in 2: yaragg/examples/top-level-cut-2)
(prefix-in 3: yaragg/examples/top-level-cut-3)
yaragg/support
rackunit)
(check-equal? (1:parse-to-datum "x") '((sub "x")))
(check-equal? (2:parse-to-datum "x") '(("x")))
(check-equal? (3:parse-to-datum "x") '("x"))

@ -1,6 +1,6 @@
#lang racket/base
(require brag/test/weird-grammar
(require yaragg/test/weird-grammar
rackunit)
(check-equal? (syntax->datum (parse '("foo")))

@ -1,6 +1,6 @@
#lang racket/base
(require brag/examples/whitespace
brag/support
(require yaragg/examples/whitespace
yaragg/support
rackunit)
(check-equal?

@ -1,6 +1,6 @@
#lang racket/base
(require brag/examples/wordy
brag/support
(require yaragg/examples/wordy
yaragg/support
rackunit)
(check-equal?

@ -5,10 +5,6 @@
(define build-deps '("scheme-lib"
"racket-doc"
"syntax-color-doc"
"br-parser-tools-lib"
"yaragg-parser-tools-lib"
"scribble-lib"))
(define update-implies '("br-parser-tools-lib"))
(define pkg-desc "documentation part of \"br-parser-tools\"")
(define pkg-authors '(mflatt))
(define update-implies '("yaragg-parser-tools-lib"))

@ -2,10 +2,10 @@
@(require scribble/manual scribble/struct scribble/xref scribble/bnf
(for-label scheme/base
scheme/contract
br-parser-tools/lex
(prefix-in : br-parser-tools/lex-sre)
br-parser-tools/yacc
br-parser-tools/cfg-parser))
yaragg-parser-tools/lex
(prefix-in : yaragg-parser-tools/lex-sre)
yaragg-parser-tools/yacc
yaragg-parser-tools/cfg-parser))
@title{Parser Tools: @exec{lex} and @exec{yacc}-style Parsing (BR edition)}
@ -26,7 +26,7 @@ This documentation assumes familiarity with @exec{lex}- and @exec{yacc}-style le
@section-index["scanning"]
@section-index["scanner"]
@defmodule[br-parser-tools/lex]
@defmodule[yaragg-parser-tools/lex]
@; ----------------------------------------
@ -61,7 +61,7 @@ This documentation assumes familiarity with @exec{lex}- and @exec{yacc}-style le
@margin-note{The implementation of @racketmodname[syntax-color/racket-lexer]
contains a lexer for the @racketmodname[racket] language.
In addition, files in the @filepath{examples} sub-directory
of the @filepath{br-parser-tools} collection contain
of the @filepath{yaragg-parser-tools} collection contain
simpler example lexers.}
An @racket[re] is matched as follows:
@ -69,7 +69,7 @@ This documentation assumes familiarity with @exec{lex}- and @exec{yacc}-style le
@itemize[
@item{@racket[id] --- expands to the named @deftech{lexer abbreviation};
abbreviations are defined via @racket[define-lex-abbrev] or supplied by modules
like @racketmodname[br-parser-tools/lex-sre].}
like @racketmodname[yaragg-parser-tools/lex-sre].}
@item{@racket[string] --- matches the sequence of characters in @racket[string].}
@item{@racket[character] --- matches a literal @racket[character].}
@item{@racket[(repetition lo hi re)] --- matches @racket[re] repeated between @racket[lo]
@ -94,15 +94,15 @@ empty string, @racket[(union)] matches nothing,
The regular expression language is not designed to be used directly,
but rather as a basis for a user-friendly notation written with
regular expression macros. For example,
@racketmodname[br-parser-tools/lex-sre] supplies operators from Olin
Shivers's SREs, and @racketmodname[br-parser-tools/lex-plt-v200] supplies
@racketmodname[yaragg-parser-tools/lex-sre] supplies operators from Olin
Shivers's SREs, and @racketmodname[yaragg-parser-tools/lex-plt-v200] supplies
(deprecated) operators from the previous version of this library.
Since those libraries provide operators whose names match other Racket
bindings, such as @racket[*] and @racket[+], they normally must be
imported using a prefix:
@racketblock[
(require (prefix-in : br-parser-tools/lex-sre))
(require (prefix-in : yaragg-parser-tools/lex-sre))
]
The suggested prefix is @racket[:], so that @racket[:*] and
@ -360,14 +360,14 @@ characters, @racket[char-lower-case?] characters, etc.}
@subsection{Lexer SRE Operators}
@defmodule[br-parser-tools/lex-sre]
@defmodule[yaragg-parser-tools/lex-sre]
@; Put the docs in a macro, so that we can bound the scope of
@; the import of `*', etc.:
@(define-syntax-rule (lex-sre-doc)
(...
(begin
(require (for-label br-parser-tools/lex-sre))
(require (for-label yaragg-parser-tools/lex-sre))
@defform[(* re ...)]{
@ -437,16 +437,16 @@ characters.}
@subsection{Lexer Legacy Operators}
@defmodule[br-parser-tools/lex-plt-v200]
@defmodule[yaragg-parser-tools/lex-plt-v200]
@(define-syntax-rule (lex-v200-doc)
(...
(begin
(require (for-label br-parser-tools/lex-plt-v200))
(require (for-label yaragg-parser-tools/lex-plt-v200))
@t{The @racketmodname[br-parser-tools/lex-plt-v200] module re-exports
@t{The @racketmodname[yaragg-parser-tools/lex-plt-v200] module re-exports
@racket[*], @racket[+], @racket[?], and @racket[&] from
@racketmodname[br-parser-tools/lex-sre]. It also re-exports
@racketmodname[yaragg-parser-tools/lex-sre]. It also re-exports
@racket[:or] as @racket[:], @racket[::] as @racket[|@|], @racket[:~]
as @racket[^], and @racket[:/] as @racket[-].}
@ -467,7 +467,7 @@ The same as @racket[(complement re ...)].})))
Each @racket[_action-expr] in a @racket[lexer] form can produce any
kind of value, but for many purposes, producing a @deftech{token}
value is useful. Tokens are usually necessary for inter-operating with
a parser generated by @racket[br-parser-tools/parser], but tokens may not
a parser generated by @racket[yaragg-parser-tools/parser], but tokens may not
be the right choice when using @racket[lexer] in other situations.
@defform[(define-tokens group-id (token-id ...))]{
@ -513,7 +513,7 @@ be the right choice when using @racket[lexer] in other situations.
@section-index["yacc"]
@defmodule[br-parser-tools/yacc]
@defmodule[yaragg-parser-tools/yacc]
@defform/subs[#:literals (grammar tokens start end precs src-pos
suppress debug yacc-output prec)
@ -712,9 +712,9 @@ be the right choice when using @racket[lexer] in other situations.
@section-index["cfg-parser"]
@defmodule[br-parser-tools/cfg-parser]{The @racketmodname[br-parser-tools/cfg-parser]
@defmodule[yaragg-parser-tools/cfg-parser]{The @racketmodname[yaragg-parser-tools/cfg-parser]
library provides a parser generator that is an alternative to that of
@racketmodname[br-parser-tools/yacc].}
@racketmodname[yaragg-parser-tools/yacc].}
@defform/subs[#:literals (grammar tokens start end precs src-pos
suppress debug yacc-output prec)
@ -731,7 +731,7 @@ library provides a parser generator that is an alternative to that of
Creates a parser similar to that of @racket[parser]. Unlike @racket[parser],
@racket[cfg-parser], can consume arbitrary and potentially ambiguous context-free
grammars. Its interface is a subset of @racketmodname[br-parser-tools/yacc], with
grammars. Its interface is a subset of @racketmodname[yaragg-parser-tools/yacc], with
the following differences:
@itemize[
@ -751,7 +751,7 @@ library provides a parser generator that is an alternative to that of
@section{Converting @exec{yacc} or @exec{bison} Grammars}
@defmodule[br-parser-tools/yacc-to-scheme]
@defmodule[yaragg-parser-tools/yacc-to-scheme]
@defproc[(trans [file path-string?]) any/c]{
@ -765,7 +765,7 @@ conversion tool. It is not entirely robust. For example, if the C
actions in the original grammar have nested blocks, the tool will fail.
Annotated examples are in the @filepath{examples} subdirectory of the
@filepath{br-parser-tools} collection.}
@filepath{yaragg-parser-tools} collection.}
@; ----------------------------------------------------------------------

@ -0,0 +1,3 @@
#lang info
(define scribblings '(("yaragg-parser-tools.scrbl" (multi-page) (parsing-library))))

@ -5,5 +5,3 @@
"base"
"compatibility-lib"))
(define build-deps '("rackunit-lib"))
(define pkg-desc "implementation (no documentation) part of \"br-parser-tools\"")

@ -1,5 +1,5 @@
#lang racket/base
;; This module implements a parser form like the br-parser-tools's
;; This module implements a parser form like the yaragg-parser-tools's
;; `parser', except that it works on an arbitrary CFG (returning
;; the first sucecssful parse).
@ -23,7 +23,7 @@
;; different lengths. (Otherwise, in the spirit of finding one
;; successful parse, only the first result is kept.)
;; The br-parser-tools's `parse' is used to transform tokens in the
;; The yaragg-parser-tools's `parse' is used to transform tokens in the
;; grammar to tokens specific to this parser. In other words, this
;; parser uses `parser' so that it doesn't have to know anything about
;; tokens.
@ -31,12 +31,12 @@
(require br-parser-tools/yacc
br-parser-tools/lex)
(require yaragg-parser-tools/yacc
yaragg-parser-tools/lex)
(require (for-syntax racket/base
syntax/boundmap
br-parser-tools/private-lex/token-syntax))
yaragg-parser-tools/private-lex/token-syntax))
(provide cfg-parser)
@ -752,7 +752,7 @@
(module* test racket/base
(require (submod "..")
br-parser-tools/lex
yaragg-parser-tools/lex
racket/block
rackunit)

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save