2.5

Elm Programming Language

Elm programming language is a notation for writing programs that run on a web browser. The description of the language is split into two components: syntax and semantics. Syntax refers to the grammatical structure of a program whereas semantics refers to its meaning. For instance, the following code is syntactically invalid in Elm because the +++ operator doesn’t exist in the language.

"syntactically invalid " +++ "code"

There are countless scenarios where Elm can throw a syntactic error. Here are some examples: a misplaced keyword, two operators in a row, unbalanced parentheses, etc.

After a program’s syntactic validity has been established, the next step is to look for semantic errors. For example, the following code is syntactically valid, but semantically invalid. ++ is a valid operator in Elm, but it can only be used to combine two strings not a string and a number.

"syntactically valid, but semantically invalid " ++ 45

For a program to be valid in Elm, it has to be both syntactically and semantically correct.

Note: Elm programming language itself is written in another language called Haskell.

Back to top
Close