Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion LeanParserGenerator/LSP/Server.lean
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ so it is unit-tested independently of this transport layer.
public import Lean.Data.Lsp
public import Lean.Data.JsonRpc
public import LeanParserGenerator.Frontend.Diagnostics
public import LeanParserGenerator.Version


@[expose] public section
Expand Down Expand Up @@ -108,7 +109,7 @@ def initializeResult : Json :=
]),
("serverInfo", Json.mkObj [
("name", Json.str "lig-language-server"),
("version", Json.str "0.1.0-alpha.2")
("version", Json.str LeanParserGenerator.toolVersion)
])
]

Expand Down
27 changes: 27 additions & 0 deletions LeanParserGenerator/Version.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/-
Copyright Cedar Contributors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-/

module

@[expose] public section

namespace LeanParserGenerator

/-- The release version, printed by `leanparsergenerator --version` and reported by the
language server. It must equal `version` in `lakefile.lean`; `cli-test` checks that. -/
def toolVersion : String := "0.1.0-alpha.2"

end LeanParserGenerator
4 changes: 2 additions & 2 deletions Main.lean
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ public import LeanParserGenerator.Emit.CodegenLexerRoundtrip
public import LeanParserGenerator.Emit.CodegenParserRoundtrip
public import LeanParserGenerator.Frontend.File
public import LeanParserGenerator.Frontend.Diagnostics
public import LeanParserGenerator.Version


public section

open Frontend Emit Construct

/-- The release version. Keep in sync with `version` in `lakefile.lean`. -/
def toolVersion : String := "0.1.0-alpha.2"
open LeanParserGenerator (toolVersion)

inductive GrammarViewFormat where
| bnf
Expand Down
8 changes: 7 additions & 1 deletion docs/INTEGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,13 @@ lake build generatedExprParser
lake build
```

Use the same two commands in a clean CI checkout. Later `lake build` calls
Use the same two commands in a clean CI checkout, and also after moving the
`LeanParserGenerator` dependency to a new revision, even when the generated files are
committed. Lake reads the source and imports of each module before the
`generatedExprParser` job rewrites them. If the new generator emits modules that import
a runtime module the old ones did not, a single `lake build` fails with a missing
`.olean`, and a module whose content changed can be left unchecked until the next
build. Building the generation target first avoids both. Later `lake build` calls
regenerate the modules whenever the `.lig` file or the generator executable is
newer. Exit code `2` means that Pager reported LR(1) conflicts after writing the
outputs. The example treats it as a build failure, so a conflicted parser is never
Expand Down
1 change: 1 addition & 0 deletions lakefile.lean
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ expose semireducible class-field projections.
The `weak.` prefix is required because linter options are registered after Lake
startup. -/
package «LeanParserGenerator» where
-- Keep equal to `toolVersion` in LeanParserGenerator/Version.lean (`cli-test` checks it).
version := v!"0.1.0-alpha.2"
description := "A generator of validated LR(1) parsers in Lean"
keywords := #["parser", "parser-generator", "lr1", "verification"]
Expand Down
7 changes: 7 additions & 0 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ generator, or any output is newer/missing. Grammars with a `%lexer` block
(`calc`, `cedar`, `cedarschema`, `cedarentities`, `asm`, `spanuse`, `rustactions`)
generate a lexer module too, in the same invocation.

After a change to the generator, also run `lake build parsers heavyParsers` before
building any other target. Lake reads the source and imports of a module before the
`needs` job of its library rewrites the file, so a single `lake build VerifiedHeavy`
can regenerate `C99Verified.lean` and still finish without checking the new file, and a
regenerated module that imports a new runtime module fails with a missing `.olean`. A
second build, or regenerating first, picks up the new files.

To proof-check the dependent specification (`*Verified`) modules, prefer the
caching `lean_lib`s over `lake env lean test/<g>/<G>Verified.lean`. The non-heavy
specs of calc, imp, cedar, cedarschema, cedarentities and rustactions are rooted in
Expand Down