Products/ylang

EBNF - Statement

swJman 2025. 10. 24. 11:26
Code -> {Stmt}
Stmt -> Exp ';' | CompoundStmt | IfStmt | ForStmt | FnStmt | ReturnStmt | KeyStmt ';'
CompoundStmt -> '{'{Stmt}'}'
IfStmt -> 'if' '('Exp')' Stmt ['else' Stmt]
ForStmt -> 'for' '('[Exp]';' [Exp]';' [Exp]')' Stmt
FnStmt -> 'fn' Id '('[Params]')' (Exp | CompoundStmt)
ReturnStmt -> 'return' [Exp] ';'
KeyStmt -> 'continue' | 'break'
Params -> Id {',' Id}

 

Exp는 아래 링크

 

ENBF - Expression

LValue -> Id | PostfixExp '.' Id | PostfixExp '[' Exp ']' AssignOp -> '=' | '+=' | '-=' | '*=' | '/=' | '%=' | '>=' | '&=' | '|=' | '^=' Exp -> AssignExp AssignExp -> OrExp | LValue AssignOp AssignExp OrExp -> AndExp | OrExp '||' AndExp AndExp -> BitOrExp

swjman.tistory.com