Metasyntax

I’ve started this course CS101. It talks about programming, and uses Python. So i decided it’s a good idea to learn Python among other CS stuff. Since my major was not computer science.

One of lectures that drew my attention, is about Grammer of programming languages, and how to define the allowable structure of a programming language statement. Which is also called Metasyntax.

According to Wikipedia, what metasyntax does is it :

 describes the allowable structure and composition of phrases and sentences of a metalanguage, which is used to describe either a natural language or a computer programming language.

Metalanguage is the language or symbols you use when you examine some kind of a language.

And the preceding lecture was about Backus Naur Form, which is one of the ways we can examine a language with.

According to Wikipedia :

In computer science, BNF (Backus Normal Form or Backus–Naur Form) is one of the two main notation techniques for context-free grammars, often used to describe the syntax of languages used in computing, such as computer programming languages, document formats, instruction sets and communication protocol.

But what is Context-free grammar? It’s like the grammar used to produce a language, this language is called Context-free language. It uses that production rule :

V → w

Where  is called a nonterminal symbol. The non-terminal symbol is the symbol which can be replaced with another one. In other word, you can break it down to a smaller unit w. this unit could be another non-terminal symbol, or a terminal symbol. A terminal symbol is the symbol which cannot be replaced with another symbol. It represents the ending of the replacement process you make.

In another way you can  examine it like this :

z = y
y = x
x = 5
print z

Here, in the code above, x, y and z, are called non-terminal symbols. And the number 5 is called a terminal symbol, since it can’t be replaced with another symbol anymore.

According to Wikipedia :

Quoting the so-called Dragon Book (a standard reference on the latter subject):
In a compiler, the lexical analyzer reads the characters of the source program, groups them into lexically meaningful units called lexemes, and produces as output tokens representing these lexemes. A token consists of two components, a token name and an attribute value. The token names are abstract symbols that are used by the parser for syntax analysis. Often, we shall call these token named terminals, since they appear as terminal symbols in the grammar for a programming language.

Honestly, i didn’t want to dive deep into this subject. I feel like i got what i needed to know from it. You can either read those Wikipedia article or search for how compilers work and how they treat terminal and non-terminal symbols.

Good luck.

Advertisements

My learning resources

Right now, i’m learning JavaScript and jQuery. Finding resources is quite easy, there’re a lot of it on the web.

But i’ve picked what suits me as a beginner so i have two books :

The last one is truly an amazing book, since i’ve learnt a lot of JavaScript from the first book plus videos, learning jQuery from The Missing Manual is such an enjoyable journey full of tutorials and tips & tricks. I’m at Chapter 10: Expanding Your Interface, which talks about several topics, tabbed panels, content sliders, tooltips and determining the dimensions of a page element.

Also i’ve watched jQuery Essential Training and going to have a look at Net Tuts which is a great site for web development, i highly recommend it.

All the above is kind of useless if i didn’t try to implement what i learn by hand and make mistakes, and here’s where Stack Overflow really comes into play really big time.

Stack Overflow is essentially a web site full of expert developers who are willing to help you and give you advices about your code and mistakes. This site helped me a lot and i hope that it helps you too.

So that’s it, i’ll write what interest me in chapter 10 from The Missing Manual soon.