mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-25 22:02:28 +01:00
Starting to apply #339 Co-authored-by: Richard Smith <richard@metafoo.co.uk>
Lexical conventions
Table of contents
TODO
This is a skeletal design, added to support the overview. It should not be treated as accepted by the core team; rather, it is a placeholder until we have more time to examine this detail. Please feel welcome to rewrite and update as appropriate.
See PR 17 for context -- that proposal may replace this.
Lexical elements
The first stage of processing a source file is the division of the source file into lexical elements.
A lexical element is one of the following:
- a maximal sequence of whitespace characters
- a word
- a literal:
- a numeric literal
- TODO: string literals
- TODO: operators, comments, ...
The sequence of lexical elements is formed by repeatedly removing the longest initial sequence of characters that forms a valid lexical element.