doc: add intermediate representation language

This commit is contained in:
2025-01-27 19:19:11 +00:00
parent 251ed8c144
commit b4fd6a999b
3 changed files with 118 additions and 26 deletions

View File

@@ -1,29 +1,28 @@
package net.doorstuck.test
cout put:'Finds the sum of a set of numbers.'
cout put:'Finds the sum of a set of numbers.'.
sum = 0
sum = 0.
while true do
cout print:'Number (blank to finish): '
cout flush
cout print:'Number (blank to finish): '.
cout flush.
input = ''
v = 0
cin get:input
v = 0.
input = cin readLine.
if input == '' then
break
end
try
v = Int parse:input
catch (#err:number_format, err)
cout put:'{input} is not a valid number.'
v = Int parse:input.
if v == null then
cout put:'{input} is not a valid number.'.
continue
end
sum += v
sum += v.
end
cout put:'Sum: {sum}'