Possible error in C++ grammar file
  • While attempting to validate my own Go grammar files, I believe I have come across an error in the grammar file called:
    "cplusplus.Boolean.03.NandGates.grm.xml"

    On lines 28 and 29, my files have the following lines:
          <function idx="10017" symbol="Odd4" terminals="4" uniontype="">gepNand(gepNand(gepNand(gepNand(gepNand(gepNand(x0,x1),x2),x2),gepNand(gepNand(gepNand(x0,x1),x1),gepNand(gepNand(gepNand(x0,gepNand(x1,x1)),gepNand(gepNand(gepNand(x0,x1),x2),gepNand(x3,x3))),gepNand(gepNand(gepNand</function>
          <function idx="10018" symbol="Even4" terminals="4" uniontype="">gepNand(gepNand(gepNand(gepNand(gepNand(gepNand(gepNand(x0,x1),gepNand(gepNand(x0,x0),gepNand(x1,x2))),x2),gepNand(x3,x3)),gepNand(x2,x3)),gepNand(gepNand(gepNand(gepNand(x0,x1),x3),x2),gepNand(gepNand(x0,gepNand(a</function>

    If I'm not mistaken, these functions have been truncated prematurely.
    I'm not finished with my validation yet, so there might be more errors, but these were the first two I came across and thought I would just let you know.

    Thanks!
    -- Glenn
  • Hi Glenn,

    That’s indeed a truncation error and I’m afraid it’s in all Nand Gates grammars. Thank you so much for reporting the error! We will be releasing an update shortly with the correction, but meanwhile here are the correct solutions:

    Odd4:
    gepNand(gepNand(gepNand(gepNand(gepNand(gepNand(x0,x1),x2),x2),gepNand(gepNand(gepNand(x0,x1),x1),gepNand(gepNand(gepNand(x0,gepNand(x1,x1)),gepNand(gepNand(gepNand(x0,x1),x2),gepNand(x3,x3))),gepNand(gepNand(gepNand(x0,x3),gepNand(x1,x1)),x2)))),gepNand(x2,x3)),gepNand(gepNand(x0,x1),gepNand(gepNand(gepNand(gepNand(gepNand(gepNand(x0,x1),x1),x2),gepNand(gepNand(gepNand(x1,x2),x3),gepNand(x2,gepNand(x3,x3)))),x1),gepNand(x0,gepNand(gepNand(gepNand(gepNand(x1,x3),x2),gepNand(gepNand(x2,x2),x3)),gepNand(gepNand(gepNand(x2,x3),x3),x3))))));

    Even4:
    gepNand(gepNand(gepNand(gepNand(gepNand(gepNand(gepNand(x0,x1),gepNand(gepNand(x0,x0),gepNand(x1,x2))),x2),gepNand(x3,x3)),gepNand(x2,x3)),gepNand(gepNand(gepNand(gepNand(x0,x1),x3),x2),gepNand(gepNand(x0,gepNand(gepNand(gepNand(x0,x1),x2),x1)),gepNand(gepNand(x0,gepNand(gepNand(x0,x1),gepNand(x0,x3))),x1)))),gepNand(gepNand(gepNand(gepNand(gepNand(x0,gepNand(x0,x1)),gepNand(gepNand(x0,x0),gepNand(gepNand(x1,x3),gepNand(x2,x3)))),gepNand(x2,x3)),x3),x3));

    Many thanks again!
    Candida

  • Thank you, Dr. Ferreira!

    On a related note, I don't understand the purpose of the 6 "Boolean" XML grammar files.  Why are there 6 and how is one chosen over another?

    Does the system choose which file to use based on the problem domain or does the user choose?  I couldn't find any settings in the program that allowed me to choose which of the grammar files were chosen.

    Also, I don't understand why the "AllGates" grammar uses helper functions like gepNxor and generally gep*, whereas none of the other 5 boolean grammars appear to use "helper" functions.  In fact, the various boolean grammar files frequently have completely different implementations for a particular named operation.  Why is this, and how should I choose which grammar to use?  It seems like I would almost always want to use the "AllGates" version, but I could be missing something.

    Once again let me state that you have created an amazing system here and I am enjoying it tremendously.
    Thank you!

    -- Glenn
  • Hi Glenn,

    Thank you for the praise. It’s always great to see people enjoying the software!

    Now, about all these Boolean grammars. The default grammar is the All Gates Grammar, and it’s this code that is shown when you go to the Model Panel and select a programming language. But you can choose any of the 6 logic systems in the Model Panel (the second combobox in the Language combo) to generate code.

    The reason why only the All Gates Grammar has helper functions is because in all the other grammars (Nand, Nor, And-Or-Not, Mux system and Reed-Muller system) all the logic functions (all the functions available in the Functions Panel) are defined using only the building blocks of the respective system (for example, the Nand system uses only the Nand function); the All Gates Grammar uses the code of all input functions and does not translate the generated code to any other system. That’s the reason why it needs helper functions as we've chosen to implement all the logic functions that were not primitives of a particular language as independent functions in the code (otherwise the code would become almost unreadable).

    I hope this now makes more sense, but let me know if you still have questions.

    Candida

  • Hi again, Glenn!

    Just wanted to add that I found 3 more truncation errors in the NandGates Grammars in the functions Tie, Ntie and 3Off. We've just released a new update release with these bugs fixed, so please make sure to use one of the new updated grammars as reference for your Go grammar.

    Candida

  • Great, thank you!  That makes sense.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Tagged