Skip to content

Instantly share code, notes, and snippets.

@darius
Last active December 12, 2023 16:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darius/bb08a378399f2d2f6e56cf1ab71e35a5 to your computer and use it in GitHub Desktop.
Save darius/bb08a378399f2d2f6e56cf1ab71e35a5 to your computer and use it in GitHub Desktop.
Parson (Cant edition) one-liners:
'#' :count ' @ ' :count ',' :count ': ' :count 'x' :count
:count ', ' :count
'Step ' {1} ' must be finished before step ' {1} ' can begin.'
:count ' players; last marble is worth ' :count ' points\n'
'position=<'_ :integer ','_ :integer :list ['> velocity=<'_ :integer ','_ :integer '>' :list]
{5} ' => ' {1}
{1} '=' :integer ', ' {1} '=' :integer '..' :integer
'depth: ' :count '\ntarget: ' [:count ',' :count :list] '\n'
'pos=<' [:integer ',' :integer ',' :integer :list] '>, r=' :integer
[{:letter} :count :tuple] ** ','
(:count | :skip)*
:count '-' :count _ {:letter} ': ' {:letter*}
:count {'cm'|'in'}
{:letter+} _ :integer
'mask = ' {:skip*} | 'mem[' :count '] = ' :count
'Tile ' :count ':'
'Game'_ :count ':'_ [[:count _ {:letter+} :reverse :tuple]**', ' :bag]**'; '
([:position :count :tuple] | :skip)*
'Card'_ :count ':'_ [:count**_ :list]_ '|'_ [:count**_ :list]
'seeds:'_ :count**_
{5} _ :count
{3} ' = (' [{3} ', ' {3} :list] ')'
[{'1'+} {'#'^1-5} :tuple]*
{:letter+} '+' {:letter+} '=' {:letter+}
([:position :letter+ ('\'' :letter+)? :position :list] | :skip)*
({:letter+} | :skip)*
:integer '/' :count
(And one multiline literal:)
'y' :end :'ieth'
| 'one' :end :'first'
| 'two' :end :'second'
| 'three' :end :'third'
| 'five' :end :'fifth'
| 'eight' :end :'eighth'
| 'nine' :end :'ninth'
| 'twelve' :end :'twelfth'
| :end :'th'
| {1} loop
(Grammars that are "more serious" to be collected elsewhere.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment