Lex - How to run / compile a lex program on commandline

后端 未结 2 1743
滥情空心
滥情空心 2021-01-01 02:22

I am very new to Lex and Yacc. I have a Lex program. Example: wordcount.l

I am using windows and putty.

I am just trying to run this file..

相关标签:
2条回答
  • 2021-01-01 02:42
    lex file.l
    gcc lex.yy.c -ly -ll
    ./a.out
    

    These also works. I am using this in Ubuntu 14.04.

    0 讨论(0)
  • 2021-01-01 02:44

    You first have to go to the directory which the file wordcount.l is in using cd. Then using lex wordcount.l will make the file lex.yy.c. To the run the program you need compile it with a c compiler such as gcc. With gcc you can compile it using gcc -lfl lex.yy.c. This will create a.out which can be run using ./a.out

    0 讨论(0)
提交回复
热议问题