168 lines
		
	
	
		
			3.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			168 lines
		
	
	
		
			3.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| 
 | |
| continue 99 ##ERROR: syntax error - excessive argument to 'continue' around '99'
 | |
| 
 | |
| ---
 | |
| 
 | |
| break "hello" 20 ##ERROR: syntax error - excessive argument to 'break' around 'hello'
 | |
| 
 | |
| ---
 | |
| 
 | |
| return ##ERROR: syntax error - no value specified for 'return'
 | |
| 
 | |
| ---
 | |
| 
 | |
| return 1 2 ##ERROR: syntax error - excessive argument to 'return' around '2'
 | |
| 
 | |
| ---
 | |
| 
 | |
| ## TODO: improve the return to show the actual parenthensis like around '('
 | |
| return 1 (+ 1 2) ##ERROR: syntax error - excessive argument to 'return' around ''
 | |
| 
 | |
| ---
 | |
| 
 | |
| ## the expression begins with a dictionary expression. 
 | |
| ## it is not a function name and can'be be invoked.
 | |
| #{100:1, 200: 3}; ##ERROR: syntax error - invalid callable
 | |
| 
 | |
| ---
 | |
| 
 | |
| ## you must enclose the binary expression with parentheses
 | |
| ## i := (i + 20)
 | |
| 
 | |
| i:=0;
 | |
| while(i < 20) {
 | |
| 	printf "hello world 안녕하신가\n"
 | |
| 	i := i + 20 ##ERROR: syntax error - prohibited binary selector '+'
 | |
| }
 | |
| 
 | |
| ---
 | |
| 
 | |
| if  ##ERROR: syntax error - no conditional expression after 'if'
 | |
| 
 | |
| ---
 | |
| 
 | |
| if (< 2 3) elif  ##ERROR: syntax error - block expression expected as 'if' body
 | |
| 
 | |
| ---
 | |
| 
 | |
| if (< 2 3) {} elif true else  ##ERROR: syntax error - block expression expected as 'elif' body
 | |
| 
 | |
| ---
 | |
| 
 | |
| if else ##ERROR: syntax error - 'else' prohibited in this context
 | |
| 
 | |
| ---
 | |
| 
 | |
| if elif else ##ERROR: syntax error - 'elif' prohibited in this context
 | |
| 
 | |
| ---
 | |
| 
 | |
| if (< 20 30) ##ERROR: syntax error - block expression expected as 'if' body
 | |
| 
 | |
| ---
 | |
| 
 | |
| if (< 20 30) {
 | |
| 	printf "ok\n"
 | |
| } { ##ERROR: syntax error - redundant expression prohibited after 'if' body
 | |
| 	printf "ok2\n"
 | |
| }
 | |
| 
 | |
| ---
 | |
| 
 | |
| if (< 20 30) else { ##ERROR: syntax error - block expression expected as 'if' body
 | |
| 	printf "ok\n"
 | |
| }
 | |
| 
 | |
| 
 | |
| ---
 | |
| 
 | |
| elif (< 20 30) { } ##ERROR: syntax error - elif without if
 | |
| 
 | |
| ---
 | |
| 
 | |
| else (< 20 30) { } ##ERROR: syntax error - else without if
 | |
| 
 | |
| ---
 | |
| 
 | |
| catch (e) {} ##ERROR: syntax error - catch without try
 | |
| 
 | |
| ---
 | |
| 
 | |
| try {} catch ##ERROR: syntax error - no exception variable for 'catch'
 | |
| 
 | |
| ---
 | |
| 
 | |
| try {
 | |
| 	throw "excetion message"
 | |
| } catch (e a) { ##ERROR: syntax error - improper exception variable for 'catch'
 | |
| 	printf "EXCEPTION - %s\n" e
 | |
| }
 | |
| 
 | |
| ---
 | |
| 
 | |
| try { throw "1111"; } catch (e) ##ERROR: syntax error - block expression expected as 'catch' body
 | |
| 
 | |
| ---
 | |
| 
 | |
| try { throw "1111"; } catch (e) {
 | |
| 	printf "EXCEPTION - %s\n" e
 | |
| } 20 ##ERROR: syntax error - redundant expression prohibited after
 | |
| 
 | |
| ---
 | |
| 
 | |
| {
 | |
| 	| a |
 | |
| 
 | |
| 	a := 30
 | |
| 	fun a:get_999() { ##ERROR: exception not handled - "not class"
 | |
| 		return  999;
 | |
| 	}
 | |
| }
 | |
| 
 | |
| 
 | |
| ---
 | |
| 
 | |
| fun a:get_999() { ##ERROR: exception not handled - "a accessed without initialization"
 | |
| 	return  999;
 | |
| }
 | |
| 
 | |
| ---
 | |
| 
 | |
| k := (core.basicAt "abcdefg" 1)
 | |
| core.basicAtPut "xbcdefghiklmnl" 4 k ##ERROR: exception not handled - "receiver immutable - \"xbcdefghiklmnl\""
 | |
| 
 | |
| ---
 | |
| 
 | |
| k := (core.basicAt #abcdefg 1)
 | |
| core.basicAtPut #xbcdefghiklmnl 4 k ##ERROR: exception not handled - "receiver immutable - xbcdefghiklmnl"
 | |
| 
 | |
| ---
 | |
| 
 | |
| ## the compiler/runtime needs to improve on this although this is an error for now.
 | |
| fun + (a b) {}
 | |
| printf "%O\n" #{+: 20} ##ERROR: no builtin hash implemented for #<BLOCK>
 | |
| 
 | |
| ---
 | |
| 
 | |
| class X {
 | |
| 	fun + () {} ##ERROR: syntax error - only one argument expected for '+'
 | |
| }
 | |
| 
 | |
| ---
 | |
| 
 | |
| ## the binop method defined for a class must have one argument
 | |
| class X {
 | |
| 	fun + (t) {}
 | |
| 	fun f1 (t1 t2) {}
 | |
| }
 | |
| 
 | |
| fun X:- (a b) {} ##ERROR: syntax error - only one argument expected for 'X:-'
 | |
| 
 | |
| ---
 | |
| 
 | |
| class X {
 | |
|      fun[#ci] +(a b c) { printf "jjj\n" } ## the one argument rule applies to binary instance methods only.
 | |
|      fun +(c d) { printf "jjj\n" } ##ERROR: syntax error - only one argument expected for '+'
 | |
| }
 | |
| 
 |