views:

33

answers:

1

Hallo everybody, Can someone help me out of my situation, im searching for a instrucior that implements the JMP (Jump) instructior like in Assembler. I've found out that it could be withe the goto function of Flex/Bison but i have no really idea how to do. Have got anyone idea. Im very grateful of yours help. Thanks.

Here is an example how it looks like. with the JMP instructor, he goes to the label L1.

:L1
IF FLAG AND X"0001"
EVT 23;
ELSE
WAIT 500 ms;
JMP L1;
END IF;
A: 

To implement a jump instruction you need to add gramma support for the label

label: ':' NAME { /* code to store the label */ };

and some grammer to parse the jump command

jmp: JMP NAME { /* code to look-up label and go there */ };

Keep in mind, defer the checking of all jump targets till the end of the parsing, otherwise you not be able to jump ahead.

Simeon Pilgrim