简体   繁体   English

Flex / bison中的JMP指令

[英]JMP instruction in Flex/bison

Hallo everybody, Can someone help me out of my situation, im searching for a instrucior that implements the JMP (Jump) instructior like in Assembler. 大家好,有人可以帮我摆脱困境,我正在寻找可以像在汇编程序中那样实现JMP(跳转)讲师的工具。 I've found out that it could be withe the goto function of Flex/Bison but i have no really idea how to do. 我发现它可能与Flex / Bison的goto功能一起使用,但是我真的不知道该怎么做。 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. 与JMP讲师一起,他去了标签L1。

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

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. 请记住,将所有跳转目标的检查推迟到解析结束时进行,否则您将无法跳转。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM