What is the EBNF syntax for ECMAScript

0 votes
With the help of code can you tell me What is the EBNF syntax for ECMAScript?
Feb 12 in Java-Script by Ashutosh
• 20,870 points
74 views

1 answer to this question.

0 votes

Here is an example of ECMAScript syntax written in EBNF-like notation for illustrative purposes:

Example of EBNF-Like Syntax for ECMAScript

Program       ::= StatementList

StatementList ::= Statement | StatementList Statement

Statement     ::= VariableDeclaration | ExpressionStatement | IfStatement

VariableDeclaration ::= "var" Identifier ("=" Expression)? ";"

ExpressionStatement ::= Expression ";"

IfStatement   ::= "if" "(" Expression ")" Statement ("else" Statement)?

Expression    ::= Identifier | Literal | BinaryExpression

BinaryExpression ::= Expression Operator Expression

Operator      ::= "+" | "-" | "*" | "/"

Identifier    ::= /[a-zA-Z_][a-zA-Z0-9_]*/

Literal       ::= StringLiteral | NumericLiteral | BooleanLiteral

StringLiteral ::= '"' [^"]* '"' | "'" [^']* "'"

NumericLiteral ::= /[0-9]+(\.[0-9]+)?/

BooleanLiteral ::= "true" | "false"

answered Feb 21 by Kavya

Related Questions In Java-Script

0 votes
0 answers

What is the volatile keyword useful for?

Sep 29, 2022 in Java-Script by Abhinaya
• 1,160 points
917 views
0 votes
1 answer
0 votes
1 answer

what is the $(document).ready equivalent without jQuery?

Hello @kartik, There are three options: If script is the last ...READ MORE

answered Apr 2, 2020 in Java-Script by Niroj
• 82,840 points
22,180 views
0 votes
1 answer

What is the difference between node.js and io.js?

Hello, io.js: Node-forward is basically being merged into io.js forked on ...READ MORE

answered Apr 24, 2020 in Java-Script by Niroj
• 82,840 points
950 views
0 votes
1 answer

How can query string parameters be retrieved in JavaScript?

You can retrieve query string parameters from ...READ MORE

answered Feb 21 in Node-js by Kavya
52 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

What is the difference between calling "super()" and "super(props)" in React ES6 classes?

Aspect super() super(props) Purpose Calls the parent class constructor without passing ...READ MORE

answered Feb 21 in Node-js by Kavya
62 views
0 votes
1 answer

What is the process for importing a JSON file in ECMAScript 6?

In ECMAScript 6 (ES6), importing a JSON ...READ MORE

answered Jan 10 in Java-Script by Navya
107 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP