Lexical format for floating-point constants


#1

I’m doing a syntax highlighter for ATS based on the Monarch editor (used in
Visual Studio Code) and I’m interested to know what’s the lexical grammar
for floating-point constants?

I’ve tried looking through the lexer source code, but I find it quite
complicated. I’d like some help on this one.


#2

Great. Looking forward to using it.On Tuesday, August 16, 2016 at 1:15:51 AM UTC-4, gmhwxi wrote:

This is great news!

I really want to try it for my upcoming class.

Could you show me how to use the Monaco editor to
replace the textareas in the following page:

http://myflask-tutoriats.rhcloud.com/assign01
view-source:http://myflask-tutoriats.rhcloud.com/assign01

Thanks!

On Tuesday, August 16, 2016 at 12:07:35 AM UTC-4, Artyom Shalkhakov wrote:

The PR adding ATS/Postiats colorization support to Monaco editor has been
merged.

On Thursday, June 30, 2016 at 9:17:56 AM UTC+6, Artyom Shalkhakov wrote:

On Wednesday, June 29, 2016 at 9:54:39 AM UTC+6, gmhwxi wrote:

Thanks for the effort!

These days I have been thinking about building some sort of on-line
coding
system of ATS. The manaco editor looks pretty decent. When your syntax
definition
is ready, I will give it a try.

I’m currently in the process of writing unit-tests (caught a bug with a
comment already!).

It’s taking quite some time. Will let you know if something fruitful
comes out of it.

On Monday, June 27, 2016 at 11:58:42 AM UTC-4, Artyom Shalkhakov wrote:

Thanks Hongwei! I will take a look to see if this is what my syntax
definition captures tomorrow.

Here’s the code, in a gist:

https://gist.github.com/ashalkhakov/a86dfb4770cff12d0cdf298405a58d74

It can be tested by visiting:

https://microsoft.github.io/monaco-editor/monarch.html

and pasting the syntax definition into the textbox. I’ve also provided
an example input (some rubbish to help figure out if hilighting is
well-behaved).

This needs more testing and tuning, but seems like a worthwhile effort!

On Monday, June 27, 2016 at 9:20:16 PM UTC+6, gmhwxi wrote:

Let

INT0 = [0-9]*
INT1 = (0 | 1-9)
DOT = [.]
EXP = eE

Then FLOAT is

(INT1)(EXP) | (INT1)(DOT)(INT0)(EXP)? | (DOT)(INT1)(EXP)?

There are also hexadecimal floating point numbers:

HEX0 = [0-9a-z]*
HEX1 = (0 | 1-9a-z)
DOT = [.]
EXP = pP

HEXFLOAT = (HEX1)(EXP) | (HEX1)(DOT)(HEX0)(EXP?) | (DOT)(HEX1)(EXP?)

In C, EXP? should be EXP for hexadecimal floating point numbers.

On Monday, June 27, 2016 at 4:06:42 AM UTC-4, Artyom Shalkhakov wrote:

I’m doing a syntax highlighter for ATS based on the Monarch editor
(used in Visual Studio Code) and I’m interested to know what’s the lexical
grammar for floating-point constants?

I’ve tried looking through the lexer source code, but I find it
quite complicated. I’d like some help on this one.


#3

The PR adding ATS/Postiats colorization support to Monaco editor has been
merged.On Thursday, June 30, 2016 at 9:17:56 AM UTC+6, Artyom Shalkhakov wrote:

On Wednesday, June 29, 2016 at 9:54:39 AM UTC+6, gmhwxi wrote:

Thanks for the effort!

These days I have been thinking about building some sort of on-line coding
system of ATS. The manaco editor looks pretty decent. When your syntax
definition
is ready, I will give it a try.

I’m currently in the process of writing unit-tests (caught a bug with a
comment already!).

It’s taking quite some time. Will let you know if something fruitful comes
out of it.

On Monday, June 27, 2016 at 11:58:42 AM UTC-4, Artyom Shalkhakov wrote:

Thanks Hongwei! I will take a look to see if this is what my syntax
definition captures tomorrow.

Here’s the code, in a gist:

https://gist.github.com/ashalkhakov/a86dfb4770cff12d0cdf298405a58d74

It can be tested by visiting:

https://microsoft.github.io/monaco-editor/monarch.html

and pasting the syntax definition into the textbox. I’ve also provided
an example input (some rubbish to help figure out if hilighting is
well-behaved).

This needs more testing and tuning, but seems like a worthwhile effort!

On Monday, June 27, 2016 at 9:20:16 PM UTC+6, gmhwxi wrote:

Let

INT0 = [0-9]*
INT1 = (0 | 1-9)
DOT = [.]
EXP = eE

Then FLOAT is

(INT1)(EXP) | (INT1)(DOT)(INT0)(EXP)? | (DOT)(INT1)(EXP)?

There are also hexadecimal floating point numbers:

HEX0 = [0-9a-z]*
HEX1 = (0 | 1-9a-z)
DOT = [.]
EXP = pP

HEXFLOAT = (HEX1)(EXP) | (HEX1)(DOT)(HEX0)(EXP?) | (DOT)(HEX1)(EXP?)

In C, EXP? should be EXP for hexadecimal floating point numbers.

On Monday, June 27, 2016 at 4:06:42 AM UTC-4, Artyom Shalkhakov wrote:

I’m doing a syntax highlighter for ATS based on the Monarch editor
(used in Visual Studio Code) and I’m interested to know what’s the lexical
grammar for floating-point constants?

I’ve tried looking through the lexer source code, but I find it quite
complicated. I’d like some help on this one.


#4

This is great news!

I really want to try it for my upcoming class.

Could you show me how to use the Monaco editor to
replace the textareas in the following page:

http://myflask-tutoriats.rhcloud.com/assign01
view-source:http://myflask-tutoriats.rhcloud.com/assign01

Thanks!On Tuesday, August 16, 2016 at 12:07:35 AM UTC-4, Artyom Shalkhakov wrote:

The PR adding ATS/Postiats colorization support to Monaco editor has been
merged.

On Thursday, June 30, 2016 at 9:17:56 AM UTC+6, Artyom Shalkhakov wrote:

On Wednesday, June 29, 2016 at 9:54:39 AM UTC+6, gmhwxi wrote:

Thanks for the effort!

These days I have been thinking about building some sort of on-line
coding
system of ATS. The manaco editor looks pretty decent. When your syntax
definition
is ready, I will give it a try.

I’m currently in the process of writing unit-tests (caught a bug with a
comment already!).

It’s taking quite some time. Will let you know if something fruitful
comes out of it.

On Monday, June 27, 2016 at 11:58:42 AM UTC-4, Artyom Shalkhakov wrote:

Thanks Hongwei! I will take a look to see if this is what my syntax
definition captures tomorrow.

Here’s the code, in a gist:

https://gist.github.com/ashalkhakov/a86dfb4770cff12d0cdf298405a58d74

It can be tested by visiting:

https://microsoft.github.io/monaco-editor/monarch.html

and pasting the syntax definition into the textbox. I’ve also provided
an example input (some rubbish to help figure out if hilighting is
well-behaved).

This needs more testing and tuning, but seems like a worthwhile effort!

On Monday, June 27, 2016 at 9:20:16 PM UTC+6, gmhwxi wrote:

Let

INT0 = [0-9]*
INT1 = (0 | 1-9)
DOT = [.]
EXP = eE

Then FLOAT is

(INT1)(EXP) | (INT1)(DOT)(INT0)(EXP)? | (DOT)(INT1)(EXP)?

There are also hexadecimal floating point numbers:

HEX0 = [0-9a-z]*
HEX1 = (0 | 1-9a-z)
DOT = [.]
EXP = pP

HEXFLOAT = (HEX1)(EXP) | (HEX1)(DOT)(HEX0)(EXP?) | (DOT)(HEX1)(EXP?)

In C, EXP? should be EXP for hexadecimal floating point numbers.

On Monday, June 27, 2016 at 4:06:42 AM UTC-4, Artyom Shalkhakov wrote:

I’m doing a syntax highlighter for ATS based on the Monarch editor
(used in Visual Studio Code) and I’m interested to know what’s the lexical
grammar for floating-point constants?

I’ve tried looking through the lexer source code, but I find it quite
complicated. I’d like some help on this one.


#5

EXP should be

eE?(INT1)On Monday, June 27, 2016 at 11:20:16 AM UTC-4, gmhwxi wrote:

Let

INT0 = [0-9]*
INT1 = (0 | 1-9)
DOT = [.]
EXP = eE

Then FLOAT is

(INT1)(EXP) | (INT1)(DOT)(INT0)(EXP)? | (DOT)(INT1)(EXP)?

There are also hexadecimal floating point numbers:

HEX0 = [0-9a-z]*
HEX1 = (0 | 1-9a-z)
DOT = [.]
EXP = pP

HEXFLOAT = (HEX1)(EXP) | (HEX1)(DOT)(HEX0)(EXP?) | (DOT)(HEX1)(EXP?)

In C, EXP? should be EXP for hexadecimal floating point numbers.

On Monday, June 27, 2016 at 4:06:42 AM UTC-4, Artyom Shalkhakov wrote:

I’m doing a syntax highlighter for ATS based on the Monarch editor (used
in Visual Studio Code) and I’m interested to know what’s the lexical
grammar for floating-point constants?

I’ve tried looking through the lexer source code, but I find it quite
complicated. I’d like some help on this one.


#6

Let

INT0 = [0-9]*
INT1 = (0 | 1-9)
DOT = [.]
EXP = eE

Then FLOAT is

(INT1)(EXP) | (INT1)(DOT)(INT0)(EXP)? | (DOT)(INT1)(EXP)?

There are also hexadecimal floating point numbers:

HEX0 = [0-9a-z]*
HEX1 = (0 | 1-9a-z)
DOT = [.]
EXP = pP

HEXFLOAT = (HEX1)(EXP) | (HEX1)(DOT)(HEX0)(EXP?) | (DOT)(HEX1)(EXP?)

In C, EXP? should be EXP for hexadecimal floating point numbers.On Monday, June 27, 2016 at 4:06:42 AM UTC-4, Artyom Shalkhakov wrote:

I’m doing a syntax highlighter for ATS based on the Monarch editor (used
in Visual Studio Code) and I’m interested to know what’s the lexical
grammar for floating-point constants?

I’ve tried looking through the lexer source code, but I find it quite
complicated. I’d like some help on this one.


#7

Thanks for the effort!

These days I have been thinking about building some sort of on-line coding
system of ATS. The manaco editor looks pretty decent. When your syntax
definition
is ready, I will give it a try.On Monday, June 27, 2016 at 11:58:42 AM UTC-4, Artyom Shalkhakov wrote:

Thanks Hongwei! I will take a look to see if this is what my syntax
definition captures tomorrow.

Here’s the code, in a gist:

https://gist.github.com/ashalkhakov/a86dfb4770cff12d0cdf298405a58d74

It can be tested by visiting:

https://microsoft.github.io/monaco-editor/monarch.html

and pasting the syntax definition into the textbox. I’ve also provided an
example input (some rubbish to help figure out if hilighting is
well-behaved).

This needs more testing and tuning, but seems like a worthwhile effort!

On Monday, June 27, 2016 at 9:20:16 PM UTC+6, gmhwxi wrote:

Let

INT0 = [0-9]*
INT1 = (0 | 1-9)
DOT = [.]
EXP = eE

Then FLOAT is

(INT1)(EXP) | (INT1)(DOT)(INT0)(EXP)? | (DOT)(INT1)(EXP)?

There are also hexadecimal floating point numbers:

HEX0 = [0-9a-z]*
HEX1 = (0 | 1-9a-z)
DOT = [.]
EXP = pP

HEXFLOAT = (HEX1)(EXP) | (HEX1)(DOT)(HEX0)(EXP?) | (DOT)(HEX1)(EXP?)

In C, EXP? should be EXP for hexadecimal floating point numbers.

On Monday, June 27, 2016 at 4:06:42 AM UTC-4, Artyom Shalkhakov wrote:

I’m doing a syntax highlighter for ATS based on the Monarch editor (used
in Visual Studio Code) and I’m interested to know what’s the lexical
grammar for floating-point constants?

I’ve tried looking through the lexer source code, but I find it quite
complicated. I’d like some help on this one.


#8

Great job!On Tuesday, August 16, 2016 at 3:58:28 AM UTC-4, Artyom Shalkhakov wrote:

On Tuesday, August 16, 2016 at 11:15:51 AM UTC+6, gmhwxi wrote:

This is great news!

I really want to try it for my upcoming class.

Could you show me how to use the Monaco editor to
replace the textareas in the following page:

http://myflask-tutoriats.rhcloud.com/assign01
view-source:http://myflask-tutoriats.rhcloud.com/assign01

Sure! I will see if I can do something ASAP. (Pretty busy with other stuff
lately…)

Thanks!

On Tuesday, August 16, 2016 at 12:07:35 AM UTC-4, Artyom Shalkhakov wrote:

The PR adding ATS/Postiats colorization support to Monaco editor has
been merged.

On Thursday, June 30, 2016 at 9:17:56 AM UTC+6, Artyom Shalkhakov wrote:

On Wednesday, June 29, 2016 at 9:54:39 AM UTC+6, gmhwxi wrote:

Thanks for the effort!

These days I have been thinking about building some sort of on-line
coding
system of ATS. The manaco editor looks pretty decent. When your syntax
definition
is ready, I will give it a try.

I’m currently in the process of writing unit-tests (caught a bug with a
comment already!).

It’s taking quite some time. Will let you know if something fruitful
comes out of it.

On Monday, June 27, 2016 at 11:58:42 AM UTC-4, Artyom Shalkhakov wrote:

Thanks Hongwei! I will take a look to see if this is what my syntax
definition captures tomorrow.

Here’s the code, in a gist:

https://gist.github.com/ashalkhakov/a86dfb4770cff12d0cdf298405a58d74

It can be tested by visiting:

https://microsoft.github.io/monaco-editor/monarch.html

and pasting the syntax definition into the textbox. I’ve also
provided an example input (some rubbish to help figure out if hilighting is
well-behaved).

This needs more testing and tuning, but seems like a worthwhile
effort!

On Monday, June 27, 2016 at 9:20:16 PM UTC+6, gmhwxi wrote:

Let

INT0 = [0-9]*
INT1 = (0 | 1-9)
DOT = [.]
EXP = eE

Then FLOAT is

(INT1)(EXP) | (INT1)(DOT)(INT0)(EXP)? | (DOT)(INT1)(EXP)?

There are also hexadecimal floating point numbers:

HEX0 = [0-9a-z]*
HEX1 = (0 | 1-9a-z)
DOT = [.]
EXP = pP

HEXFLOAT = (HEX1)(EXP) | (HEX1)(DOT)(HEX0)(EXP?) | (DOT)(HEX1)(EXP?)

In C, EXP? should be EXP for hexadecimal floating point numbers.

On Monday, June 27, 2016 at 4:06:42 AM UTC-4, Artyom Shalkhakov wrote:

I’m doing a syntax highlighter for ATS based on the Monarch editor
(used in Visual Studio Code) and I’m interested to know what’s the lexical
grammar for floating-point constants?

I’ve tried looking through the lexer source code, but I find it
quite complicated. I’d like some help on this one.


#9

Thanks for the effort!

These days I have been thinking about building some sort of on-line coding
system of ATS. The manaco editor looks pretty decent. When your syntax
definition
is ready, I will give it a try.

I’m currently in the process of writing unit-tests (caught a bug with a
comment already!).

It’s taking quite some time. Will let you know if something fruitful comes
out of it.


#10

Thanks Hongwei! I will take a look to see if this is what my syntax
definition captures tomorrow.

Here’s the code, in a gist:

It can be tested by visiting:

https://microsoft.github.io/monaco-editor/monarch.html

and pasting the syntax definition into the textbox. I’ve also provided an
example input (some rubbish to help figure out if hilighting is
well-behaved).

This needs more testing and tuning, but seems like a worthwhile effort!On Monday, June 27, 2016 at 9:20:16 PM UTC+6, gmhwxi wrote:

Let

INT0 = [0-9]*
INT1 = (0 | 1-9)
DOT = [.]
EXP = eE

Then FLOAT is

(INT1)(EXP) | (INT1)(DOT)(INT0)(EXP)? | (DOT)(INT1)(EXP)?

There are also hexadecimal floating point numbers:

HEX0 = [0-9a-z]*
HEX1 = (0 | 1-9a-z)
DOT = [.]
EXP = pP

HEXFLOAT = (HEX1)(EXP) | (HEX1)(DOT)(HEX0)(EXP?) | (DOT)(HEX1)(EXP?)

In C, EXP? should be EXP for hexadecimal floating point numbers.

On Monday, June 27, 2016 at 4:06:42 AM UTC-4, Artyom Shalkhakov wrote:

I’m doing a syntax highlighter for ATS based on the Monarch editor (used
in Visual Studio Code) and I’m interested to know what’s the lexical
grammar for floating-point constants?

I’ve tried looking through the lexer source code, but I find it quite
complicated. I’d like some help on this one.


#11

This is great news!

I really want to try it for my upcoming class.

Could you show me how to use the Monaco editor to
replace the textareas in the following page:

http://myflask-tutoriats.rhcloud.com/assign01
view-source:http://myflask-tutoriats.rhcloud.com/assign01

Sure! I will see if I can do something ASAP. (Pretty busy with other stuff
lately…)