I'm going to start with Script
, and make a random (e.g.: Math.random) valid instance in the ECMAScript language set.
I will not use additional syntax, like HTML Comments. Which i've just rediscovered.
The is at notices will only be there if it's not next.
Between any two tokens can be any amount of whitespace:
- Tab
- Vertical Tab
- Form Feed
- Space
- Non Breaking Space
- Zero Width Non Breaking Space
- Any Other Unicode Code Point In The Category "Space_Seperator"
Usually you can also put any amount of line terminators, but in some place they affect automatic semicolon insertion:
- Line Feed
- Carriage Return
- Line Seperator
- Paragraph Seperator
\CR\LF\ counts as 1 Source Character. 1 \Line Terminator Sequence\.
\CR\ is not a \Line Terminator Sequence\ when followed by \LF\
Comments can also kinda be anywhere, with the exception of multi-line comments that span multiple lines.
They count as 1 Line Terminator.
So here's some new syntax:
Random Token Seperator [No Extra Token Seperator, Non Empty, No Line Terminator]:
- [~Non Empty] <empty>
- [~No Extra Token Seperator] \Any Amount Of Whitespace [?Non Empty]\
- [~No Extra Token Seperator ~Non Empty] \Any Amount Of Comments [?No Line Terminator]\
- [~No Extra Token Seperator ~No Line Terminator] \Any Amount Of Line Terminator [?Non Empty]\
- [~No Extra Token Seperator] \Random Token Seperator[?Non Empty, ?No Line Terminator]\ [No Extra Token Seperator Here] \Random Token Seperator[~Non Empty, ?No Line Terminator]\
SS: Random Token Seperator: Early Errors
Random Token Seperator cannot both have "Non Empty" and "No Extra Token Seperator".
Any Amount Of Whitespace [Non Empty]:
- [~Non Empty] [empty]
- WhiteSpace
- \Any Amount Of Whitespace [+Non Empty]\ [No Extra Token Seperator Here] \WhiteSpace\
Any Amount Of Comments [No Line Terminator]
- \Comment Check [?No Line Terminator]\
- \Any Amount Of Comments [+Non Empty, ?No Line Terminator]\ [No Extra Token Seperator Here] \Comment Check [?No Line Terminator]\
Comment Check [No Line Terminator]
- \Multi Line Comment\ [Lookahead ∉ Line Terminator]
- [~No Line Terminator] \Multi Line Comment\
- [~No Line Terminator] \Single Line Comment\ [No Extra Token Seperator Here] \Any Amount Of Line Terminators_Non_Empty\
Any Amount Of Line Terminators [Non_Empty]
- [~Non_Empty] [empty]
- \Line Terminator\
- \Any Amount Of Line Terminators [+Non_Empty]\ [No Extra Token Seperator Here] \Line Terminator\
Random characters are generated using https://www.babelstone.co.uk/Unicode/unicode.html
The Whitespace is crazy. No one puts random whitespace between every token.
What are the chances: 4 line terminators and then two empty multiline comments in a row!
-
Script:
- \Script Body
opt
\ - Well, if the Script was empty, that would a pretty boring random script.
- This isn't random, but i'm not going to accept empty scripts.
- \Script Body
-
Script Body:
- \Statement List\
-
Statement List
- \Statement List Item\
- \Statement List\ \Statement List Item\
- \Statement List Item\ is at: Todo
-
Statement List
- \Statement List Item\
- \Statement List\ \Statement List Item\
-
Statement List Item
- \Statement\
- \Declaration\ (Wow, this is like a normal program!)
-
Declaration
- \Hoistable Declaration\
- \Class Declaration\
- \Lexical Declaration_In\
-
Lexical Declaration_In
- \Let Or Const\ \Binding List_In\
- \Binding List_In\ is at: 9
-
Let Or Const
- let (This is amazing)
- const
-
Binding List_In
- \Lexical Binding_In\ (Oh my god what a sensible Math.random!)
- \Binding List_In\ , \Lexical Binding_In\
-
Lexical Binding_In
- \Binding Identifier\ \Initializer_In
opt
\ - \Binding Pattern\ \Initializer_In\ (Wait. Hold on to my previous comment... I think it's going to get a Syntax Error.)
- \Initializer_In\ is at: Todo
- Binding Pattern
- \Object Binding Pattern\
- _\Array Binding Pattern_
- Array Binding Pattern
- [ \Elision
opt
\ \Binding Rest Elementopt
\ ] - [ \Binding Element List\ ] (Huh, chose the one without any optional)
- [ \Binding Element List\ , \Elision
opt
\ \Binding Rest Elementopt
\ ]
- Binding Element List
- \Binding Elision Element\
- \Binding Element List\ , \Binding Elision Element\
- \Binding Elision Element\ is at: Todo_
- Binding Element List
- \Binding Elision Element\
- \Binding Element List\ , \Binding Elision Element\
- Binding Elision Element
- \Elision
opt
\ \Binding Element\ opt
result: Include- \Binding Element\ is at: 17_
- Elision
- ,
- \Elision\ ,
- Binding Element
- \Single Name Binding\
- \Binding Pattern\ \Initializer_In
opt
\ opt
result: Include- \Initializer_In\ is at: 25_
- Binding Pattern
- \Object Binding Pattern\
- \Array Binding Pattern\
- Array Binding Pattern
- [ \Elision
opt
\ \Binding Rest Elementopt
\ ] - [ \Binding Element List\ ]
- [ \Binding Element List\ , \Elision
opt
\ \Binding Rest Elementopt
\ ] opt
result: Excludeopt
result: Include
- Binding Rest Element
- ... \Binding Identifier\
- ... \Binding Pattern\
- Binding Identifier
- \Identifier\
- yield
- await
- Identifier
- \Identifier Name\ but not \Reserved Word\
- Identifier Name
- \Identifier Start\
- \Identifier Name\ \Identifier Part\
- Identifier Start
- \Unicode ID Start\
- $
- _
- \ \Unicode Escape Sequence\
- (It chose the underscore)
- Initializer_In
- = \Assignment Expression_In\
- Assignment Expression_In
- \Conditional Expression_In\
- \Arrow Function_In\
- _\Async Arrow Function_In_
- \Left Hand Side Expression_In\ = \Assignment Expression_In\
- \Left Hand Side Expression_In\ \Assignment Operator_In\ \Assignment Expression_In\
- Async Arrow Function_In
- async [No Line Terminator here] \Async Arrow Binding Identifier\ [No Line Terminator here] => \Async Concise Body_In\
- \Cover Call Expression And Async Arrow Head\ [No Line Terminator here] => \Async Concise Body_In\
- \Async Concise Body_In\ is at: 30
- Async Arrow Binding Identifier
- Binding Identifier_Await
- Binding Identifier_Await
- \Identifier\
- yield
- await
- Async Concise Body_In
- _[Lookahead ≠ {] \Expression Body_In_Await_
- { \AsyncFunctionBody\ }
- Expression Body_In_Await
- \Assignment Expression_In_Await\
- Assignment Expression_In_Await
- \Conditional Expression_In_Await\
- \Arrow Function_In_Await\
- \Async Arrow Function_In_Await\ (Again!)
- \Left Hand Side Expression_In_Await\ = \Assignment Expression_In_Await\
- \Left Hand Side Expression_In_Await\ \Assignment Operator_In_Await\ \Assignment Expression_In_Await\
- Async Arrow Function_In_Await
- async [No Line Terminator here] \Async Arrow Binding Identifier\ [No Line Terminator here] => \Async Concise Body_In\
- \Cover Call Expression And Async Arrow Head\ [No Line Terminator here] => \Async Concise Body_In\
- \Async Concise Body_In\ is at: 36
- Async Arrow Binding Identifier
- Binding Identifier_Await
- Binding Identifier_Await
- \Identifier\
- yield
- await
- Async Concise Body_In
- _[Lookahead ≠ {] \Expression Body_In_Await_
- { \AsyncFunctionBody\ }
- Expression Body_In_Await
wwwmc Resulting Code:
let
[/***ᜩ*/,[
..._ �]
=async await=>async yield=>
Tokens todo:
- #3
- #10
- #13
- Latest
Actual characters:
Latin lowercase letter L
Latin lowercase letter E
Latin lowercase letter T
Solidus
Solidus
Paragraph seperator
Left square bracket
Forward slash
Asterisk
Asterisk
Asterisk
U+1729 : HANUNOO LETTER PA
Asterisk
Forward slash
Comma
Left square bracket
Paragraph seperator
Period / Full stop
Period / Full stop
Period / Full stop
Underscore
<ZWNBSP>
<TAB>
<FF>
<ZWNBSP>
<VT>
Right square bracket
<LF>
Equals sign
<FF>
Latin lowercase letter A
Latin lowercase letter S
Latin lowercase letter Y
Latin lowercase letter N
Latin lowercase letter C
Em Space (U+2003)
Latin lowercase letter A
Latin lowercase letter W
Latin lowercase letter A
Latin lowercase letter I
Latin lowercase letter T
Equals sign
Greater than symbol
Latin lowercase letter A
Latin lowercase letter S
Latin lowercase letter Y
Latin lowercase letter N
Latin lowercase letter C
En Quad (U+2000)
<TAB>
<TAB>
Latin lowercase letter Y
Latin lowercase letter I
Latin lowercase letter E
Latin lowercase letter L
Latin lowercase letter D
Equals sign
Greater than symbol
Space
Space
Tab
Right square bracket