Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

neos strikes again!

42 views
Skip to first unread message

Mr Flibble

unread,
May 22, 2019, 3:43:39 PM5/22/19
to
Hi!

It took me just five minutes to add support for escape sequences in an
example programming language's string literal concept:

string_literal: {
is: string.utf8
tokens: {
'\"': {
'\"': done
escape: continue
'\\': error
character: continue
}
}
escape: {
tokens: {
'\\': {
'n': character.LF
character.LF: done
'r': character.CR
character.CR: done
't': character.tab
character.tab: done
'\\': character.backslash
character.backslash: done
}
}
}
}

Designing new programming languages will be quick and easy with neos the
universal compiler that can compile any programming language! :D

/Flibble

--
“You won’t burn in hell. But be nice anyway.” – Ricky Gervais

“I see Atheists are fighting and killing each other again, over who
doesn’t believe in any God the most. Oh, no..wait.. that never happens.” –
Ricky Gervais

"Suppose it's all true, and you walk up to the pearly gates, and are
confronted by God," Bryne asked on his show The Meaning of Life. "What
will Stephen Fry say to him, her, or it?"
"I'd say, bone cancer in children? What's that about?" Fry replied.
"How dare you? How dare you create a world to which there is such misery
that is not our fault. It's not right, it's utterly, utterly evil."
"Why should I respect a capricious, mean-minded, stupid God who creates a
world that is so full of injustice and pain. That's what I would say."

Mr Flibble

unread,
May 22, 2019, 4:32:53 PM5/22/19
to
On 22/05/2019 20:43, Mr Flibble wrote:
> Hi!
>
> It took me just five minutes to add support for escape sequences in an
> example programming language's string literal concept:
>
>     string_literal: {
>         is: string.utf8
>         tokens: {
>             '\"': {
>                 '\"': done
>                 escape: continue
>                 '\\': error
>                 character: continue
>             }
>         }
>         escape: {
>             tokens: {
>                 '\\': {
>                     'n': character.LF
>                     character.LF: done
>                     'r': character.CR
>                     character.CR: done
>                     't': character.tab
>                     character.tab: done
>                     '\\': character.backslash
>                     character.backslash: done
>                 }
>             }
>         }
>     }
>
> Designing new programming languages will be quick and easy with neos the
> universal compiler that can compile any programming language! :D

The obvious question from those who regurgitate the received wisdom of
"established" compiler theory is most likely "Why aren't you using
Backus–Naur form?"

The answer of course is that BNF is all about a programming language's
SYNTAX which is only half of the story: the other half is of course
SEMANTICS! The above schema fragment references two built-in neos
semantic concepts: "string.utf8" and "string.utf8.character" (as
"character").

Another reason is that neos is a cleanroom project so I will not be
referencing any established compiler theory during its design so hopefully
the end result will be unique, interesting and perhaps even a game changer.

Christian Gollwitzer

unread,
May 22, 2019, 4:46:11 PM5/22/19
to
Am 22.05.19 um 21:43 schrieb Mr Flibble:
> It took me just five minutes to add support for escape sequences in an
> example programming language's string literal concept:
> [...]
>
> Designing new programming languages will be quick and easy with neos the
> universal compiler that can compile any programming language! :D

Now please add algebraic data types, like those found in Haskell:

data Tree a = Leaf a | Branch (Tree a) (Tree a)

so that you can write a simple recursive function like counting the
leafs in a tree:

count (Leaf x) = 1
count (Branch x y) = (count x) + (count y)


Simple concept, should be easy to do with your universal compiler.

Christian

Ben Bacarisse

unread,
May 22, 2019, 4:57:03 PM5/22/19
to
Mr Flibble <flibbleREM...@i42.co.uk> writes:

> It took me just five minutes to add support for escape sequences in an
> example programming language's string literal concept:
>
> string_literal: {
> is: string.utf8
> tokens: {
> '\"': {
> '\"': done
> escape: continue
> '\\': error
> character: continue
> }
> }
> escape: {
> tokens: {
> '\\': {
> 'n': character.LF
> character.LF: done
> 'r': character.CR
> character.CR: done
> 't': character.tab
> character.tab: done
> '\\': character.backslash
> character.backslash: done
> }
> }
> }
> }
>
> Designing new programming languages will be quick and easy with neos
> the universal compiler that can compile any programming language! :D

Do you have any real-world examples? For example, what do C11's strings
look like in neos? And in languages that can use either ' or " does the
work need to be duplicated? What about languages with arbitrary (and
sometimes non-identical) delimiters like Perl's q(x)? What about
Fortran's counted Hollerith string constants? Python has "..." as well
as """...""" complicated by the fact that adjacent strings are
syntactically possible. How would neos handle "" " """ being three
strings and """ """ being one? (This might be simple in that there
could be a higher-level of tokens that is not shown in your example.)

--
Ben.

Mr Flibble

unread,
May 22, 2019, 5:03:52 PM5/22/19
to
Don't worry Christian, Haskell will be one of the languages I will be
shipping neos 1.0 with!

Mr Flibble

unread,
May 22, 2019, 5:06:56 PM5/22/19
to
Hi Ben,

The process is to introduce new semantic concepts as and when required as
I implement each language in turn with a view to share as many concepts as
possible across different languages; so to answer your question I will
cross the C11, Fortran, Perl and Python bridges as I come to them.

Ben Bacarisse

unread,
May 22, 2019, 5:58:17 PM5/22/19
to
> The process is to introduce new semantic concepts as and when required
> as I implement each language in turn with a view to share as many
> concepts as possible across different languages; so to answer your
> question I will cross the C11, Fortran, Perl and Python bridges as I
> come to them.

What language are you starting with then? The above does not even cover
old K&R C strings. But I think you would be better off giving at least
two very different real-world examples. Otherwise how can anyone know
that the notation generalises? I suppose more to the point, how can you
know (if you don't try very disparate languages early on) that you have
not boxed yourself into a corner?

--
Ben.

Mr Flibble

unread,
May 22, 2019, 6:13:08 PM5/22/19
to
The schema fragment above is from "neoscript" the neos reference language
of my own design. neoscript aside the first two languages I currently plan
to implement are Java and Haskell which couldn't be any more different.

Ben Bacarisse

unread,
May 22, 2019, 7:39:09 PM5/22/19
to
Hmmm... As different as COLBOL and APL? As different as Fortran and
Occam? As different as Common Lisp and Algol 68? I'm not so sure.
Fortran has a notoriously fussy syntax. Algol 68 has various concrete
forms that are just optional representations of the abstract language.
Lisp has very sophisticated macros...

Java and Haskell as not adjacent in the language space but I would not
put them at opposite ends of the universe.

--
Ben.

unidef

unread,
Jun 10, 2019, 6:53:10 AM6/10/19
to
Mr Flibble <flibbleREM...@i42.co.uk> wrote:
> Hi!
>
> It took me just five minutes to add support for escape sequences in an
> example programming language's string literal concept:
>
> string_literal: {
> is: string.utf8
> tokens: {
> '\"': {
> '\"': done
> escape: continue
> '\\': error
> character: continue
> }
> }
> escape: {
> tokens: {
> '\\': {
> 'n': character.LF
> character.LF: done
> 'r': character.CR
> character.CR: done
> 't': character.tab
> character.tab: done
> '\\': character.backslash
> character.backslash: done
> }
> }
> }
> }
>
> Designing new programming languages will be quick and easy with neos the
> universal compiler that can compile any programming language! :D
>
> /Flibble
>

You’re into making programming languages? I tried to make a network
scripting language but someone took the source and sold it to apple :(

But, try putting your compiler in qemu, link it to the host, and use
multidimensional arrays to create a nexal cluster (I think that’s the right
word)

--
“There is nothing certain in this world, aside from Death or Taxes” -
Benjamin Franklin
0 new messages