In: Computer Science
How do I run a lex program written with C on xcode?
Xcode is an IDE that works on macOS which is a Linux based. So to run the program on Xcode you have to use some Linux-based commands. Suppose the name of the file in which the program is written is file1.l, Then the steps to run that file are-
1. Go to the directory in which the file is stored using the CD command. the command is CD {$FULL_PATH}.
2. Then you have to run the file using lex command to make it supportable. the command is Lex File1.l, this command will make a file c compatible as lex.yy.c.
3. Now to run the program you need a c compiler such as gcc. then you have to run the file through gcc. the command for that is gcc lex.yy.c -ly -ll. this command will create a file named as a.out. which is the output file of the GCC command.
4. Now you have to run the a.out file. the command for that is - ./a.out
By following these steps you can successfully run your lex program in Xcode. If you have any more doubt feel free to post in the comments.
::PLEASE UPVOTE THE ASNWER::