AT&T Home | AT&T Labs | Research
AT&T Labs, Inc. - Research

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YChart | YDAT | YWAIT | Byzgraf | FAQs

Yoix / Grammar

The grammar shown below is not an exact statement of the language. It does not work with JavaCC or any other parser generator that we are familiar with, but it should help answer simple questions about syntax. Non-terminals start with an upper case letter and are shown in italic type; all terminals, except for the three undefined symbols name, number, and string, are shown in bold type exactly as they would appear in a Yoix program. The Yoix interpreter reads and executes one statement at a time, very much like the Unix shell, so nothing in the grammar represents a complete Yoix program.


Statement:
	Compound
	Declaration ;
	Expression ;
	FunctionDefinition
	NamedBlock
	Permissions ;
	break ;
	case UnaryExpression :
	continue ;
	default :
	do Statement while ( Expression ) ;
	exit Expressionopt ;
	finally Compound
	for ( name in Expression ) Statement
	for ( name in Expression by Expression ) Statement
	for ( Expressionopt ; Expressionopt ; Expressionopt ) Statement
	if ( Expression ) Statement
	if ( Expression ) Statement else Statement
	import Lvalue ;
	import Lvalue .* ;
	import yoix.*.* ;
	include Expression ;
	return Expressionopt ;
	save Lvalue ;
	save Lvalue = Expression ;
	switch ( Expression ) Compound
	synchronized ( Expression ) Statement
	try Compound catch ( name ) Compound
	typedef name ( ParameterList ) Compound
	while ( Expression ) Statement
	;

StatementList:
	Statement
	StatementList Statement

Compound:
	{ }
	{ StatementList }

NamedBlock:
	Lvalue { }
	Lvalue { StatementList }
	global Lvalue { StatementList }
	restricted Lvalue { StatementList }
	this Lvalue { StatementList }
	global { StatementList }
	restricted { StatementList }

Expression:
	UnaryExpression
	UnaryExpression * UnaryExpression
	UnaryExpression / UnaryExpression
	UnaryExpression % UnaryExpression
	UnaryExpression + UnaryExpression
	UnaryExpression - UnaryExpression
	UnaryExpression << UnaryExpression
	UnaryExpression >> UnaryExpression
	UnaryExpression >>> UnaryExpression
	UnaryExpression < UnaryExpression
	UnaryExpression <= UnaryExpression
	UnaryExpression > UnaryExpression
	UnaryExpression >= UnaryExpression
	UnaryExpression instanceof Typename
	UnaryExpression == UnaryExpression
	UnaryExpression != UnaryExpression
	UnaryExpression === UnaryExpression
	UnaryExpression !== UnaryExpression
	UnaryExpression =~ UnaryExpression
	UnaryExpression !~ UnaryExpression
	UnaryExpression & UnaryExpression
	UnaryExpression ^ UnaryExpression
	UnaryExpression | UnaryExpression
	UnaryExpression && UnaryExpression
	UnaryExpression ^^ UnaryExpression
	UnaryExpression || UnaryExpression
	UnaryExpression ? Expression : Expression
	UnaryExpression = UnaryExpression
	UnaryExpression *= UnaryExpression
	UnaryExpression /= UnaryExpression
	UnaryExpression %= UnaryExpression
	UnaryExpression += UnaryExpression
	UnaryExpression -= UnaryExpression
	UnaryExpression <<= UnaryExpression
	UnaryExpression >>= UnaryExpression
	UnaryExpression >>>= UnaryExpression
	UnaryExpression &= UnaryExpression
	UnaryExpression ^= UnaryExpression
	UnaryExpression |= UnaryExpression
	UnaryExpression , UnaryExpression

ExpressionList:
	Expression
	ExpressionList , Expression

UnaryExpression:
	( Expression )
	Attribute
	Cast
	Lvalue
	Lvalue ++
	Lvalue --
	++ Lvalue
	-- Lvalue
	+ UnaryExpression
	- UnaryExpression
	! UnaryExpression
	~ UnaryExpression
	new Dvalue Initializeropt
	number
	string

Attribute:
	Lvalue @ access
	Lvalue @ length
	Lvalue @ major
	Lvalue @ minor
	Lvalue @ nameof
	Lvalue @ offset
	Lvalue @ sizeof
	Lvalue @ typename

Cast:
	( name ) UnaryExpression

Lvalue:
	Lvalue . name
	Lvalue [ Expression ]
	Lvalue ( ExpressionListopt )
	& Lvalue
	* Lvalue
	* Pointer
	global
	name
	this

Pointer:
	Lvalue ++
	Lvalue --
	++ Lvalue
	-- Lvalue
	( Expression )

Declaration:
	Qualifieropt Typename DeclaratorList

Declarator:
	Dvalue
	Dvalue = Initializer

DeclaratorList:
	Declarator
	DeclaratorList , Declarator

Dvalue:
	name
	name [ Expression ]
	name [ Expression , Expression ]
	name [ Expression , ... ]

Initializer:
	Compound
	Expression
	{ ExpressionList }

Qualifier:
	const
	final

Typename:
	name

FunctionDefinition:
	finalopt name ( ) Compound
	finalopt name ( ) = Expression
	finalopt name ( ParameterList ) Compound
	finalopt name ( ParameterList ) = Expression
	finalopt name ( ParameterList , ... ) Compound
	finalopt name ( ParameterList , ... ) = Expression

ParameterList:
	Typenameopt name
	ParameterList , Typenameopt name

Permissions:
	Qualifier Lvalue
	Qualifier Lvalue = Expression

 

Yoix is a registered trademark of AT&T Inc.