-
Notifications
You must be signed in to change notification settings - Fork 0
007 inline record notation #9
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
Conversation
…terals, incorporating gram's parser for 1:1 correspondence, and adopting gram's value types for consistency
…idating compatibility of megaparsec compiler
|
You have run out of free Bugbot PR reviews for this billing cycle. This will reset on February 15. To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR migrates Pattern Lisp’s core data/value model to use gram-compatible record and value types, replaces the old map syntax with inline record notation, and wires records through the parser, evaluator, codec, REPL display, tests, and docs. It also introduces quasiquotation support for records and validates compatibility with gram serialization.
Changes:
- Refactors
ValueandExpr(e.g.,VNumber→VInteger,VList→VArray,MapLiteral→RecordLiteral, addsUnquote/UnquoteSplice) and updates evaluation, primitives, and codec logic to operate on gram-style records (VMap (Map String Value)withStringkeys). - Extends the parser with array and record literals, gram-like booleans (
true/false), and record quasiquotation support; adds extensive tests for records, record operations, quasiquotation, and gram compatibility. - Updates the REPL and CLI formatting, examples, and documentation to present and explain records as the core key-value data structure, including a new records example file and a detailed spec/plan for the feature.
Reviewed changes
Copilot reviewed 37 out of 37 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/Spec.hs | Wires new PatternLisp.RecordGramCompatibilitySpec into the test suite. |
| test/REPLSpec.hs | Aligns REPL type formatting and output expectations with VInteger, VBoolean, and VArray. |
| test/Properties.hs | Updates property generators and helpers to use VInteger, VBoolean, VArray, and records keyed by String instead of MapKey. |
| test/PatternLisp/RecordGramCompatibilitySpec.hs | Adds comprehensive tests validating record parsing/eval against gram serialization and quasiquotation edge cases. |
| test/PatternLisp/PrimitivesSpec.hs | Rewrites numeric, boolean, set, and map tests for the new Value constructors and adds a large suite of record operation and performance tests. |
| test/PatternLisp/PatternSpec.hs | Adjusts pattern-related tests to the new string and array representations (VString String, VArray). |
| test/PatternLisp/ParserSpec.hs | Replaces map tests with record tests, switches booleans to true/false, and validates record-specific parse errors and splice parsing. |
| test/PatternLisp/GramSpec.hs | Updates Gram serialization tests to the new Value constructors (VInteger, VBoolean, VArray). |
| test/PatternLisp/GramSerializationSpec.hs | Refactors round-trip tests to use the new Value API and adds coverage for closures/environments under the new types. |
| test/PatternLisp/EvalSpec.hs | Aligns core language, map/record, keyword, and pattern tests with the new value and record semantics, including record quasiquotation and edge cases. |
| test/PatternLisp/CodecSpec.hs | Updates codec round-trip tests to the gram-style value constructors and string representation, including maps-as-records. |
| test/IntegrationSpec.hs | Adjusts integration tests to expect VInteger results for arithmetic and conditionals. |
| test/ExamplesSpec.hs | Updates example expectations from VList/VNumber to VArray/VInteger. |
| src/PatternLisp/Syntax.hs | Redefines Atom and Value around gram types, removes MapKey/KeywordKey, introduces RecordLiteral, array literals, and a richer Primitive set for records, and wires name lookup for new primitives. |
| src/PatternLisp/Primitives.hs | Registers the new record-related primitives and updates the initial environment accordingly. |
| src/PatternLisp/PatternPrimitives.hs | Adjusts pattern utilities to use VArray instead of VList, and updates valueToPatternSubject for the new list representation. |
| src/PatternLisp/Parser.hs | Replaces map parsing with a Megaparsec-based record parser, adds array parsing, gram-like booleans, and a quasiquote parser emitting Unquote/UnquoteSplice for record contents. |
| src/PatternLisp/Eval.hs | Reworks evaluation for the new Value/Expr constructors, adds record literal evaluation (including unquote/splice handling), and defines all record primitives (record?, get, has?, keys, values, record->alist, alist->record, assoc, dissoc, merge, map, filter). |
| src/PatternLisp/Codec.hs | Aligns value<->subject and expression<->pattern conversions with gram value types, simplifies map/record handling to String keys, and extends support for additional gram value constructors. |
| specs/007-inline-record-notation/* | Introduces a full spec, plan, data model, research, schema analysis, contracts, and checklists that define and justify the record refactoring and its gram alignment. |
| pattern-lisp.cabal | Adds the new record/gram compatibility spec and the gram library dependency to the test suite. |
| examples/records.plisp | New example file showing record creation, operations, quasiquotation, and realistic record use cases. |
| examples/pattern-predicates.plisp | Updates comments and examples to use true/false rather than #t/#f. |
| examples/README.md | Documents the new records.plisp example and summarizes its coverage. |
| docs/pattern-lisp-syntax-conventions.md | Replaces the “Maps” section with a detailed “Records” section, updating syntax/semantics to comma-separated gram-style records and record operations. |
| app/Main.hs | Updates CLI value rendering and type display to the new Value constructors and adds sensible formatting for records, sets, and other gram types. |
| README.md | Mentions records (with arrays and sets) as core data structures in Pattern Lisp. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This pull request introduces comprehensive support for records (immutable key-value structures) in Pattern Lisp, replacing the previous map syntax with a gram-compatible, comma-separated inline record notation. The changes update documentation, code, and examples to reflect this new record system, including syntax, operations, and compatibility with gram notation.
Documentation and Syntax Updates:
docs/pattern-lisp-records.md).docs/pattern-lisp-syntax-conventions.md). [1] [2] [3] [4]Codebase and Example Enhancements:
app/Main.hsto support new record types (VMap) and related value types, ensuring correct display and type reporting for records and their contents.examples/README.md.Project and Feature Plan Updates:
.cursor/rules/specify-rules.mdc). [1] [2]Other Improvements:
examples/pattern-predicates.plisp). [1] [2]