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

Eliminating of some ambiguous conditions #2

Open
2 of 25 tasks
ruv opened this issue Sep 8, 2022 · 0 comments
Open
2 of 25 tasks

Eliminating of some ambiguous conditions #2

ruv opened this issue Sep 8, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@ruv
Copy link
Collaborator

ruv commented Sep 8, 2022

A list of ambiguous conditions that are considered as candidates to convert them into an unambiguous exceptions with assigned throw codes (see also #1) should be developed.

Note: the corresponding new test cases should be also added, if possible.

The list of ambiguous condition is provided in the section 4.1.2 Ambiguous conditions.

The list below is under construction, it will be updated right here.

Mandatory

  • specify behavior for 17.6.1.0245 /STRING when n > u1 (an implicit ambiguous condition exists at the moment);
  • An ambiguous condition exists if ud overflows during the conversion (6.1.0570 >NUMBER);
    • see also 4.1.2 Ambiguous conditions / "producing a result out of range";
    • possible options:
      • throw -11 "result out of range" (then >number must be execute by catch in recognizers);
      • stop on the digit that produces overflow (it is allowed due to the ambiguous condition);
  • a name is not found and not a number;
    • throw code -13 "undefined word";
    • todo: a lexeme it not recognized;
    • it should be integrated into 3.4.2 Finding definition names, to avoid repeating it in many glossary entries (?);
  • a definition name too long (6.1.0450 :, 15.6.2.2264 SYNONYM, and other defining words);
    • throw code -19 "definition name too long";
  • a parsed lexeme does not fit a transient region (6.1.2450 WORD, see also 3.3.3.6 Other transient regions, 4.1.2 Ambiguous conditions: "string longer than a counted string returned by 6.1.2450 WORD");
    • possible throw codes
      • -18 "parsed string overflow";
      • -19 "definition name too long";
      • introduce a new throw code;
  • an empty lexeme is encountered unexpectedly (6.1.0895 CHAR, 6.1.2033 POSTPONE, 11.6.2.1714 INCLUDE, and other parsing words; see also 4.1.2 Ambiguous conditions: "unexpected end of input buffer, resulting in an attempt to use a zero-length string as a name");
    • throw code -16 "attempt to use zero-length string as a name";
    • see also a discussion about char — the word char shall not return a random character or a delimiter;
  • unexpected end of the input buffer (6.1.2165 S", 6.2.2266 S\", 6.2.0200 .(, 6.1.0080 ();
    • a new throw code should be introduced;
    • NB: currently, due to an ambiguous condition, the standard allows s" to parse multi-line string literal; if the standard will require to unconditionally throw an exception in such a case, parsing multi-line string literal will be non-standard. A possible solution (if a quotation mark is not found in the parse area): require to either parse multi-line string, or throw an exception.
  • the search order is empty in 16.6.2.0715 ALSO, 16.6.2.2037 PREVIOUS, 16.6.1.1180 DEFINITIONS, 16.6.2.1590 FORTH;
  • an I/O exception occurs reading the file, or an I/O exception occurs while closing the file (11.6.1.1718 INCLUDED, 11.6.1.1717 INCLUDE-FILE);
    • throw code -37 "file I/O exception";
    • possible throw code -70 "READ-FILE";
    • possible throw code -71 "READ-LINE";
    • possible throw code -62 "CLOSE-FILE";
  • a named file can not be opened (11.6.1.1718 INCLUDED);
    • possible throw code -38 "non-existent file";
    • distinguish non-existent file (ior code -38) and access denied (a new ior should be introduced);
  • A deferred word is not set with an execution token;
    • a new throw code should be introduced;

Implicit ambiguous conditions that should be eliminated

These ambiguous conditions are not mentioned explicitly.

  • A line does not fit the input buffer (in INCLUDE-FILE, INCLUDED, etc);
    • lines of at least 128 characters shall be supported (according to 11.3.5 Parsing);
    • a new throw code should be introduced;
  • An implicit ambiguous condition exists if empty-buffers is executed when loading of some block buffer is not completed;
  • insufficient space in the dictionary (in ALLOT, , (Comma), C, (C-comma));
    • throw code -8 "dictionary overflow";

Feasible

Optional

Difficult to implement

@ruv ruv added the enhancement New feature or request label Feb 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant