Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch Parsing Algorithm From Pest(PEG) to LALRPOP(LALR(1)) #303

Merged
merged 47 commits into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
a98b4dc
Added lalrpop dependency and build script.
InsertCreativityHere Oct 4, 2022
f0df17f
Added constructor function for 'Span'.
InsertCreativityHere Oct 4, 2022
05d6389
Removed constructor and add_x functions from grammar elements.
InsertCreativityHere Oct 4, 2022
68306af
Removed Pest parser, Pest preprocessor, and the parent patcher.
InsertCreativityHere Oct 4, 2022
3b84a1b
Passing integers as attribute arguments is a syntax error now.
InsertCreativityHere Oct 5, 2022
8d3b206
Updated the cSpell dictionary.
InsertCreativityHere Oct 5, 2022
0c757f3
Don't need to specify default build script location apparently.
InsertCreativityHere Oct 5, 2022
9b188ce
Everything else.
InsertCreativityHere Oct 17, 2022
757b038
Fixed linter warnings.
InsertCreativityHere Oct 17, 2022
e3048e2
Fixed doc comment link.
InsertCreativityHere Oct 17, 2022
31c62e3
More linter/formatting fixes.
InsertCreativityHere Oct 17, 2022
59f1e91
Ran nightly rustfmt
ReeceHumphreys Oct 18, 2022
a610c1a
Remove useless borrow
InsertCreativityHere Oct 18, 2022
915b5f5
Removed unnecessary 'use' for 'Debug'.
InsertCreativityHere Oct 18, 2022
528bb08
Swapped words to reflect source order.
InsertCreativityHere Oct 18, 2022
b2101ac
Added TODO
InsertCreativityHere Oct 18, 2022
d78cc1e
Added TODO
InsertCreativityHere Oct 18, 2022
6c260ed
Removed lexing support for the period '.'
InsertCreativityHere Oct 18, 2022
7680899
Fixed error message for implicit enumerator overflow.
InsertCreativityHere Oct 18, 2022
262f611
Added space
InsertCreativityHere Oct 18, 2022
1bfa141
Removed extra 's'.
InsertCreativityHere Oct 18, 2022
02ead77
Fixed preprocessor identifiers must start with non-numeric.
InsertCreativityHere Oct 18, 2022
a7968a9
Renamed 'UTF8 codepoints' to 'characters'.
InsertCreativityHere Oct 18, 2022
2168225
Simplified test comparison.
InsertCreativityHere Oct 18, 2022
1126bed
Moved 'expected' to 'assert' section of 'invalid_encodings_fail'.
InsertCreativityHere Oct 18, 2022
edc965d
Tweaked a comment
InsertCreativityHere Oct 18, 2022
c32c86a
Simplified preprocessor lexer comment.
InsertCreativityHere Oct 18, 2022
ead1983
Fix
InsertCreativityHere Oct 18, 2022
1c8d51c
Removed unneeded linter allow
InsertCreativityHere Oct 18, 2022
9a8d4c5
Added a space
InsertCreativityHere Oct 18, 2022
43782c1
Fixed bogus use ordering.
InsertCreativityHere Oct 19, 2022
b852c29
Removed pre-emptive error handling for struct inheritance.
InsertCreativityHere Oct 19, 2022
98be894
Controversial changes.
InsertCreativityHere Oct 19, 2022
9e46dae
Renamed 'set_file_encoding' to 'handle_file_encoding'
InsertCreativityHere Oct 19, 2022
f48e976
Consolidated comment for 'add_definition_to_module'.
InsertCreativityHere Oct 19, 2022
84f1381
Backticks instead of parentheses
InsertCreativityHere Oct 20, 2022
f69b0e9
Merge remote-tracking branch 'origin/main' into lalrpop-real
ReeceHumphreys Oct 21, 2022
c0a3a59
Bogus inheritance is just a normal syntax error now.
InsertCreativityHere Oct 24, 2022
487473d
Removed support for explicit '+' integers.
InsertCreativityHere Oct 24, 2022
bfafdcf
Added issue tracking to a comment.
InsertCreativityHere Oct 24, 2022
e74b163
Merge branch 'main' into lalrpop-real
InsertCreativityHere Oct 24, 2022
11164ae
Unadded issue tracking to a comment...
InsertCreativityHere Oct 24, 2022
94582f4
Fixed formatting of new errors.
InsertCreativityHere Oct 24, 2022
60a5a71
Apply rustfmt changes
ReeceHumphreys Oct 24, 2022
23dab6b
Revert "Apply rustfmt changes"
InsertCreativityHere Oct 24, 2022
66335ec
Type parameters must go after tag/stream keyword now.
InsertCreativityHere Oct 24, 2022
2d22d4e
Made the preprocessor case-SENSATIVE.
InsertCreativityHere Oct 24, 2022
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
8 changes: 5 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
{
"cSpell.words": [
"clippy",
"codepoints",
"Commentable",
"dedup",
"downcasted",
"downcasting",
"elif",
"encodable",
"grcov",
"lalrpop",
"nonstreamed",
"prec",
"peekable",
"rsplit",
"RUSTDOCFLAGS",
"rustup",
"slicec",
"struct",
"subtoken",
"subtokens",
"tokenizes",
"typealias",
"typeref",
"uncasted",
"unpatchable",
"unprefixed",
"Unsize",
"upcasting",
"userdata",
"varint",
"varuint"
],
Expand Down
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,18 @@ edition = "2021"
clap = { version = "4.0.5", features = ["derive"] }
console = "0.15.1"
convert_case = "0.5.0"
lalrpop-util = "0.19.8"
pest = "=2.3.0"
pest_consume = "=1.1.3"
pest_derive = "=2.3.0"
# derive feature allows structs to derive Serialize automatically
serde = { version="1.0.144", features = ["derive"] }
serde_json = "1.0.85"

[build-dependencies]
# The default features enable a built-in lexer. We supply our own lexer so we don't need these.
lalrpop = { version = "0.19.8", default-features = false }

[dev-dependencies]
test-case = "2.0.2"

Expand Down
8 changes: 8 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright (c) ZeroC, Inc. All rights reserved.

extern crate lalrpop;

fn main() {
// Recursively finds any files ending with `.lalrpop` in the `src` directory and generates parsers from them.
lalrpop::process_root().unwrap();
externl marked this conversation as resolved.
Show resolved Hide resolved
ReeceHumphreys marked this conversation as resolved.
Show resolved Hide resolved
}
1 change: 0 additions & 1 deletion src/ast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use std::convert::{TryFrom, TryInto};
///
/// This function fails fast, so if any phase of patching fails, we skip any remaining phases.
pub(crate) unsafe fn patch_ast(mut parsed_data: ParsedData) -> ParserResult {
patchers::parent_patcher::patch_ast(&mut parsed_data.ast); // TODO remove this when we switch to LALRpop
parsed_data = patchers::type_ref_patcher::patch_ast(parsed_data)?;
parsed_data = patchers::encoding_patcher::patch_ast(parsed_data)?;

Expand Down
1 change: 0 additions & 1 deletion src/ast/patchers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@
//! TODO write a doc comment for the module.

pub mod encoding_patcher;
pub mod parent_patcher; // TODO remove this when we switch to LALRpop.
pub mod type_ref_patcher;
169 changes: 0 additions & 169 deletions src/ast/patchers/parent_patcher.rs

This file was deleted.

Loading