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

Reject ungrounded productions #382

Merged
merged 3 commits into from
Sep 22, 2023
Merged

Reject ungrounded productions #382

merged 3 commits into from
Sep 22, 2023

Commits on Sep 14, 2023

  1. Reject ungrounded productions

    Soar experts would never (on purpose) write something like:
    
        sp { propose*foo
           (state <s>)
           (<s> -^results <any>)
           -->
           (<s> ^operator <o> + =)
           (<o> ^name do-foo)
        }
    
    Notice the missing `^superstate` or `^type` test. However, Soar has always
    accepted these, at least since I've been using it. Under the hood, Soar will add
    attribute-value tests where it thinks it's obvious that they belong, and `state/
    impasse` is one of those places. The above production becomes:
    
        sp {propose*foo
           (state <s> ^<a*1> <v*1> -^results <any>)
           -->
           (<s> ^operator <o> + ^operator <o> =)
           (<o> ^name do-foo)
        }
    
    The `^<a*1> <v*1>` match all top-state attributes, so this production proposes
    6 operators at present time.
    
    I found this confusing when first learning Soar (and when trying to pick it up
    again!), and I spent many hours on my Soar parsers trying to figure out what the
    correct grammar rule was, since the grammar in the manual also doesn't specify
    that the tests can be implied here.
    
    CIC Soar experts believe that this production syntax is just wrong, and I agree,
    so disallow it and add a friendly message to remind users to add a positive
    test. This requires two changes:
    
    1. Signal from `parse_head_of_conds_for_one_id` that the parsed condition is a
    state or impasse, and
    2. using this signal in `parse_tail_of_conds_for_one_id`, refuse to generate
    default attribute-value tests for states and impasses.
    
    Add unit tests to check that various forms of `(state ...)` do or do not
    successfully parse.
    
    Fixes #377. Also fixes #378, although I don't know what the root cause was
    there, so we might just be hiding the real issue.
    garfieldnate committed Sep 14, 2023
    Configuration menu
    Copy the full SHA
    8108f9c View commit details
    Browse the repository at this point in the history
  2. improve invalid prod. diagnostics, untangle ebc

    It seems like the reording logic may have lived in ebc at one time, though I
    can't be sure about that. The logic that checks and warns for ungrounded
    productions generated warnings related to chunking and used chunking trace
    settings, even though it's fully possible to trigger these from regular `sp`
    commands (and there is an additional call in RL, as well).
    
    Move all of the chunking-related warnings and settings back to ebc. Instead of
    setting `m_failure_type` on the agent's chunking manager, return the error code
    from `reorder_and_validate_lhs_and_rhs` and check that in ebc to trigger logging
    and agent stopping logic. Place the logic moved there into a new dedicated
    method. Update other consumers of this method to check for `reorder_success`
    instead of `true`, as well.
    
    Put the reorder failure logging behind `OM_WARNINGS`, which is on by default and
    is (correctly) not specific to chunking/ebc.
    
    Rename `EBCFailureType` and `display_ebc_error` to reflect that fact that they
    they aren't chunking-specific.
    
    Update unit tests to check the warnings printed for ungrounded productions.
    garfieldnate committed Sep 14, 2023
    Configuration menu
    Copy the full SHA
    211c189 View commit details
    Browse the repository at this point in the history

Commits on Sep 18, 2023

  1. clarifying tests

    Add additional ways to test the state/impasse legally, just to clarify what's
    allowed vs. what's not.
    
    Better differentiate each of the production names. Even though it's unnecessary
    for the test to function, it makes discussion easier.
    garfieldnate committed Sep 18, 2023
    Configuration menu
    Copy the full SHA
    3c0fb91 View commit details
    Browse the repository at this point in the history