Using this video as a companion to learn antlr; I adore your presenting style. You sound like you're having a lot of fun doing this, and it makes me have fun too.
really a great tutorial, been at this for weeks now trying to figure out the utilty of my grammar in a context other than using GRun. You've really saved my ass!
Great video! To answer your question about the grammar, Uppercase and lowercase define the semantic and lexical parts of the grammar used by the scanner/parser(compiler front-end ANTLR generates). lower case are non-terminal (are not atomic - expression can have more expressions), uppercase are terminal nodes in the AST tree the parser generates (are atomic IDENTIFIER = [regular expression]).There are also fragments, which I believe are called sugar code lol
You can model expression trees in JSON, but it gets unwieldy pretty fast. Just did this for a work project - mostly used expressions as a way to teach some ideas to a junior dev. Of course, I got around to thinking how much easier it would be to use a little lambda calculus language instead of JSON. Next thing you know I'm watching this cool video.
Finally I had an possibility to start my dream lang 🙂 Is now breaking on regexes, which are different from every else, but im going to target. Thanks to you and Antlr4C#
Good video, but the way you use the antlr generated visitor is questionable.. you are treating it like a listener and will likely have side-effect as you're storing state within the visitor. With the visitor pattern you're supposed to have x number of visitors for each generalized task within your program. For example you will have a expression visitor that returns an expression type. The expression type will then have sub types such as a constant expression visitor. The expression visitor would then delegate it's visit constant calls to the constant expression visitor. This way you're generating ast, (in this example expression visitor returns expressions, and the constant visitor would return a constant expression, which is a child of an expression.)
Taking a course where we use antlr4, listeners & visitors.. but in Java.... as I have no experience in Java I barely understand my teacher's ppt slides and demonstrations... Thank you for showing how to do it in c# so I can understand what we are doing... now I just gotta figure out how to Java 🤣
put this in your override: Func condition = isTrue; if (condition(Visit(context.expression()))) { Visit(context.block()); } else { Visit(context.elseIfBlock()); } return null;
Using this video as a companion to learn antlr; I adore your presenting style. You sound like you're having a lot of fun doing this, and it makes me have fun too.
Thanks! Consider posting more content about ANTLR4 and C#, I learned a lot from this video😁
Perfect timing. I did a search on RUclips just 3 hours after you posted this :) Thanks. Giving it a watch now.
really a great tutorial, been at this for weeks now trying to figure out the utilty of my grammar in a context other than using GRun. You've really saved my ass!
Great video! To answer your question about the grammar, Uppercase and lowercase define the semantic and lexical parts of the grammar used by the scanner/parser(compiler front-end ANTLR generates). lower case are non-terminal (are not atomic - expression can have more expressions), uppercase are terminal nodes in the AST tree the parser generates (are atomic IDENTIFIER = [regular expression]).There are also fragments, which I believe are called sugar code lol
Yes, casing should be handled in the lexer, not the grammar.
You can model expression trees in JSON, but it gets unwieldy pretty fast. Just did this for a work project - mostly used expressions as a way to teach some ideas to a junior dev. Of course, I got around to thinking how much easier it would be to use a little lambda calculus language instead of JSON. Next thing you know I'm watching this cool video.
Finally I had an possibility to start my dream lang 🙂
Is now breaking on regexes, which are different from every else, but im going to target.
Thanks to you and Antlr4C#
Watching this again and thinking that the integer zero begins with the digit '0'
I enjoy the narrator's sense of humor :)
Loved this 😂 Especially the rant about horses 😂
Right on.. using blank space/tab/indent as part of syntax is a terrible idea.. whoever thought that was a good idea? LOL Great video!!
Thanks mate, this was interesting indeed. I learnt a lot and I added my own twist its interesting.
Yay I've been thinking of writing my own programming language for my game.
Language or engine?
@@alexisrodriguez7127 I'm already part way through the second one. Planning to also add the first one as an in-game programming language.
@@slBrelaz same
Nice content, thanks mate!
This is like a programming podcast ur talking about horses lol
Good stuff
you make no sense you dementia
Good video, but the way you use the antlr generated visitor is questionable.. you are treating it like a listener and will likely have side-effect as you're storing state within the visitor. With the visitor pattern you're supposed to have x number of visitors for each generalized task within your program. For example you will have a expression visitor that returns an expression type. The expression type will then have sub types such as a constant expression visitor. The expression visitor would then delegate it's visit constant calls to the constant expression visitor. This way you're generating ast, (in this example expression visitor returns expressions, and the constant visitor would return a constant expression, which is a child of an expression.)
Taking a course where we use antlr4, listeners & visitors.. but in Java.... as I have no experience in Java I barely understand my teacher's ppt slides and demonstrations... Thank you for showing how to do it in c# so I can understand what we are doing... now I just gotta figure out how to Java 🤣
Is the code for this project on GitHub?
I think there's a way to generate C# routines by giving .g4 file as input, does anybody knows to do that ?
i don't understand the class part at all, i get an error when i try to use what is in the content folder
Did you solve this problem? I am also having the same problem
did you make a compiler in another video??
For the idea of func = @(){ asdasd } how would I go about implementing something like that
I figured it out also I have scope
15:04 you used * which can repeat at least 0 times, you shoupd use a + which needs atleast one instance.
Can you share your code?
Thanks for the great tutorial! How would you visit(code) the if/else if/else block? I'm struggling with that :\
put this in your override:
Func condition = isTrue;
if (condition(Visit(context.expression())))
{
Visit(context.block());
}
else
{
Visit(context.elseIfBlock());
}
return null;
Good Tutorial.
Python has while... else!
Cool video. I'm tying this into Godot. Hope it works
Time to make H-
what’s your ide
JetBrains Rider
a programming language on top of c#....? omg
41:36
DID YOU MADE YOUR OWN COMPILER AND KERNEL ???? NNNNN
ERR??