Skip to content

Parser using nested scopes #45

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

Draft
wants to merge 112 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
8df238c
Stub module for parsing
istathar Sep 16, 2024
48a0ae9
Add pest dependency
istathar Sep 16, 2024
1e440ea
Grammar for procedure declaration
istathar Sep 16, 2024
5fb162a
Type is a reserved word so call types typas
istathar Sep 16, 2024
163c33b
Handle multiple types in domain
istathar Sep 16, 2024
024a6d0
Add parser test using macro
istathar Sep 16, 2024
31b2873
Rename type again, to forma
istathar Sep 19, 2024
c2ae2e8
Pass input file to parser when checking
istathar Sep 19, 2024
35ca520
Grammar for header lines in a Technique file
istathar Sep 19, 2024
9a7abaa
Reconsider place of newlines in grammar
istathar Sep 19, 2024
2132ef4
Test copyright string on spdx line
istathar Sep 20, 2024
08d1e04
Grammar for template line in header
istathar Sep 20, 2024
73a2427
Additional year tests
istathar Sep 20, 2024
900077e
Additional license tests
istathar Sep 20, 2024
e7da2c1
Test identifiers and declarations
istathar Sep 20, 2024
8f59595
Add winnow parser dependency
istathar Sep 23, 2024
df2cbea
Reimplement identifier parser
istathar Sep 25, 2024
47ce870
Improve parse_identifier to enforce first character
istathar Sep 26, 2024
61502e2
Use verify to ensure identifier parse is valid
istathar Sep 28, 2024
244a9db
Add chumsky parser dependency
istathar Sep 30, 2024
bb5d9ff
Reimplement identifier parser again
istathar Sep 30, 2024
33aa001
Parse magic line
istathar Sep 30, 2024
b32204d
Parse license and copyright header parts
istathar Sep 30, 2024
f15e592
Complete SPDX header line parser
istathar Oct 1, 2024
410cdcc
Parse template line
istathar Oct 3, 2024
a7669de
Add lalrpop parser dependency
istathar Oct 3, 2024
1fd1ae7
Setup
istathar Oct 3, 2024
3e6bc27
Parse identifiers
istathar Oct 3, 2024
476055b
Parse magic line
istathar Oct 3, 2024
5a1c45d
Redo lexer declaration with match
istathar Oct 4, 2024
f4b7a24
Parse SPDX header line
istathar Oct 4, 2024
2c48be2
Remove previous parser code
istathar Oct 4, 2024
bbd7c9e
Validate identifiers in parser helper rather than tokenizer
istathar Oct 4, 2024
35cf366
Create an adapter trait to simplify error handling
istathar Oct 4, 2024
c854cd0
Different error for validation failure due to empty input
istathar Oct 4, 2024
070ca07
Begin moving Technique language definition to library
istathar Oct 6, 2024
c4de661
Remove obscelete files
istathar Oct 10, 2024
58b21e6
Parse template header line
istathar Oct 10, 2024
3d796f3
Ignore rendered source code files
istathar Oct 12, 2024
0061030
Re-export symbols
istathar Oct 12, 2024
57715b6
Optional values returned from SPDX header
istathar Oct 12, 2024
e27291c
Optional value from template header
istathar Oct 12, 2024
d75b901
Begin parsing full headers to internal types
istathar Oct 12, 2024
548e166
Define validation for Forma
istathar Oct 14, 2024
e71b900
To owned string directly
istathar Oct 15, 2024
8d06de3
Parse delaration and Signature as declaration line
istathar Oct 15, 2024
a1103a9
Parse attribute line
istathar Oct 15, 2024
5df43e0
Update attribute to a list
istathar Oct 21, 2024
45dc6ce
Use parsed license and copyright
istathar Oct 30, 2024
291b5b7
Add template line to top-level struct
istathar Oct 30, 2024
dd02cb9
Verify parse of a complete Technique header
istathar Oct 30, 2024
39d1f71
Cleanup old tests
istathar Oct 30, 2024
81f0acc
Convert Forma to strong type and introduce Genus
istathar Nov 2, 2024
4c29b41
Add regex dependency
istathar Nov 12, 2024
d75b3a5
Test validation directly
istathar Nov 12, 2024
856a987
Express identifier parser using regex
istathar Nov 12, 2024
c12d77e
Parse magic line using regex
istathar Nov 12, 2024
d5f9a26
Begin parsing and validating SPDX line
istathar Nov 12, 2024
3e3d302
Only need to match in validating functions
istathar Nov 12, 2024
ba38ff9
Implement parsing of SPDX lines
istathar Nov 13, 2024
679ed04
Complete tests for license and copyright in SPDX headers
istathar Nov 13, 2024
6d75362
Implement parsing of template lines
istathar Nov 13, 2024
9ec6cbd
Begin implementing composite parser for Technique header
istathar Nov 17, 2024
54087f0
Begin using lifetime parameter for data in AST
istathar Nov 17, 2024
e20061f
Add lifetime parameters to all structs in AST
istathar Nov 17, 2024
a4d2ace
Add tests to language AST types
istathar Nov 30, 2024
5efcc6d
Initial conversion to stateful parser
istathar Nov 30, 2024
70efde4
Move SPDX handling to Parser
istathar Dec 7, 2024
3a3382a
Move template handling to Parser
istathar Dec 7, 2024
f55b0cc
Use correct offset to advance parser state
istathar Dec 7, 2024
f13589c
Temporarily output result of parsing when running check
istathar Dec 8, 2024
9504b49
Move identifier validation to types module
istathar Dec 8, 2024
03b6a98
Move header field validations to types module
istathar Dec 8, 2024
9a23d4a
Rename to ParsingError and add From instance for ValidationError
istathar Dec 9, 2024
55839db
Move forma validation to types module
istathar Dec 9, 2024
165cd97
Correct logic in SPDX parser
istathar Feb 9, 2025
8726c50
Consume newlines and correctly handle template header
istathar Feb 9, 2025
10e4a27
Remove lalrpop dependency
istathar Feb 9, 2025
86c1b35
Remove lalrpop build wrapper
istathar Feb 11, 2025
60ffcac
Hide internal module structure
istathar May 17, 2025
529f4e7
No need to slice [0,1] before calling .chars()
istathar May 17, 2025
2c15ecf
Stubs for parsing procedure declarations
istathar May 19, 2025
f632091
Articulate layers to use as scopes
istathar May 21, 2025
d4a3313
Begin implementing wrappers around scope stack
istathar May 26, 2025
ba22ca1
Preliminary push and pop operations
istathar May 26, 2025
436d6a9
Pop back to Blank even if empty
istathar May 29, 2025
1fde0e6
Add reset() method to Scope and test for state transitions
istathar Jun 1, 2025
5eb2c5b
Remove Blank layer and use Technique as base state
istathar Jun 1, 2025
61042db
Return layers as a sorted list of tags
istathar Jun 1, 2025
bb91b02
Begin parsing from start
istathar Jun 2, 2025
65c2a35
Rename tests modules and functions to improve namespace paths
istathar Jun 4, 2025
758cc0f
Rename header struct to Metadata to create room for actual top-level
istathar Jun 4, 2025
29194d7
New top-level Technique struct
istathar Jun 5, 2025
d5e902f
Implement intermediate parser for Forma
istathar Jun 5, 2025
3760e91
Implement intermediate parser for Genus tuple variant
istathar Jun 15, 2025
77c4cf4
Add helper functions trim whitespace
istathar Jun 15, 2025
6469e5e
Re-organize Genus parsing code
istathar Jun 15, 2025
ee23087
Parse Forma out of a tuple Genus
istathar Jun 15, 2025
3211d6d
Initial handling of a unit type as a Genus
istathar Jun 15, 2025
dca981f
Ensure parsed characters consumed from input
istathar Jun 16, 2025
73da1b3
Separate test for unit Genus
istathar Jun 16, 2025
f4d968b
Upgrade Identifier to tuple struct
istathar Jun 16, 2025
263d404
Upgrade Forma and Attribute to tuple structs
istathar Jun 16, 2025
35e4ded
Fix missing offset update
istathar Jun 16, 2025
3ed609b
Move Genus parsing logic to validate_genus() in types
istathar Jun 16, 2025
c66c3ef
Implement Signature parsing
istathar Jun 16, 2025
0d9708c
Remove ununsed code
istathar Jun 17, 2025
0f528a5
Add test cases for Procedure declarations
istathar Jun 17, 2025
13a0587
Avoid warning
istathar Jun 20, 2025
d9b58f7
Separate Forma and Genus tests
istathar Jun 20, 2025
3254ae1
Significant refactoring to nested parsers
istathar Jun 20, 2025
42e5fa3
Add try_using_regex() for Optional matches
istathar Jun 30, 2025
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: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
/.vscode
/target

# rendered code fragments
/*.pdf
41 changes: 40 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ license = "MIT"

[dependencies]
clap = { version = "4.5.16", features = [ "wrap_help" ] }
regex = "1.11.1"
serde = { version = "1.0.209", features = [ "derive" ] }
tinytemplate = "1.2.1"
tracing = "0.1.40"
tracing-subscriber = "0.3.18"

[build-dependencies]
6 changes: 6 additions & 0 deletions src/language/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Types representing the Technique procedures language

mod types;

// Re-export all public symbols
pub use types::*;
Loading