Skip to content

Latest commit

 

History

History
26 lines (20 loc) · 286 Bytes

File metadata and controls

26 lines (20 loc) · 286 Bytes

Grammar for Chapter 1

grammar SimpleLanguage;

program
    : statement EOF
    ;

statement
    : 'return' expression ';'
    ;

expression
    : primaryExpression
    ;

primaryExpression
    : INTEGER_LITERAL
    ;

INTEGER_LITERAL
    : [1-9][0-9]*
    | [0]
    ;