tests: make throw of non-strings optional/soft.
[jackhill/mal.git] / vb / step0_repl.vb
1 Imports System
2 Imports Mal
3
4 Namespace Mal
5 Class step0_repl
6 ' read
7 Shared Function READ(str As String) As String
8 Return str
9 End Function
10
11 ' eval
12 Shared Function EVAL(ast As String, env As String) As String
13 Return ast
14 End Function
15
16 ' print
17 Shared Function PRINT(exp As String) As String
18 Return exp
19 End Function
20
21 ' repl
22 Shared Function REP(str As String, env As String) As String
23 Return PRINT(EVAL(READ(str), env))
24 End Function
25
26 Shared Function Main As Integer
27 Dim args As String() = Environment.GetCommandLineArgs()
28
29 If args.Length > 1 AndAlso args(1) = "--raw" Then
30 Mal.readline.SetMode(Mal.readline.Modes.Raw)
31 End If
32
33 ' repl loop
34 Dim line As String
35 Do
36 line = Mal.readline.Readline("user> ")
37 If line is Nothing Then
38 Exit Do
39 End If
40 If line = "" Then
41 Continue Do
42 End If
43 Console.WriteLine(REP(line, ""))
44 Loop While True
45 Return 0
46 End function
47 End Class
48 End Namespace