4 ms·
-- no commas SELECT employee_name company_name salary state_code city FROM employees Or
by neilv 4y ago
-- no commas
SELECT employee_name
company_name
salary
state_code
city
FROM employees
Or:
(select (employee_name
company_name
salary
state_code
city)
from employees)
- marcosdumay 4y agoOk, now add complex expressions on your list, and watch how hard to verify it becomes.
- neilv 4y agoI've done SQL with an s-expression syntax, and found it at least as easy to read as normal SQL syntax. Do you have an example that would be harder to read?
- saltcured 4y agoI think the main issue is that talking by trivial examples does not communicate a coherent syntax. The audience can imagine completely different corner cases when they fill in the gaps differently than how you intended. I don't think your example looks very s-expressiony with the FROM keyword in the middle of the sequence. To me, s-expr means the keyword in the first slot labels the form to interpret the rest of the sequence. The outer form should either have positional slots to implicitly interpret each part by different rules or an unordered set of slots that will each have their own labeled form. Consider instead something like: ;; (QUERY select from where) (query (e1 e2 ...) (r1 r2 ...) (e1 e2 ...)) ;; (QUERY parts...) (query (select e1 e2 ...) (from r1 r2 ...) (where e1 e2 ...) ...) Also, existing SQL syntaxes have some places where parenthesis has a special syntactic purpose and others where it is optional. It is rather convoluted to define unambiguous parses for some of these. For someone familiar with any of this, it would be hard not to bring in false assumptions about how a hybrid language would work that brings in parentheses for other structuring purposes.
- marcosdumay 4y agoOk, so your option on the "separators on the left" vs. "separators on the right" discussion is putting parenthesis on both sides? You don't care much about syntax, do you?
- saulpw 4y agoIf we're going for non-delimited, then all expressions must be wrapped in parentheses. Doesn't seem hard.
- wizofaus 4y agoHow is that non-delimited? Spaces and parentheses are still delimiters. Non-delimited would imply fixed-width tokens, binary machine language would be one of the very few that qualify.