Compiler/Verifying syntax: Difference between revisions

m
→‎{{header|Go}}: Minor adjustments to remove some superfluous white-space.
(Added Go)
m (→‎{{header|Go}}: Minor adjustments to remove some superfluous white-space.)
Line 67:
e = strings.ReplaceAll(e, strings.TrimSpace(sub[1]), strings.TrimSpace(sub[0]))
}
return strings.Split(e, ":")[2][1:] // remove location info as may be inaccurate
}
 
Line 90:
_, err := parser.ParseExpr(expr)
if err != nil {
fmt.Println(`"false" -> `, modify(err))
} else {
fmt.Println(`"true"`)
Line 104:
 
Statement to verify: " and 3 < 2"
"false" -> expected operand, found 'and'
 
Statement to verify: "not 7 < 2"
Line 113:
 
Statement to verify: "235 76 + 1"
"false" -> expected 'EOF', found 76
 
Statement to verify: "a + b = not c and false"
Line 119:
 
Statement to verify: "ab_c / bd2 or < e_f7"
"false" -> expected operand, found '<'
 
Statement to verify: "g not = h"
9,482

edits