Search code examples
pythontokenprimitive

Primitive operations provided by a programming language?


I am doing MIT6.00.1x course from edX and in it, Professor Grimson talks about primitives of a programming language.

What does it actually mean and secondly, how it is different from the tokens of a programming language?

Please answer with reference to Python language.


Solution

  • It depends on the context, but usually:

    • primitives refers to built in data types of a language, that is, types that you can represent without creating an object. In python (and most other languages) such types are booleans, strings, floats, integers
    • tokens refers to a "word" (anything between spaces): identifiers, string/number literals, operators. They are used by the interpeter/compiler