Re: Grammar for ls -l output

Good points Frederik. This was for personal use, so I only needed to match my own locale. Here is a more generic version:


{ls -l, generic version}
directory: total, entry*.


@total: -[L]+, s, n, -#a.
-s: -" "+.


entry: props, links, user, group, size, date, name, -#a.


props: ["dlrwx-s"]+, s.


links: n, s.


user: id.
group: id.
-id: ~[" "]+, s.


size: n, s.


date: month, day, (year; time), s.
month: [L]+, s.


day: n, s.
year: n.
time: h, -":", m.
h: n.
m: n.


-n: ["0"-"9"]+.
@name: ~[#a]+.



On Thursday 08 January 2026 22:19:26 (+01:00), Fredrik Öhrström wrote:


Nice grammar Steven, though I need to set the english locale for it. My swedish locale spells total as totalt
and has lowercase first characters in the month names, ie Dec is spelt dec. :-)


LANG=en.UTF8 ls -l | xmq ls.ixml












Den tors 8 jan. 2026 kl 21:28 skrev Steven Pemberton <steven.pemberton@cwi.nl <mailto:steven.pemberton@cwi.nl> >:


Sure!


{ls -l}
directory: total, entry*.

@total: -"total", s, n, -#a.
-s: -" "+.

entry: props, links, user, group, size, date, name, -#a.

props: ["dlrwx-s"]+, s.

links: n, s.

user: id.
group: id.
-id: ~[" "]+, s.

size: n, s.

date: month, day, (year; time), s.
month: L, l, l, s.
-L: ["A"-"Z"].
-l: ["a"-"z"].

day: n, s.
year: n.
time: h, -":", m.
h: n.
m: n.

-n: ["0"-"9"]+.
@name: ~[#a]+.


On Thursday 08 January 2026 16:54:40 (+01:00), Peter Flynn wrote:

 > Before I spend any non-trivial amount of time on this, has anyone done
an ixml grammar for the output of the "ls -l" command (with or without
optional bells and whistles)?
 >
 > Peter
 >
 >

Received on Thursday, 8 January 2026 21:25:50 UTC