Skip to main content
5 events
when toggle format what by license comment
Mar 10, 2017 at 18:50 comment added M.Puk One thing that I have in mind is to construct state machine. In file there are states and every state has it's own behavior. For example Initiator entity is doing something different than Idle entity in file I provided in the question. My vision is to create state machine where state holds behavior. With this principle I think it would be lot easier to just check entity in which state it is and run corresponding behavior. And when the state changes it just start from beginning another behavior. So I think that I want to do what you have suggested. Build data not actions.
Mar 10, 2017 at 18:44 comment added Cort Ammon That path keeps me honest. It makes sure I really know what my language looks like when I'm coding it up. It is also very helpful because it guarantees that you have a layer where you can do conversions and manipulations. For example, you may have a simulator that uses the data to make runnable objects, and you might have a static analyzer that looks at the same data, looking for issues like deadlocks. As long as your language parses into "data" rather than directly into "actions" you'll save a load of pain.
Mar 10, 2017 at 18:42 comment added Cort Ammon @M.Puk There are many ways you can do it. My personal recommendation would be to only use grammars for "data," such as an abstract syntax tree (a very useful term to know!). You can use tools like Flex and bison to execute code directly (most grammar tutorials have a calculator example that does this), but it's so easy to get burned that way. I find it best to convert my language into just data, such a data describing the abstract commands to be executed. Then I have a separate step which looks at that abstract data and writes the objects which do the actual activities like sending.
Mar 10, 2017 at 18:05 comment added M.Puk Maybe using macros is not the right way. I think I will settle with Flex, Bison and C. But I am not sure if my use of Bison is correct. Entities in environment will behave according to their state. I want to use Bison to generate some structure which will store steps and arguments and these steps will point to some functions for example send and execute it. Another thing is that I did not specify any types in my language. And that may be a problem with C. I am designing language similar to one in book by Santoro about distributed algorithms. He use it as pseudo code.
Mar 10, 2017 at 17:49 history answered Cort Ammon CC BY-SA 3.0