Wait a minute, you might say to yourself. What do I mean by the meaning of the program? This is a surprisingly deep topic that involves a whole branch of mathematics known as homotopy. But for all practical intents and purposes of this chapter, let's define the meaning of a program to be the extensional definition of the program. If two programs compile and run, take the exact same inputs, and return the same exact output every time, we say two programs are equal.
These two programs would be equal:
Program A |
Program B |
fmt.Println("Hello World") |
fmt.Printf("Hello " + "World\n") |
Intentionally, if we visualize the programs as an Abstract Syntax Tree (AST), they look slightly different:
The syntax for both programs ...