How to create a syntax diagramm with while? - syntax

I'm knew to programming so I hope somebody can explain the basic to me
I'm suppose to build a syntax diagramm with
"While (true) print("Hello") While (x <10) {x++;print(x);} While (5==y) print(y);"
b) Do other syntax diagrams need to be adapted?
I don't understand how it suppose to look like
Do you really have to add all 3 whiles into the syntax diagram or do you make 3 seperat synxtax diagram ?
We went through syntax diagrams but I don't know how it suppose to look like with print .
so can somebody give me an example to that I can learn how it suppose to look like
Is there a site there I can learn more about it ?
Thanks a million time

Related

Expressing and defining logic

I am trying to express a certain logic for a GUI tool to make diagnoses easier.
At the starting Point always the same questions will be asked (Question A). Dependet on the answer to it the questions should get more specific and complex.
Possible Scenario: Question A -> YES -> Question B -> NO -> Question E -> NO -> Question C .....
So the application kind of walks a path dependet on the answers. How can i define such a logic, best in a graphical way? Is it solveable with a domain specific language? I know some DSL-languages like ANTLR, but how can I export the logic and import it to GUI? I would like to write the GUI preferrably in C#, are there some constructs existing that would me help?
Anyone faced a similar issue like this?
Activity diagrams are what you are looking for. Something like this:
Use swim lanes to denote different "actors" in the system. From what it looks like in the image you posted in the question, you may not need swim lanes. Your software career will benefit from knowing UML/SysML, both make use of activity diagrams.
Create the diagram, then write the code to match. Hyperlink the code to the diagram with doxygen comments, so then you can generate a nice html/pdf page to explain how the code works.

Creating calculator in abap

I've build a basic calculator in abap which is pretty simple and knows how to get 2 inputs and calculate them by pressing a push button of the operator( + - / *).
Now I want to make a calculator which gets one input like : "12+5*3-9"
But I really don't know how to start it.
Can anyone help me a little bit please?
Thank you.
You question is related with an algorithm for parsing mathematical strings rather than ABAP. One of them is Shunting-yard.
If you need to short way, you can add your expression into java script function and run it in CL_JAVA_SCRIPT class in ABAP.
Check example ABAP program DEMO_JAVA_SCRIPT_MINI_EDITOR.

Pseudo Code in jGrasp

While writing pseudo code for java in jGrasp, do we write it in a comment or do we write it like any other code? I have already read the wiki page but wasn't able to reach a satisfactory understanding.
the pseudo code is basically a very detailed version of your code, you don't need to write it like any other code, you can write it as comments (these comments should let you or the person reading know what they would have to type in the program). In grade 12 computer science when we are told to write the pseudo code we just type it in words describing what is going to process, what does my code do basically do etc. I am really not sure how higher level coders do their pseudo code but as far as I know you can write it in a comment. ( you can/should type your pseudo code in word ) . I hope this helped.

Parsing Expression Grammar for syntax highlighting

First... Would it be possible to accomplish simple syntax highlighting using a PEG.
I'm only looking for it to be able to recognize and highlight basic things that are common to c style languages
Second... If there are any examples of this or something similar please let me know
Third... If I'm going about this the wrong way and there are more common and proven ways to do this then also let me know

Using "Or" operator in Business Objects (and failing)

This might be/seem like a basic question. Company just moved us to BO and trying to figure out a formula that would be easy in any other language. Can't seem to get the syntax and can't find documentation online.
=If([Disposition]=2 **Or 5**;Count([Sessionid]))
Apparently the "Or 5" part of this formula is wrong, cannot figure out how to implement it.
You need to list each condition separately. If you update it like below you should have it corrected.
=If([Disposition]=2 Or [Disposition]=5;Count([Sessionid]))

Resources