0% found this document useful (0 votes)
45 views3 pages

Tiny Language Grammar Overview

This document defines the grammar for a tiny language. It consists of 3 sentences: The grammar defines syntax rules for numbers, arithmetic operators, comparisons, identifiers, comments, statements, conditions, if statements, repeat statements, read statements and write statements. Statements can be assignments, arithmetic expressions, or control flow statements like if and repeat. The grammar also defines syntax for assigning values and comparing identifiers.

Uploaded by

Eslam Elsawy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views3 pages

Tiny Language Grammar Overview

This document defines the grammar for a tiny language. It consists of 3 sentences: The grammar defines syntax rules for numbers, arithmetic operators, comparisons, identifiers, comments, statements, conditions, if statements, repeat statements, read statements and write statements. Statements can be assignments, arithmetic expressions, or control flow statements like if and repeat. The grammar also defines syntax for assigning values and comparing identifiers.

Uploaded by

Eslam Elsawy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Grammar of tiny language:-

Number [0-9] N
N [0-9] N | E

Digit 0|1|2|3|4|5|6|7|8|9

Arithmetic-Operators +|-|/|*

comparison-operator < | :=

Letter [A-Z] | [a-z]

Identifier letter . ID
ID [a-z] ID| [A-Z] ID | [0-9] ID | E

Comment { .C . }
C identifier . C | special character .C |E
Special character !|@|#|$|%|^|&|*|(|)|_|+|=
statement Identifier . := . S | write-statement | read-statement | repeat-
statement
S Number . M | Identifier . M
M Arithmetic-Operators . Number . M | Arithmetic-Operators . Identifier . M | E

condition identifier. A. < . identifier. A | identifier. A . := . identifier. A


A identifier. A | E

if-condition if .condition . B . end


B T|F
T statement(if)
F else . statement(else)

repeat-statement repeat . statement . until . condition . B

B T|F
T statement . until . condition . B
F E

read-statement read . identifier . R


R , . identifier R |E
write-statement write . identifier . W |write . string literal .W
W , . identifier . W | , . string literal .W | E

assign-operator :=

You might also like