/usr/share/mozart/examples/gump/LambdaParser.ozg is in mozart-doc 1.4.0-8ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | declare
parser LambdaParser from GumpParser.'class'
meth error(VS) Scanner in
GumpParser.'class', getScanner(?Scanner)
{System.showInfo 'line '#{Scanner getLineNumber($)}#': '#VS}
end
token
'define' ';' '=' ')'
'.': leftAssoc(1)
'APPLY': leftAssoc(2)
'lambda': leftAssoc(2)
'(': leftAssoc(2)
'id': leftAssoc(2)
'int': leftAssoc(2)
syn program(?Definitions ?Terms)
!Definitions={ Definition($) }*
!Terms={ Term($) // ';' }+
end
syn Definition($)
'define' 'id'(I) '=' Term(T) ';' => definition(I T)
end
syn Term($)
'lambda' 'id'(I) '.' Term(T) => lambda(I T)
[] Term(T1) Term(T2) prec('APPLY') => apply(T1 T2)
[] '(' Term(T) ')' => T
[] 'id'(I) Line(L) => id(I L)
[] 'int'(I) => int(I)
end
syn Line($)
skip => {GumpParser.'class', getScanner($) getLineNumber($)}
end
end
|