Documentation topicsLexical Structure
Lexical Structure
Control Flow
Functions & Scope
Lists & Built-ins
Reference
MarathiCode v0.2.0
Lexical Structure
शब्दरचना
A program is UTF-8 text made of these kinds of tokens:
| Token | Examples |
|---|---|
| Keywords | चल, छापा, जर, पर्यंत, कार्य … (all 16) |
| Identifiers | वय, एकूण_गुण, total, बेरीज1 |
| Numbers | 10, 3.14, १०, ३.१४ |
| Strings | "नमस्कार" |
| Operators | + - * / % = == != > < >= <= |
| Punctuation | ( ) { } [ ] , ; |
Whitespace and line breaks
Spaces, tabs and line breaks only separate tokens. There is no statement terminator: statements are usually written one per line, but two statements on the same line also work. Indentation is not significant; blocks are marked with { }. The semicolon ; is used only inside a साठी loop header.
whitespace.mr
चल x = 1 छापा(x)
छापा(x + 1)Output (आउटपुट)
1 2
Comments
// starts a comment that runs to the end of the line. There are no multi-line comments.
comments.mr
// ही पूर्ण ओळ टिप्पणी आहे
छापा("टिप्पणी नाही") // ओळीच्या शेवटी टिप्पणीOutput (आउटपुट)
टिप्पणी नाही
Invalid characters
Any character that is not part of a token, string or comment is a lexical error:
invalid.mr
चल किंमत = 100 $Output / Error (आउटपुट / त्रुटी)
शब्दरचना त्रुटी (Lexical Error)
ओळ 1:
चल किंमत = 100 $
^
अवैध चिन्ह '$'