Kevin Eady
0ca7912fcd
Add support for conditional operator ( #387 )
...
* Grammar update
* AST generation
* Emit instructions
* Add initial tests
* Additional tests
* Rename to ConditionalOperator
* Add docs
2021-03-14 23:20:20 +01:00
Kevin Eady
e41f70d72e
Add support for interpolated strings ("interstrings") ( #369 )
...
* Update grammar to support interpolated strings
* Struct initializers, case switchs are regular strings
* Initial stub for interpolated string in AST
This splits the previous STRING_LITERAL terminal into a production,
stringLiteral, to handle REGULAR_STRING terminal and interpolatedString
production.
* Change interpolated strings to expressions
* Fix mode handling in grammar
* Grammar fixes
- Fix mode handling in lexer
- Interpolated strings only have one expression
* Can successfully parse, stub compile interstrings
$"He {there + print("hello")}";
* Add formatting string to grammar
* Fix tests, and add test stubs
* Rename curleys to brace; better AST generation
* initial work interstring instruction
* Initial work on formatted string instruction: emit
* Formatted string instruction: execution
* Add simple formatted string test
* Add formatted string test src
* Review changes #1
- Rename `FormattedString` to `FormatExpression`
- Rename overloaded `try_to_format()` to `get_formatted()`
* Review changes part 2
- Rename `InterpolatedString` ast node to `InterpolateString`
* Review changes part 3
- Modify `ins_interpolate_string`
* Review changes part 4
- Remove unused formal parameter
* Add negative tests
* Spruce up positive tests
* Fix braces, escape chars inside interstring
* Fix, add tests for escaped char and double brace
* Address differences for new lines in tests
* Update Escript version
* Make empty expression an error
* Add documentation for interpolated strings
* Quick touchup on docs
2021-03-11 22:48:16 +01:00
Kevin Eady
44c864b917
Remove erroneous lexing productions ( #371 )
...
* Remove erroneous lexing productions
* Fix hex float literals
* Address review comments.
2021-02-27 23:54:07 +01:00
Kevin Eady
b1e8d2b36a
Fix escape sequences, double-slash in strings ( #368 )
2021-02-22 21:20:55 +01: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
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
c0880e5e46
generated lib/EscriptGrammar from grammar
2020-07-26 21:28:02 -07:00