Skip to content

Instantly share code, notes, and snippets.

@ruv
Last active September 9, 2022 05:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ruv/e37551fbff9262e64479fd7da5de93e5 to your computer and use it in GitHub Desktop.
Save ruv/e37551fbff9262e64479fd7da5de93e5 to your computer and use it in GitHub Desktop.
Unnecessary coupling between the outer loop and Recognizer API

In following to the comment:

  1. It introduces unnecessary coupling between the Forth text interpreter loop and the Recognizer API.

An illustration of this idea:

    ┌──────────────┐
    │ Outer Loop   │          mode
    │              │─────────────────────┐
    └──────────────┘                     │
            ↑                            │
            │                            │
        ┌──────┐                         │
        │ mode │                         │
        └──────┘                         │
            ↑                            ↓
            │                       ┌─────────────────────────┐
        ┌────────────────┐          │ Words that analyze mode │
        │ Words that     │          │ - token translators     │
        │ change mode    │          │                         │
        │                │          │ tt-nt tt-lit ...        │
        │ [ ] : ; ...    │          │                         │
        └────────────────┘          └─────────────────────────┘

Why should the Outer loop pass the current mode between that blocks?

It should not:

    ┌──────────────┐
    │ Outer Loop   │
    │              │
    └──────────────┘                                                            



                                    ┌─────────────────────────┐
        ┌────────────────┐          │ Words that analyze mode │
        │ Words that     │          │ - token translators     │
        │ change mode    │          │                         │
        │                │          │ tt-nt tt-lit ...        │
        │ [ ] : ; ...    │          │                         │
        └────────────────┘          └─────────────────────────┘
                   ↓                           ↑
                   │                           │
                   │        ┌──────┐           │
                   └────────┤ mode ├───────────┘
                            └──────┘
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment