These videos have been the most helpful resource I've found on the internet on this topic. I'll be using flex and bison for the first time and this has been really helpful to get me started! Thanks a lot!
Please note that if you are using flex, you need to add the line "%option nounput yylineno" to the first section of your lex input file to get the yylineno to print correctly. (without the quotes!)
A classic video SIR ! Really Amazing. This lex tutorial actually brushed up so many concepts. The sequence of regular expressions, the choice of defined constants and their use in TWO DIMENSIONAL char array ...... i actully got to learn so much from this video :) .
This is really cool. I think I will need some time to learn it. I have a project, which will automatically generate unit testing code for java programs. So I think I need to parse the source code first. And this will be a good start. Thanks. :)
This tutorial set really helped me to complete my Compiler Construction mini project in the university. Thank you so much. By the way can you upload another tutorial upto Code Generation part. Windows platform is preferred.
Thank you.. But isn't there a mistake in the last execution in the error message? The message said the error is in the 1st line but actually it's in the 4th line!
HELP !!! 26:18 fatal error: PERMISSION DENIED on myscanner.h and myscanner.c I'm using Windows 10 but running it on an Ubuntu kernel [ gcc --version (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0] and flex 2.6.4 Actually, I'm facing 2 problems. The first one is at trying to enter lex myscanner.l, it says "lex: can't open myscanner.l"... I tried so many things that I saw on the internet, and some of those worked, but I can't reply the process, that is, I can't create another file.l and start again The second is the shown (permission denied). This, I tried so hard and couldn't find a solution, please help me! I need to make a C-modified compiler for my course :((
absolutely brilliant! cleared quite a lot of concepts! I've got an issue though - the line numbers do not increment on their own? any explanation why this may be happening?
Please note that if you are using flex, you need to add the line "%option nounput yylineno" to the first section of your lex input file to get the yylineno to print correctly. (without the quotes!)
Please note that if you are using flex, you need to add the line "%option nounput yylineno" to the first section of your lex input file to get the yylineno to print correctly. (without the quotes!)
Great video.. But a doubt... :P At time 30:2 output of yylineno is 1 which is incorrect. . I tried the code as while(ntoken) { printf(%d %d %s ", ntoken, yylineno, yytext); ntoken=yylex(); } For each iteration yylineno is 1 only..
In order to print the correct line using the yylineno field you need to implement its increasement when a linefeed is detected. To do that: 1) Go to your lex file (*.l) 2) add the following line in the first section: "linefeed " (without the quotation marks) 3) add the following line in the second section: " {linefeed} yylineno++;" (without the quotation marks).
hey Jonathan, Really great video, thaught me a lot. Just wanted to ask something though. Is it possible to use string for the header file #define TYPE "something" OR #define INTEGER 'something' when I try these, I use in .c file, %s or %c ...
Currently the macro expansions require you to have #define ending with a semicolon with the update library. Doesn't allow for great use of your processor defines as you have to define more. Quite odd.
Hello, I followed exactly what you described in your steps but in the end I got 4 times myscanner.c (.text+0x49): undefined reference to 'yylineno' with the (.text+0x49) varying in each case. This comes up in the linux console. In the windows platform (i've set up everything so I can run flex and so use the flex command instead of the lex, everything worked until I got to the same spot. 4 times undefined reference to 'yylineno'. What do you suggest? Thank you in advance :)
Is there a particular reason you use vi instead of vim? I didn't know people still used vi but to be honest I'm not sure what the actual differences are between the two
Thank you for sharing this! Everything went fine up until the end...Dang it. I'm getting "Expected an identifier" for the 1099 port number. Also I have noticed that my yylineno always returns 1, which is really strange to say the least. Any advice on how to solve that? Thanks.
cc lex.yy.c -ll gives error. cant find -ll command.... >.< not using the -ll gives me more errors, about stuff not being defined. Anyone with an updated version knows what I am doing wrong?
Can anyone explain to me what the below for loop does and how it works please? void tokenize(char *line, char **words, int *nwords) { *nwords=1; for(words[0]=strtok(line," \t "); (*nwords
These videos have been the most helpful resource I've found on the internet on this topic. I'll be using flex and bison for the first time and this has been really helpful to get me started! Thanks a lot!
thanks for your valuable insights . Much appreciated
Been looking ages for a good tutorial about lex- fantasic and well worth the watch.
This is some of the hardest stuff I've tried to wrap my brain around for a long time...Still gives me nightmares :)
I still don't understand it
Please note that if you are using flex, you need to add the line "%option nounput yylineno" to the first section of your lex input file to get the yylineno to print correctly. (without the quotes!)
Great tutorial dude. The best is that you used Flex alone without Bison, it makes the whole thing clear in what Flex really does.
A classic video SIR ! Really Amazing.
This lex tutorial actually brushed up so many concepts.
The sequence of regular expressions, the choice of defined constants and their use in TWO DIMENSIONAL char array ...... i actully got to learn so much from this video :) .
This tutorial set really helped me to complete my Compiler Construction mini project in the university. Thank you so much.
Found the solution, using flex so required flag -lfl , may be worth mentioning to other learners, cheers for the vid!
Clarified a lot to me! Will help me in my homework. Thank you!
thanks for the upload. great video for being introduced to this tool
Nice. Simple and straight forward
Great video! Thank you so much for taking the time and posting.
Thank you so much Jonathan. I really appreciate this. I really learnt lex very quickly.
My gratitude.
thanks man me and my project group loved your video!
That's great. I really liked your explanations, very simple and focused. Thanks a lot.
Thank you very much. It was really straightforward, clear and helpful
This is EXACTLY what I was looking for! Thanks for the vivid illustration and walk-through #thumbsup #greatpost #youdarealCSmvp
Very well explained. Loved it
Awesome... pictorial view of this concept is really great
Very good video!
So helpful, thank you for it!
This is really cool. I think I will need some time to learn it. I have a project, which will automatically generate unit testing code for java programs. So I think I need to parse the source code first. And this will be a good start. Thanks. :)
awesome video! this saved my butt for my class!
Simple enough to build upon. Thank you
Thank you bro, may GOD bless you this tutorial really helped me
Amazing. Such a great tutorial!!!
Thank you sir, this is going to help me for my lectures
20:38 I use %option noyywrap yylineno to disable wrap and enable line counting (need for error reporting)
Very nice video. Thanks.
Hello Shailesh, I use Screenflow on the Mac.
The first and only HD video on lexing with either Yacc or JFlex, from what I can see
This tutorial set really helped me to complete my Compiler Construction mini project in the university. Thank you so much. By the way can you upload another tutorial upto Code Generation part. Windows platform is preferred.
The line number was incorrect at 30:00. How do you fix that?
thank you for the best explanation
omg, 7:50 pretty much says "if a, then b output" LOOOL with gods help i might get this computer science degree
Thank you. You explained this great
Great video! Thank you
Thank you.. But isn't there a mistake in the last execution in the error message? The message said the error is in the 1st line but actually it's in the 4th line!
wonderful explanation
HELP !!! 26:18 fatal error: PERMISSION DENIED on myscanner.h and myscanner.c
I'm using Windows 10 but running it on an Ubuntu kernel [ gcc --version (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0] and flex 2.6.4
Actually, I'm facing 2 problems. The first one is at trying to enter lex myscanner.l, it says "lex: can't open myscanner.l"... I tried so many things that I saw on the internet, and some of those worked, but I can't reply the process, that is, I can't create another file.l and start again
The second is the shown (permission denied). This, I tried so hard and couldn't find a solution, please help me! I need to make a C-modified compiler for my course :((
thank you mr.Jonathan
thank u very much sir...........u r doing a great job..........
absolutely brilliant! cleared quite a lot of concepts! I've got an issue though - the line numbers do not increment on their own? any explanation why this may be happening?
Ah, same here. Found a solution by any chance?
Nope
Please note that if you are using flex, you need to add the line "%option nounput yylineno" to the first section of your lex input file to get the yylineno to print correctly. (without the quotes!)
Please note that if you are using flex, you need to add the line "%option nounput yylineno" to the first section of your lex input file to get the yylineno to print correctly. (without the quotes!)
good one and thanks for sharing
This was really helpful! BTW, which tool did you use to record this demo/video.?
Awesome! Thank you!
Thank you very much! Awesome!
This Video was really helpful.... :D
excited by your typing speed...!!!
great video.
Excellent video - do you have videos on anyother SW topics
@kraftwerke, Thank you for the feedback. There are many other software related tutorials available on my channel. Please subscribe. :-)
executing led program on windows
Can you please tell why yylineno always giving 1 as output?
lex itself looks powerful parser. is there any popular lex practice?
Very helpful. Thx :)
Great video.. But a doubt... :P
At time 30:2 output of yylineno is 1 which is incorrect. .
I tried the code as
while(ntoken)
{
printf(%d %d %s
", ntoken, yylineno, yytext);
ntoken=yylex();
}
For each iteration yylineno is 1 only..
Found a solution for this by any chance?
In order to print the correct line using the yylineno field you need to implement its increasement when a linefeed is detected. To do that: 1) Go to your lex file (*.l) 2) add the following line in the first section: "linefeed
" (without the quotation marks) 3) add the following line in the second section: "
{linefeed} yylineno++;" (without the quotation marks).
Hi, thanks for this informative video, i wanted to ask why don't you enable autoindentation on vim ?
Can we add the c program in the lex program if we are using editpluse in Windows?
hey Jonathan,
Really great video, thaught me a lot.
Just wanted to ask something though. Is it possible to use string for the header file
#define TYPE "something"
OR
#define INTEGER 'something'
when I try these, I use in .c file, %s or %c ...
Currently the macro expansions require you to have #define ending with a semicolon with the update library. Doesn't allow for great use of your processor defines as you have to define more. Quite odd.
What hints can I use to parse Python tabbed syntax ? It looks like both lex and yacc parts must have some tricks to count spaces, and add
Is this yac/lex tool still popular? At which field are their prefered?thanks.
johnnyyyy@TheHIVE keep her going buddy
What if we write:
"[a-z]+[a-zA-Z0-9_]* return IDENTIFIER; " ?
Thank you so much.
Hello,
I followed exactly what you described in your steps but in the end I got 4 times
myscanner.c (.text+0x49): undefined reference to 'yylineno'
with the (.text+0x49) varying in each case. This comes up in the linux console.
In the windows platform (i've set up everything so I can run flex and so use the flex command instead of the lex, everything worked until I got to the same spot. 4 times undefined reference to 'yylineno'.
What do you suggest?
Thank you in advance :)
Did you try banging on the top of it?
Aggelos Troulakis Nai exw ena project pou to paleuw edw kai kati mines. Katexeis?
Is there a particular reason you use vi instead of vim? I didn't know people still used vi but to be honest I'm not sure what the actual differences are between the two
Is it possible to use Python as an alternative to C when doing this?
Thank you for sharing this!
Everything went fine up until the end...Dang it. I'm getting "Expected an identifier" for the 1099 port number. Also I have noticed that my yylineno always returns 1, which is really strange to say the least. Any advice on how to solve that? Thanks.
Ah, line increment problem solved. Someone posted a solution in the comments below.
First problem also solved. LOL I had copy-pasted inside the l-file and had "return NAME;" for the case of PORT. :D
First thank you for this awesome tutorial.
But I'm little confuse , I thought that the order that tokens apear (ntoken and vtoken) was a parser task.
19:25 important.
Does this work for flex and bison, or is the syntax completely different?
cc lex.yy.c -ll gives error.
cant find -ll command.... >.<
not using the -ll gives me more errors, about stuff not being defined. Anyone with an updated version knows what I am doing wrong?
Arco Dielhof Try using -lfl for linking with Flex library - used more often on modern systems.
I need to make a Turing machine as I can do?
I'm getting the following error?
[stiege@smaug lexanalysis]$ cc lex.yy.c -ll
/usr/bin/ld: cannot find -ll
collect2: error: ld returned 1 exit status
I think -ll is for OSX, for linux, use -lfl
Thank you!
Can anyone explain to me what the below for loop does and how it works please?
void tokenize(char *line, char **words, int *nwords)
{
*nwords=1;
for(words[0]=strtok(line," \t
");
(*nwords
BEST!
how can i do that in SWIFT please ??
Plz where can i find the code .?
All the code is put in the video. How hard can it be to write it while watching? It's not like you can't pause the video if it's too fast... ;)
Thank you :))
thank you!
Thank you :)
nice man
The only problem that I faced was explaining in LINUX.
26:18 its time to use make
29:10 he types “kkk” very fast before copying the error message 👀
How do you type so fast 0-0
for errors for -ll use -lfl
he's speeding up the video on those sections
it's -lfl instead of -ll
It's fast-forwarded xD
my teacher told us to build a pascal compiler without teaching us lex or anything just some mathematical logic BS
Great video, a little too slow though.
Español!! :C
no last viewer :)
17th viewer?
First viewer
Thanks a lot!