bugGforth - Bugs: bug #56406, Inconsistent Control structure...

 
 

bug #56406: Inconsistent Control structure mismatch reporting

Submitter:  Phil Krylov <philkrylov>
Submitted:  Tue 28 May 2019 12:07:58 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Invalid
Privacy:  Public Assigned to:  paysan
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 29 May 2019 10:12:35 AM UTC, comment #2: 

Another way to express this:

: a if begin repeat ;

is a standard program, so Gforth as a standard system must accept it.

Why is it standard?  The standard says:

IF ( C: -- orig )
BEGIN ( C: -- dest )

So after BEGIN the control-flow stack contains ( orig dest ).  The standard also says:

REPEAT ( C: orig dest -- )

So REPEAT just consumes these two control-flow stack items, and there is no type mismatch or control-flow stack imbalance that would constitute an error.

What does A mean?  It means the same as:

: a if begin again then ;

This is not the most useful program, but it is also standard.

Anton Ertl <anton>
Group administrator
Tue 28 May 2019 08:02:01 PM UTC, comment #1: 

WHILE is equivalent to IF  1 CS-ROLL, and correspondingly REPEAT is AGAIN THEN.

So when IF BEGIN AGAIN THEN is ok (means endless loop if the condition is met), so is IF BEGIN REPEAT, which is the equivalent. Maybe surprising, but as it follows the rules, we can't check against it.

Bernd Paysan <paysan>
Group administrator
Tue 28 May 2019 12:07:58 PM UTC, original submission:  


: a  if ;
*the terminal*:1: error: Control structure mismatch
: a  if ;
Backtrace:
                                         0 $1016189E0 throw
glocals.fs:651:5                         1 $10162B2C8 ?struc
                                         2 $10160E3F8 ;-hook

: a if begin repeat ;  ok


Phil Krylov <philkrylov>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by anton (Posted a comment)
  • -email is unavailable- added by paysan (Posted a comment)
  • -email is unavailable- added by philkrylov (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-07-15 paysan Open/ClosedOpen Closed
    2019-05-28 paysan StatusNone Invalid
        Assigned toNone paysan

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code