Move `yaragg-parser-tools` collection to `yaragg/parser-tools`

remotes/jackfirth/master
Jack Firth 3 years ago
parent aa5a5ab533
commit 6c0930207f

@ -4,8 +4,8 @@
yaragg/codegen/codegen
yaragg/codegen/runtime
yaragg/codegen/flatten)
yaragg-parser-tools/lex
yaragg-parser-tools/cfg-parser
yaragg/parser-tools/lex
yaragg/parser-tools/cfg-parser
(prefix-in bs: yaragg/support)
racket/set)

@ -2,7 +2,7 @@
(require racket/match
racket/list
racket/generator
(prefix-in lex: yaragg-parser-tools/lex)
(prefix-in lex: yaragg/parser-tools/lex)
yaragg/support
yaragg/private/internal-support)

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

@ -1,7 +1,7 @@
#lang racket/base
(require (for-syntax racket/base yaragg/rules/parser))
(require yaragg-parser-tools/lex
(prefix-in : yaragg-parser-tools/lex-sre)
(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)
@ -163,7 +163,7 @@
(values "" end-pos)]))
;; position->pos: position -> pos
;; Converts position structures from yaragg-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,6 +1,6 @@
#lang racket/base
(require yaragg-parser-tools/yacc
yaragg-parser-tools/lex
(require yaragg/parser-tools/yacc
yaragg/parser-tools/lex
racket/list
racket/match
yaragg/rules/rule-structs)
@ -265,7 +265,7 @@
;; position->pos: position -> pos
;; Coerses position structures from yaragg-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 yaragg-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 yaragg/rules/rule-structs
yaragg-parser-tools/lex
yaragg/parser-tools/lex
racket/match
syntax/strip-context)

@ -1,11 +1,11 @@
#lang racket/base
(require yaragg-parser-tools/lex
(require yaragg/parser-tools/lex
racket/string
racket/struct
(prefix-in : yaragg-parser-tools/lex-sre)
(prefix-in : yaragg/parser-tools/lex-sre)
(for-syntax racket/base))
(provide (all-from-out yaragg-parser-tools/lex)
(all-from-out yaragg-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,7 +1,7 @@
#lang racket/base
(require yaragg/rules/lexer
rackunit
yaragg-parser-tools/lex)
yaragg/parser-tools/lex)
(define (l s)
(define t (lex/1 (open-input-string s)))

@ -5,8 +5,8 @@
(require yaragg/examples/simple-line-drawing
yaragg/support
racket/list
yaragg-parser-tools/lex
(prefix-in : yaragg-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 yaragg-parser-tools/yacc with regards to the stop
;; appears to deviate from yaragg/parser-tools/yacc with regards to the stop
;; token.

@ -2,7 +2,7 @@
(require rackunit
yaragg-parser-tools/lex
yaragg/parser-tools/lex
yaragg/rules/parser
yaragg/rules/lexer
yaragg/rules/rule-structs)

@ -2,7 +2,7 @@
(require yaragg/examples/simple-arithmetic-grammar
yaragg/support
racket/set
yaragg-parser-tools/lex
yaragg/parser-tools/lex
racket/list
rackunit)

@ -3,8 +3,8 @@
(require yaragg/examples/simple-line-drawing
yaragg/support
racket/list
yaragg-parser-tools/lex
(prefix-in : yaragg-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 yaragg-parser-tools/yacc with regards to the stop
;; appears to deviate from yaragg/parser-tools/yacc with regards to the stop
;; token.

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

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

@ -2,10 +2,10 @@
@(require scribble/manual scribble/struct scribble/xref scribble/bnf
(for-label scheme/base
scheme/contract
yaragg-parser-tools/lex
(prefix-in : yaragg-parser-tools/lex-sre)
yaragg-parser-tools/yacc
yaragg-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[yaragg-parser-tools/lex]
@defmodule[yaragg/parser-tools/lex]
@; ----------------------------------------
@ -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[yaragg-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[yaragg-parser-tools/lex-sre] supplies operators from Olin
Shivers's SREs, and @racketmodname[yaragg-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 : yaragg-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[yaragg-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 yaragg-parser-tools/lex-sre))
(require (for-label yaragg/parser-tools/lex-sre))
@defform[(* re ...)]{
@ -437,16 +437,16 @@ characters.}
@subsection{Lexer Legacy Operators}
@defmodule[yaragg-parser-tools/lex-plt-v200]
@defmodule[yaragg/parser-tools/lex-plt-v200]
@(define-syntax-rule (lex-v200-doc)
(...
(begin
(require (for-label yaragg-parser-tools/lex-plt-v200))
(require (for-label yaragg/parser-tools/lex-plt-v200))
@t{The @racketmodname[yaragg-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[yaragg-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[yaragg-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[yaragg-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[yaragg-parser-tools/cfg-parser]{The @racketmodname[yaragg-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[yaragg-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[yaragg-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[yaragg-parser-tools/yacc-to-scheme]
@defmodule[yaragg/parser-tools/yacc-to-scheme]
@defproc[(trans [file path-string?]) any/c]{

@ -31,12 +31,12 @@
(require yaragg-parser-tools/yacc
yaragg-parser-tools/lex)
(require yaragg/parser-tools/yacc
yaragg/parser-tools/lex)
(require (for-syntax racket/base
syntax/boundmap
yaragg-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 "..")
yaragg-parser-tools/lex
yaragg/parser-tools/lex
racket/block
rackunit)

@ -4,9 +4,9 @@
;; Import the parser and lexer generators.
(require yaragg-parser-tools/yacc
yaragg-parser-tools/lex
(prefix-in : yaragg-parser-tools/lex-sre))
(require yaragg/parser-tools/yacc
yaragg/parser-tools/lex
(prefix-in : yaragg/parser-tools/lex-sre))
(define-tokens value-tokens (NUM VAR FNCT))
(define-empty-tokens op-tokens (newline = OP CP + - * / ^ EOF NEG))

@ -4,9 +4,9 @@
;; list of syntax objects, instead of returning one syntax object at a time
(require (for-syntax racket/base)
yaragg-parser-tools/lex
(prefix-in : yaragg-parser-tools/lex-sre)
yaragg-parser-tools/yacc
yaragg/parser-tools/lex
(prefix-in : yaragg/parser-tools/lex-sre)
yaragg/parser-tools/yacc
syntax/readerr)
(define-tokens data (DATUM))

@ -1,7 +1,7 @@
#lang racket/base
(require (for-syntax racket/base)
yaragg-parser-tools/lex
(prefix-in : yaragg-parser-tools/lex-sre))
yaragg/parser-tools/lex
(prefix-in : yaragg/parser-tools/lex-sre))
(provide epsilon ~
(rename-out [:* *]

@ -1,6 +1,6 @@
#lang racket/base
(require (for-syntax racket/base)
yaragg-parser-tools/lex)
yaragg/parser-tools/lex)
(provide (rename-out [sre-* *]
[sre-+ +]

@ -1,6 +1,6 @@
#lang racket/base
(require (for-syntax racket/base)
yaragg-parser-tools/lex
yaragg/parser-tools/lex
rackunit)
(define-syntax (catch-syn-error stx)

@ -1,5 +1,5 @@
#lang racket/base
(require yaragg-parser-tools/private-lex/util syntax/id-table racket/syntax)
(require yaragg/parser-tools/private-lex/util syntax/id-table racket/syntax)
(provide parse)
(define (bad-args stx num)

@ -1,5 +1,5 @@
#lang racket/base
(require (for-syntax racket/base yaragg-parser-tools/private-lex/token-syntax))
(require (for-syntax racket/base yaragg/parser-tools/private-lex/token-syntax))
;; Defining tokens

@ -1,5 +1,5 @@
#lang racket/base
(require racket/promise yaragg-parser-tools/private-lex/util)
(require racket/promise yaragg/parser-tools/private-lex/util)
(provide (all-defined-out))

@ -1,7 +1,7 @@
#lang racket/base
(require yaragg-parser-tools/private-yacc/yacc-helper
yaragg-parser-tools/private-lex/token-syntax
yaragg-parser-tools/private-yacc/grammar
(require yaragg/parser-tools/private-yacc/yacc-helper
yaragg/parser-tools/private-lex/token-syntax
yaragg/parser-tools/private-yacc/grammar
racket/class
racket/contract
(for-template racket/base))

@ -1,6 +1,6 @@
#lang racket/base
(require yaragg-parser-tools/private-yacc/lr0
yaragg-parser-tools/private-yacc/grammar
(require yaragg/parser-tools/private-yacc/lr0
yaragg/parser-tools/private-yacc/grammar
racket/list
racket/class)

@ -1,6 +1,6 @@
#lang racket/base
(require yaragg-parser-tools/private-yacc/grammar
yaragg-parser-tools/private-yacc/graph
(require yaragg/parser-tools/private-yacc/grammar
yaragg/parser-tools/private-yacc/graph
racket/list
racket/class)

@ -1,5 +1,5 @@
#lang racket/base
(require yaragg-parser-tools/private-yacc/grammar)
(require yaragg/parser-tools/private-yacc/grammar)
(provide (except-out (all-defined-out) make-reduce make-reduce*)
(rename-out [make-reduce* make-reduce]))

@ -1,7 +1,7 @@
#lang racket/base
(require yaragg-parser-tools/private-yacc/input-file-parser
yaragg-parser-tools/private-yacc/grammar
yaragg-parser-tools/private-yacc/table
(require yaragg/parser-tools/private-yacc/input-file-parser
yaragg/parser-tools/private-yacc/grammar
yaragg/parser-tools/private-yacc/table
racket/class
racket/contract)
(require (for-template racket/base))

@ -1,8 +1,8 @@
#lang racket/base
(require yaragg-parser-tools/private-yacc/grammar
yaragg-parser-tools/private-yacc/lr0
yaragg-parser-tools/private-yacc/lalr
yaragg-parser-tools/private-yacc/parser-actions
(require yaragg/parser-tools/private-yacc/grammar
yaragg/parser-tools/private-yacc/lr0
yaragg/parser-tools/private-yacc/lalr
yaragg/parser-tools/private-yacc/parser-actions
racket/contract
racket/list
racket/class)

@ -1,6 +1,6 @@
#lang racket/base
(require (prefix-in rl: racket/list)
yaragg-parser-tools/private-lex/token-syntax)
yaragg/parser-tools/private-lex/token-syntax)
;; General helper routines
(provide duplicate-list? remove-duplicates overlap? vector-andmap display-yacc)

@ -1,7 +1,7 @@
#lang racket/base
(require yaragg-parser-tools/lex
(prefix-in : yaragg-parser-tools/lex-sre)
yaragg-parser-tools/yacc
(require yaragg/parser-tools/lex
(prefix-in : yaragg/parser-tools/lex-sre)
yaragg/parser-tools/yacc
syntax/readerr
racket/list)
(provide trans)

@ -5,7 +5,7 @@
(for-label racket
yaragg
yaragg/support
(only-in yaragg-parser-tools/lex lexer-src-pos)
(only-in yaragg/parser-tools/lex lexer-src-pos)
(only-in syntax/parse syntax-parse ~literal)))
@ -264,11 +264,11 @@ A @emph{token} is the smallest meaningful element of a source program. Tokens ca
If possible, we also want to attach source location information to each token. Why? Because this information will be incorporated into the syntax objects produced by @racket[parse].
A parser often works in conjunction with a helper function called a @emph{lexer} that converts the raw code of the source program into tokens. The @racketmodname[yaragg-parser-tools/lex] library can help us write a position-sensitive
A parser often works in conjunction with a helper function called a @emph{lexer} that converts the raw code of the source program into tokens. The @racketmodname[yaragg/parser-tools/lex] library can help us write a position-sensitive
tokenizer:
@interaction[#:eval my-eval
(require yaragg-parser-tools/lex)
(require yaragg/parser-tools/lex)
(define (tokenize ip)
(port-count-lines! ip)
(define my-lexer
@ -307,7 +307,7 @@ Note also from this lexer example:
@item{@racket[parse] accepts as input either a sequence of tokens, or a
function that produces tokens (which @racket[parse] will call repeatedly to get the next token).}
@item{As an alternative to the basic @racket[token] structure, a token can also be an instance of the @racket[position-token] structure (also found in @racketmodname[yaragg-parser-tools/lex]). In that case, the token will try to derive its position from that of the position-token.}
@item{As an alternative to the basic @racket[token] structure, a token can also be an instance of the @racket[position-token] structure (also found in @racketmodname[yaragg/parser-tools/lex]). In that case, the token will try to derive its position from that of the position-token.}
@item{@racket[parse] will stop if it gets @racket[void] (or @racket['eof]) as a token.}
@ -939,8 +939,8 @@ bindings. The most important of these is @racket[parse]:
@item{a string}
@item{a symbol}
@item{an instance produced by @racket[token]}
@item{an instance produced by the token constructors of @racketmodname[yaragg-parser-tools/lex]}
@item{an instance of @racketmodname[yaragg-parser-tools/lex]'s @racket[position-token] whose
@item{an instance produced by the token constructors of @racketmodname[yaragg/parser-tools/lex]}
@item{an instance of @racketmodname[yaragg/parser-tools/lex]'s @racket[position-token] whose
@racket[position-token-token] is a @tech{token}.}
]
@ -1045,7 +1045,7 @@ The @racketmodname[yaragg/support] module provides functions to interact with
@tt{brag} programs. The most useful is the @racket[token] function, which
produces tokens to be parsed.
In addition to the exports shown below, the @racketmodname[yaragg/support] module also provides everything from @racketmodname[yaragg/support], and everything from @racketmodname[yaragg-parser-tools/lex].
In addition to the exports shown below, the @racketmodname[yaragg/support] module also provides everything from @racketmodname[yaragg/support], and everything from @racketmodname[yaragg/parser-tools/lex].
@defproc[(token [type (or/c string? symbol?)]

Loading…
Cancel
Save