Commit graph

7 commits

Author SHA1 Message Date
Eric Swanson
203db02d48
New compiler: Move precedence of "in" above comparison operators (#316)
Rationale:
  a in b == x in y   // membership in two things is the same
  a in b != x in y   // membership in two things is different
  a in b <= x in y   // a has at most as much membership in b as x has in y
  a in b <  x in y   // a has less membership in b than x does in y

This matches Kotlin precedence for this operator https://kotlinlang.org/docs/reference/grammar.html#expressions
2020-09-15 06:48:36 -07:00
Eric Swanson
00904c02c8
Adjust operator precedence for bitwise operators: (#315)
- Moved <<, >>, & to same level as multiplication
- Moved | and ^ to same level as addition
2020-09-15 06:03:05 -07:00
Eric Swanson
591eb37d04
New compiler: No longer reserved words: null, declare (#313)
* These are not reserved words:
  - null
  - declare

Fixes https://github.com/polserver/polserver/issues/309
2020-09-15 00:16:31 -07:00
Eric Swanson
92098e3784
grammar: report trailing commas in dictionary, struct, array initializer lists (#252) 2020-08-29 02:52:40 -07:00
Eric Swanson
d456cc98eb
Update compiler grammar (#238)
* Update grammar
  - add '=' to grammar so that we can report appropriate errors
  - add elvis ?: operator
  - add foreachIterableExpression to match old compiler (which only allows certain expressions)
  - allow both byref and unused on the same function parameter
  - rename methodCall -> functionCall
  - rename memberCall -> methodCall
  - add named parser rule for functionReference
  - move everything that isn't expression(s) with operators into primary
    - expression is now just the left-recursive rules and prefix operators
  - add named parser rules for struct, dictionary, error, array initialization
  - remove special-case for named parameters with := from function call argument, because it is ambiguous with assignment
  - Moved array access, object member access, and object method calls to navigationSuffix

* Regen grammar
2020-08-21 01:53:42 -07:00
Eric Swanson
4834aee9d9 escript_grammar.cmake from Turley
Incorporate cmake/escript_grammar.cmake

Adjust generated EscriptParser.cpp: Need namespace for TokenStream in constructor
2020-07-26 23:42:33 -07:00
Eric Swanson
c0880e5e46 generated lib/EscriptGrammar from grammar 2020-07-26 21:28:02 -07:00