Trying a procedure, but errors I found


+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Junior Member keytapper's Avatar
    Join Date
    Jun 2019
    Posts
    57
    Thumbs Up
    Received: 2
    Given: 1
    Total Downloaded
    152.82 MB

    0 Not allowed!

    Default Trying a procedure, but errors I found

    Code:
    Device = 16F876
    
    Config FOSC_HS, WDTE_OFF, PWRTE_OFF, CP_OFF, BOREN_ON, LVP_OFF, _
    CPD_OFF, WRT_ON, DEBUG_OFF
    
    Dim tlong As Dword                  ' variabile di calcolo di una media
    
    Proc map(x As Dword, in_min As Dword, in_max As Dword, out_min As Dword, out_max As Dword)
    
       Result = (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min
    EndProc
    
    tlong = map(50, 0, 100, 20, 80)
    ERROR > Procedure MAP has no return
    ERROR > Variable 'RESULT' not found

    Also
    Code:
    Device = 16F876
    
    Config FOSC_HS, WDTE_OFF, PWRTE_OFF, CP_OFF, BOREN_ON, LVP_OFF, _
    CPD_OFF, WRT_ON, DEBUG_OFF
    
    Dim tlong As Dword                  ' variabile di calcolo di una media
    
    Proc map(x As Dword, in_min As Dword, in_max As Dword, out_min As Dword, _
    out_max As Dword)
    
      Result = (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
    EndProc
    
    tlong = map(50, 0, 100, 20, 80)
    Not allowed to break line longer than 80 chars.
    ERROR > Variable 'OUT_MAX' not found!
    What am I doing wrong?

    EDIT

    I think I forgotten the return value declaration
    Code:
    Proc map(x As Dword, in_min As Dword, in_max As Dword, out_min As Dword, _ out_max As Dword), Word '<< to declare what it will return
    Anyway breaking such line is not permitted ;(
    Last edited by keytapper; 12th October 2019 at 16:14. Reason: Found some correction

Attention

This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

The advertisements we display are relevant to this web site and your browsing history

Please consider supporting us by disabling your ad blocker.


Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

If you can, please report issues in the forum area WebSite / Forum Issues


Thank you for your attention.

  • #2
    Fanatical Contributor top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,341
    Thumbs Up
    Received: 289
    Given: 139
    Total Downloaded
    1.60 GB

    0 Not allowed!

    Default Re: Trying a procedure, but errors I found

    In the latest version of the compiler, procedures cannot be continued on a second line because of teh way they have had to be implemented in a flat language, but it is something I'm looking into.

    Adding the procedures to the flat Proton compiler was a huge task and something I came up with using my own ideas. I've never read of the way I did it in any article or book etc... If meLabs were still in the play, I'd offer to add them to their language as well for a bit of money.

    To return a value from a procedure, it must know what type of variable to load with the Result directive. Also, a command that uses a procedure as a parameter must know what type of variable the procedure is using as its return to it can perfrom its tasks.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #3
    Junior Member keytapper's Avatar
    Join Date
    Jun 2019
    Posts
    57
    Thumbs Up
    Received: 2
    Given: 1
    Total Downloaded
    152.82 MB

    0 Not allowed!

    Default Re: Trying a procedure, but errors I found

    Quote Originally Posted by top204 View Post
    procedures cannot be continued on a second line because of the way they have had to be implemented in a flat language
    I suppose that is just a way how the line are parsed from the compiler. That normally has its rule, but other parsers allowing to put anything in between to parentheses, which are supposed to be tabulators, spaces or even newline. As such, the continuation symbol become pretty unused.

    I won't ask to review the compiling rules, I'm (slightly) happy to know that I can't break that statement.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #4
    Fanatical Contributor top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,341
    Thumbs Up
    Received: 289
    Given: 139
    Total Downloaded
    1.60 GB

    0 Not allowed!

    Default Re: Trying a procedure, but errors I found

    As I said... The creation of the procedures in the already flat language took a mechansim that is not in any books. That is because the procedures are an option and not mandatory as with other procedural languages, so the compiler as it was is still there.

    The procedure mechanism operates before the compiler's Lexical analysis takes place, and the procedures are scanned, removed and stored in a linked list along with the parameters and other bits and pieces of them, then when that has taken place, the code is once again scanned and the calls to a procedure are stored so the procedures used can be placed back into the end of the code. Then the main compiler parser takes place with lots of modification to allow procedure calls both inline or on their own.

    The initial parsing and extracting of the procedures is not done with a lexical analyser because they are not part of the main parsing, so the scanner uses string manipulation to extract and record items, and I couldn't quite get the next line mechanism to work flawlessly so I dropped it and will look into it at a future date. The compiler's commands are far too flexible for a BNF or BNF2 to comprehend, so the compiler has been written by me alone from scratch and without a compiler writer writer application that most people use. I took a look at a few of them many years ago, but they simply were not up to the task, so I created the lexical analuser and the parse myself from the ground up. I had a bit of help for an excellent set of articles from Jack Crenshaw, but his compiler mechanism was for a microprocessor with a stack and not a microcontroller without a RAM stack, so I had to use his texts purely as a guide on how a parser works.
    Last edited by top204; 13th October 2019 at 20:02.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #5
    Fanatical Contributor top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,341
    Thumbs Up
    Received: 289
    Given: 139
    Total Downloaded
    1.60 GB

    2 Not allowed!

    Default Re: Trying a procedure, but errors I found

    On a side note... You also have to remember that I added procedures to the Proton compiler only 2 years after having a brain haemorrhage and I did it to try to reassure myself that I still had it in me. OK, there are other problems I have after the haemorrhage, but I am trying my damnest to overcome them as much as I can. I've never been a person to sit on their backside and do nothing! Since I was a boy I have always enjoyed learning new things and building new electronic gadgets, and, gladly, that has not changed.

    So any small querks in the compilers will be corrected over time, but I have other priorities to cater with because the compilers brings in zero money. They are worked on purely because they are my babies and I created them from scratch and I am very proud of them, and the extra features I have added over the years that actually make them a unique pair of BASIC compilers.
    Last edited by top204; 13th October 2019 at 22:45.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #6
    Administrator John Drew's Avatar
    Join Date
    Feb 2002
    Posts
    2,760
    Thumbs Up
    Received: 77
    Given: 33
    Total Downloaded
    4.30 GB

    0 Not allowed!

    Default Re: Trying a procedure, but errors I found

    That is amazing Les, and it suppports so many devices.
    For we users it's like the swimming duck. Calm on the surface and paddling like mad below.
    John

    PS Les and I were typing at the same time. My post referred to post 4. But it's also amazing you've exercised your brain back into what you still do Les.
    Time you went to bed and time I had my morning exercise.
    Last edited by John Drew; 13th October 2019 at 22:47.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #7
    Junior Member keytapper's Avatar
    Join Date
    Jun 2019
    Posts
    57
    Thumbs Up
    Received: 2
    Given: 1
    Total Downloaded
    152.82 MB

    0 Not allowed!

    Default Re: Trying a procedure, but errors I found

    From some perspective I feel I offended Mr. Les, my apologies.
    There are a lot of good in proton basic, that we enjoy every day, so I won't ask anymore for this case, I'll bear for what is good as we get.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

    Thread Information

    Users Browsing this Thread

    There are currently 2 users browsing this thread. (0 members and 2 guests)

       

    Similar Threads

    1. Upgrade procedure validation installer
      By Frizie in forum Proton Plus Compiler v3
      Replies: 4
      Last Post: 9th June 2019, 23:03
    2. Procedure pointer strange issue
      By RGV250 in forum Proton Plus Compiler v3
      Replies: 2
      Last Post: 1st March 2019, 07:37
    3. Replies: 1
      Last Post: 3rd September 2018, 18:50
    4. procedure to print
      By Jezsmith in forum Proton 24
      Replies: 8
      Last Post: 14th December 2014, 10:01

    Members who have read this thread since 20th October 2019, 21:59 : 0

    Actions :  (Set Date)  (Clear Date)

    You do not have permission to view the list of names.

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts