Error in the output of my flex file

前端 未结 2 1467
[愿得一人]
[愿得一人] 2021-01-28 14:27

I\'ve written a .l file and want to output the contents in \"c17.isc\".

But there is an error I don\'t know why. I\'ve given the file I plan to read, the flex file and t

2条回答
  •  心在旅途
    2021-01-28 15:31

    I'm not sure I understand your scenario correctly, but it looks like you are doing all the work of parsing the file using Flex and regular expressions?

    The usual way is to use Flex to generate a scanner (the function yylex) that just identifies the tokens. A token can be a single number or gate name. The scanner then returns as soon as it has found a token. So the scanner transforms the input (the sequence of characters on your file) to a sequence of tokens.

    Then you use a parser generator, typically Bison, to generate a parser, which compares those individual tokens to the grammar, and the larger structure of your input is then handled on the parser level.

    It gets very complicated when you are trying to do it all in Flex, which isn't really suited for it.

提交回复
热议问题