uniblab icon

processing words

uniblab | PRO | 12/05/20 04:14:03 AM UTC (Edited) | 0 ⭐ | 2156 👁️ | Never ⏰ | []
C# |

460 B

|

None

|

0 👍

/

0 👎

var line = System.Console.In.ReadLine().TrimToNull();
while ( !System.String.IsNullOrEmpty( line ) ) {
    foreach ( var word in ReadWord( line ) ) {
        var operator = FindWord( word );
        if ( null == operator ) {
            var wordNotFound = new System.InvalidOperationException( "word not found: " + word );
            wordNotFound.Data.Add( "word", word );
            throw wordNotFound;
        }
        stack = operator.Execute( stack );
    }
    line = System.Console.In.ReadLine().TrimToNull();
}

Comments