Skip to content

Commit d3ab43c

Browse files
Update grammar and description
1 parent ae8c008 commit d3ab43c

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

‎antlr-parser/src/main/antlr4/com/compilerprogramming/ezlang/antlr/EZLanguage.g4‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ NON_DIGIT
158158
INTEGER_LITERAL
159159
: DEC_LITERAL
160160
;
161-
DEC_LITERAL: DEC_DIGIT (DEC_DIGIT | '_')*;
161+
DEC_LITERAL: DEC_DIGIT+;
162162

163163
FLOAT_LITERAL: DEC_DIGIT+ '.' DEC_DIGIT*;
164164

‎docs/ez-lang.rst‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Keywords
2020
--------
2121
Following are keywords in the language::
2222

23-
func var Int Float struct if else while break continue return null
23+
func var new Int Float struct if else while break continue return null
2424

2525
Source Unit
2626
-----------
@@ -231,6 +231,16 @@ Following table describes the available operators by their precedence (low to hi
231231

232232

233233

234+
Floating point operands support the arithmetic operators ``+``, ``-``, ``*``, ``/``,
235+
the relational operators ``==``, ``!=``, ``<``, ``<=``, ``>``, ``>=``, and unary
236+
negation ``-``. The modulo operator ``%``, the logical operators ``&&`` and ``||``, and
237+
the unary ``!`` operator are not supported for floating point operands. A relational
238+
operator applied to floating point operands produces an ``Int`` result (``1`` or ``0``).
239+
240+
There is no implicit conversion between ``Int`` and ``Float``. The two operands of a
241+
binary arithmetic or relational operator must be of the same type; mixing ``Int`` and
242+
``Float`` in a single operation is a type error.
243+
234244
Grammar
235245
-------
236246

0 commit comments

Comments
 (0)