Overview of the Parsing toy language syntax
mainThe project implements a simple language with the following syntax rules:
- Numbers: Integers and floating point (up to
Doubleprecision). No negative numbers or exponentials. - String Literals: Enclosed in double quotes (
"). Supports linebreaks and escaped characters (\",\\). - Variables: Must start with a letter, followed by letters or numbers. Keywords
letandprintare reserved. - Expressions: Supports numbers, strings, variables, and the infix
+operator (addition for numbers, concatenation for strings). - Declarations:
let <variable> = <expression> - Print:
print <expression> - Whitespace: Whitespace-agnostic; multiple statements can exist on one line.
- Comments: Not supported.