README.md neatens

This commit is contained in:
John Kerl 2021-02-14 10:34:24 -05:00
parent 6b03db1b25
commit 974e2d2085
9 changed files with 39 additions and 28 deletions

View file

@ -113,12 +113,16 @@ So, in broad overview, the key packages are:
### Dependencies
* Miller dependencies are all in the Go standard library, except a local one:
* `src/github.com/goccmack`
* GOCC lexer/parser code-generator from [github.com/goccmack/gocc](https://github.com/goccmack/gocc):
* Miller dependencies are all in the Go standard library, except two:
* GOCC lexer/parser code-generator from [github.com/goccmack/gocc](https://github.com/goccmack/gocc):
* This package defines the grammar for Miller's domain-specific language (DSL) for the Miller `put` and `filter` verbs. And, GOCC is a joy to use. :)
* Note on the path: `go get github.com/goccmack/gocc` uses this directory path, and is nice enough to also create `bin/gocc` for me -- so I thought I would just let it continue to do that by using that local path. :)
* I kept this locally so I could source-control it along with Miller and guarantee its stability. It is used on the terms of its open-source license.
* It is used on the terms of its open-source license.
* [golang.org/x/term](https://pkg.go.dev/golang.org/x/term):
* Just a one-line Miller callsite for is-a-terminal checking for the [Miller REPL](https://github.com/johnkerl/miller/blob/go-mod/go/src/auxents/repl/README.md).
* It is used on the terms of its open-source license.
* See also [./go.mod](go.mod). Setup:
* `go get github.com/goccmack/gocc`
* `go get golang.org/x/term`
### Miller per se

View file

@ -2,6 +2,13 @@
# ================================================================
# Reads the Miller DSL grammar file and generates Go code.
#
# This is not run on every build / commit / etc.
#
# It's intended to be run manually by the developer, as needed when mlr.bnf
# changes for example.
#
# Resulting auto-generated .go files should then be checked into source control.
# ================================================================
set -euo pipefail
@ -14,18 +21,19 @@ if [ $# -eq 1 ]; then
fi
# Build the bin/gocc executable:
###### go get github.com/goccmack/gocc
mkdir -p ./bin
#go build github.com/goccmack/gocc
go build github.com/johnkerl/gocc
mv gocc ./bin/
#go get github.com/goccmack/gocc
go get github.com/johnkerl/gocc
bingocc="$GOPATH/bin/gocc"
if [ ! -x "$bingocc" ]; then
exit 1
fi
rm -f src/parsing/*.txt
if [ "$verbose" = "true" ]; then
lr1="src/parsing/LR1_conflicts.txt"
./bin/gocc -v -o ./src/parsing -p miller/src/parsing src/parsing/mlr.bnf || expand -2 $lr1
$bingocc -v -o ./src/parsing -p miller/src/parsing src/parsing/mlr.bnf || expand -2 $lr1
else
./bin/gocc -o ./src/parsing -p miller/src/parsing src/parsing/mlr.bnf
$bingocc -o ./src/parsing -p miller/src/parsing src/parsing/mlr.bnf
fi
# Code-gen directories:

View file

@ -3,6 +3,7 @@ module miller
go 1.15
require (
github.com/johnkerl/gocc v0.0.0-20210214145925-018e125fd1ee
github.com/goccmack/gocc v0.0.0-20210201103733-1bd198f09019 // indirect
github.com/johnkerl/gocc v0.0.0-20210214145925-018e125fd1ee // indirect
golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf
)

View file

@ -1,3 +1,5 @@
github.com/goccmack/gocc v0.0.0-20210201103733-1bd198f09019 h1:frVuW4LszXD/AjX9dC1y4I+GwTjZMl6153O2mk/lmHo=
github.com/goccmack/gocc v0.0.0-20210201103733-1bd198f09019/go.mod h1:ZjwYs2UwOh6NiluQ1XCoKNLVECdeFf33rrGEZ+IpNq4=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/johnkerl/gocc v0.0.0-20210214145651-3650cede3074 h1:8+mZMwac/qKah1hHAuw1U5I7mqN+uRF+oVZ4ismxcJU=
github.com/johnkerl/gocc v0.0.0-20210214145651-3650cede3074/go.mod h1:6oAcMpl/qp57NgiufLc2bISrDa4q12XciKeOCUqdeoU=

View file

@ -27,18 +27,22 @@ mkdir -p $dir
# ----------------------------------------------------------------
# Run the parser-generator
export GOPATH=$(pwd)
# Build the bin/gocc executable:
go get github.com/goccmack/gocc
#go get github.com/goccmack/gocc
go get github.com/johnkerl/gocc
bingocc="$GOPATH/bin/gocc"
if [ ! -x "$bingocc" ]; then
exit 1
fi
rm -f $dir/*.txt
if [ "$verbose" = "true" ]; then
lr1="$dir/LR1_conflicts.txt"
# The -o specifies the package name within the autogen
bin/gocc -v -o $dir $bnf || expand -2 $lr1
$bingocc -v -o $dir $bnf || expand -2 $lr1
else
bin/gocc -o $dir $bnf
$bingocc -o $dir $bnf
fi
echo "Parser-autogen OK"

View file

@ -4,8 +4,8 @@ import (
"fmt"
"os"
"experimental/lexer"
"experimental/parser"
"src/experimental/lexer"
"src/experimental/parser"
)
func parseOne(input string) {

View file

@ -1,6 +0,0 @@
* Miller dependencies are all in the Go standard library, except a local one:
* `src/github.com/goccmack`
* GOCC lexer/parser code-generator from [github.com/goccmack/gocc](https://github.com/goccmack/gocc):
* This package defines the grammar for Miller's domain-specific language (DSL) for the Miller `put` and `filter` verbs. And, GOCC is a joy to use. :)
* Note on the path: `go get github.com/goccmack/gocc` uses this directory path, and is nice enough to also create `bin/gocc` for me -- so I thought I would just let it continue to do that by using that local path. :)
* I kept this locally so I could source-control it along with Miller and guarantee its stability. It is used on the terms of its open-source license.

View file

@ -7,7 +7,6 @@ TOP OF LIST:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! do go.mod correctly w/ regard to gocc and golang.org/x/term/
o u/tester neaten?
o parser-experiments neaten
i go get github.com/johnkerl/gocc@gocc2x.3
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View file

@ -5,8 +5,7 @@
# Note reg-test/run has FAR more test cases
# ================================================================
# go test -v ./... doesn't work since it triggers unready things in
# src/github.com/goccmack
# go test -v ./... doesn't work since it triggers unready things in ./parser-experiments/.
go test miller/src/types
go test src/dsl/ast_test.go