jchitel / renlang

The Ren Programming Language
MIT License
4 stars 0 forks source link

Assignables #5

Open jchitel opened 6 years ago

jchitel commented 6 years ago

Assignables

Dependencies: Import/Export Additions

Description:

As of now, the only way to assign things is to use local variables. Obviously, other things are assignable:

To support these things, we need assignable expressions. Assignable expressions are a subset of expressions that can appear on the left side of an assignment statement.

New syntactic features:

New Tokens:

none

New NonTerminals:

Assignment ::= AssignableExpression EQUALS Expression
AssignableExpression ::= THIS
                       | IDENT
                       | FieldAccess
                       | ArrayAccess

Extended NonTerminals:

Expression ::= INTEGER_LITERAL |
               FLOATING_POINT_LITERAL |
               STRING_LITERAL |
               CHARACTER_LITERAL |
               VALUE |
               ArrayLiteral |
               StructLiteral |
               TupleLiteral |
               FunctionApplication |
               UnaryOperation |
               BinaryOperation |
               Assignment |           -- replaces VarDeclaration
               AssignableExpression | -- replaces FieldAccess, ArrayAccess, IDENT, and THIS
               LambdaExpression |
               IfElseExpression |
               MethodInvocation |
               MethodReference |
               NewObject |
               SuperCall |
               SuperMethodCall |
               LPAREN Expression RPAREN

New semantic features:

Transformation:

jchitel commented 6 years ago

4 has been completed, so this is now open for development.