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
2 changes: 1 addition & 1 deletion lexer/moon.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "moonbitlang/lexer"

version = "0.4.1"
version = "0.4.2"

repository = "https://github.com/moonbitlang/parser"

Expand Down
6 changes: 3 additions & 3 deletions moon.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name = "moonbitlang/parser"

version = "0.4.2"
version = "0.4.3"

import {
"moonbitlang/x@0.5.1",
"moonbitlang/lexer@0.4.1",
"moonbitlang/moon_config@0.4.1",
"moonbitlang/lexer@0.4.2",
"moonbitlang/moon_config@0.4.2",
"moonbitlang/async@0.22.4",
"moonbit-community/prettyprinter@0.4.10",
}
Expand Down
4 changes: 2 additions & 2 deletions moon_config/moon.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name = "moonbitlang/moon_config"

version = "0.4.1"
version = "0.4.2"

import {
"moonbitlang/lexer@0.4.1",
"moonbitlang/lexer@0.4.2",
}

repository = "https://github.com/moonbitlang/parser"
Expand Down
21 changes: 9 additions & 12 deletions untyped_cst/README.mbt.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ root kind returns a diagnostic.
## Node Model

The source-independent node model lives in
`moonbitlang/parser/untyped_cst/internal/node`. MoonBit restricts imports of
this package to `untyped_cst` and its subpackages. Code within that subtree can
use `CstNode`, `NodeKind`, `NodePayload`, and the node traversal, payload, and
classification helpers.
`moonbitlang/parser/untyped_cst/node`. Code can use `CstNode`, `NodeKind`,
`NodePayload`, and the node traversal, payload, and classification helpers.

`NodeKind` is public but read-only outside the node package. Inspect it with
pattern matching or its classification methods. Construct nodes with the
Expand Down Expand Up @@ -64,19 +62,18 @@ Nodes retain `loc` and `source_span`; there are no additional location children.
AST locations are computed during lowering from tokens and syntax boundaries,
without reading source text or re-parsing it.

The `untyped_cst` package re-exports the three node types for in-subtree code.
MoonBit's internal visibility rules prevent outside packages from inspecting
or constructing these types through the re-exports. Outside callers can use
`ParseResult::diagnostics_view`, `ParseResult::to_impls`, and
`ParseResult::to_expr`.
The `untyped_cst` package re-exports the three node types. Callers that need
constructors or helpers can import `untyped_cst/node` directly; callers that
only parse and lower source can use `ParseResult::diagnostics_view`,
`ParseResult::to_impls`, and `ParseResult::to_expr` from `untyped_cst`.

## Package Organization

`untyped_cst` owns the public parsing entry points and `ParseResult`, including
its AST conversion methods. Implementation details live in four internal
packages:
its AST conversion methods. The node model is a public subpackage, while the
remaining implementation details live in three internal packages:

- `internal/node` defines CST nodes and their constructors and helpers.
- `node` defines CST nodes and their constructors and helpers.
- `internal/construction` builds CST nodes and their semantic children.
- `internal/parser` handles token streams, parsing, and error recovery.
- `internal/lower` converts CST nodes to the syntax AST and attaches docstrings.
Expand Down
2 changes: 1 addition & 1 deletion untyped_cst/internal/construction/moon.pkg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
"moonbitlang/lexer/tokens",
"moonbitlang/lexer/basic",
"moonbitlang/parser/untyped_cst/internal/node",
"moonbitlang/parser/untyped_cst/node",
"moonbitlang/parser/syntax",
}

Expand Down
2 changes: 1 addition & 1 deletion untyped_cst/internal/construction/pkg.generated.mbti
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package "moonbitlang/parser/untyped_cst/internal/construction"
import {
"moonbitlang/lexer/basic",
"moonbitlang/lexer/tokens",
"moonbitlang/parser/untyped_cst/internal/node",
"moonbitlang/parser/untyped_cst/node",
}

// Values
Expand Down
2 changes: 1 addition & 1 deletion untyped_cst/internal/lower/moon.pkg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
"moonbitlang/lexer/tokens",
"moonbitlang/lexer/basic",
"moonbitlang/parser/untyped_cst/internal/node",
"moonbitlang/parser/untyped_cst/node",
"moonbitlang/parser/syntax",
"moonbitlang/parser/attribute",
"moonbitlang/core/list",
Expand Down
2 changes: 1 addition & 1 deletion untyped_cst/internal/lower/pkg.generated.mbti
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
"moonbitlang/lexer/basic",
"moonbitlang/lexer/tokens",
"moonbitlang/parser/syntax",
"moonbitlang/parser/untyped_cst/internal/node",
"moonbitlang/parser/untyped_cst/node",
}

// Values
Expand Down
2 changes: 1 addition & 1 deletion untyped_cst/internal/parser/moon.pkg
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
"moonbitlang/lexer",
"moonbitlang/lexer/tokens",
"moonbitlang/lexer/basic",
"moonbitlang/parser/untyped_cst/internal/node",
"moonbitlang/parser/untyped_cst/node",
"moonbitlang/parser/untyped_cst/internal/construction",
"moonbitlang/parser/untyped_cst/internal/parser/parserstate",
"moonbitlang/core/list",
Expand Down
2 changes: 1 addition & 1 deletion untyped_cst/internal/parser/parserstate/moon.pkg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
"moonbitlang/lexer/tokens",
"moonbitlang/lexer/basic",
"moonbitlang/parser/untyped_cst/internal/node",
"moonbitlang/parser/untyped_cst/node",
"moonbitlang/parser/untyped_cst/internal/construction",
}

Expand Down
2 changes: 1 addition & 1 deletion untyped_cst/internal/parser/parserstate/pkg.generated.mbti
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package "moonbitlang/parser/untyped_cst/internal/parser/parserstate"
import {
"moonbitlang/lexer/basic",
"moonbitlang/lexer/tokens",
"moonbitlang/parser/untyped_cst/internal/node",
"moonbitlang/parser/untyped_cst/node",
}

// Values
Expand Down
2 changes: 1 addition & 1 deletion untyped_cst/internal/parser/pkg.generated.mbti
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
"moonbitlang/core/list",
"moonbitlang/lexer/basic",
"moonbitlang/lexer/tokens",
"moonbitlang/parser/untyped_cst/internal/node",
"moonbitlang/parser/untyped_cst/node",
}

// Values
Expand Down
2 changes: 1 addition & 1 deletion untyped_cst/moon.pkg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
"moonbitlang/lexer/tokens",
"moonbitlang/lexer/basic",
"moonbitlang/parser/untyped_cst/internal/node",
"moonbitlang/parser/untyped_cst/node",
"moonbitlang/parser/untyped_cst/internal/parser" @cst_parser,
"moonbitlang/parser/untyped_cst/internal/lower",
"moonbitlang/parser/syntax",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated using `moon info`, DON'T EDIT IT
package "moonbitlang/parser/untyped_cst/internal/node"
package "moonbitlang/parser/untyped_cst/node"

import {
"moonbitlang/core/debug",
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion untyped_cst/pkg.generated.mbti
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
"moonbitlang/lexer/basic",
"moonbitlang/lexer/tokens",
"moonbitlang/parser/syntax",
"moonbitlang/parser/untyped_cst/internal/node",
"moonbitlang/parser/untyped_cst/node",
}

// Values
Expand Down
Loading