General Notes on Syntax

Keywords

Keywords

The following words are reserved by Scenic and cannot be used as identifiers (i.e. as names of variables, functions, classes, properties, etc.).

False       break       except      lambda      require 
None        by          finally     new         return  
True        class       for         nonlocal    to      
and         continue    from        not         try     
as          def         global      of          until   
assert      del         if          on          while   
async       do          import      or          with    
at          elif        in          pass        yield   
await       else        is          raise       

Soft Keywords

The following words have special meanings in Scenic in certain contexts, but are still available for use as identifiers. Users should take care not to use these names when doing so would introduce ambiguity. For example, consider the following code:

distance = 5  # not a good variable name to use here
new Object beyond A by distance from B

This might appear to use the three-argument form of the beyond specifier, creating the new object at distance 5 beyond A from the point of view of B. But in fact Scenic parses the code as beyond A by (distance from B), because the interpretation of distance as being part of the distance from operator takes precedence.

To avoid confusion, we recommend not using distance, angle, offset, altitude, or visible as identifiers in code that uses Scenic operators or specifiers (inside pure-Python helper functions is fine).

_               below           final           next            shuffle     
abort           beyond          follow          not             simulation  
above           bottom          following       of              simulator   
additive        can             from            offset          steps       
after           case            front           override        take        
ahead           choose          heading         param           terminate   
along           compose         implies         past            top         
altitude        contained       initial         position        toward      
always          deg             interrupt       precondition    type        
angle           directly        intersects      record          visible     
apparent        distance        invariant       relative        wait        
apparently      dynamic         left            right           when        
away            ego             match           scenario        workspace   
back            eventually      model           seconds         
behavior        every           monitor         see             
behind          facing          mutate          setup           

Builtin Names

The following names are built into Scenic and can be used but not overwritten .

float               globalParameters    int                 str