Anul 3 Semestrul 1
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
G = ({program, statement_list, statement, assignment_stmt, input_stmt, output_stmt, if_stmt, for_stmt, array_decl_stmt, condition, increment_stmt, expression, term, factor, relational_operator, binary_operator, concatenation},{=, (, ), [, ], if, else, for, ARRAY, echo, readline, +, -, *, /, <, <=, ==, >=, !=, ++, --, :, ;, IDENTIFIER, INTEGER_CONST, FLOAT_CONST, STRING_CONST},P, program)
|
||||
|
||||
P :
|
||||
program -> statement_list
|
||||
|
||||
statement_list -> statement | statement statement_list
|
||||
|
||||
statement -> assignment_stmt | input_stmt | output_stmt | if_stmt | for_stmt | array_decl_stmt
|
||||
|
||||
assignment_stmt -> IDENTIFIER = expression
|
||||
|
||||
input_stmt -> IDENTIFIER = readline_function ( STRING_CONST )
|
||||
|
||||
output_stmt -> echo_function ( STRING_CONST concatenation IDENTIFIER )
|
||||
|
||||
if_stmt -> if ( condition ) : statement | if ( condition ) : statement else : statement
|
||||
|
||||
for_stmt -> for ( assignment_stmt ; condition ; increment_stmt ) : statement
|
||||
|
||||
array_decl_stmt -> IDENTIFIER = ARRAY [ INTEGER_CONST ]
|
||||
|
||||
condition -> expression relational_operator expression
|
||||
|
||||
increment_stmt -> IDENTIFIER ++ | IDENTIFIER --
|
||||
|
||||
expression -> term | term binary_operator expression
|
||||
|
||||
term -> factor | factor binary_operator term
|
||||
|
||||
factor -> IDENTIFIER | INTEGER_CONST | FLOAT_CONST | STRING_CONST
|
||||
|
||||
relational_operator -> < | <= | == | >= | !=
|
||||
|
||||
binary_operator -> + | - | * | /
|
||||
|
||||
concatenation -> +
|
||||
|
||||
echo_function -> echo
|
||||
|
||||
readline_function -> readline
|
||||
Reference in New Issue
Block a user