Languages Features Calendar CSV Lists Blog About Sponsor Add Language
GitHub icon



< >

S-expressions is a data notation created in 1960.

#225on PLDB 62Years Old 1.6kUsers
0Books 0Papers

In computing, s-expressions, sexprs or sexps (for "symbolic expression") are a notation for nested list (tree-structured) data, invented for and popularized by the programming language Lisp, which uses them for source code as well as data. In the usual parenthesized syntax of Lisp, an s-expression is classically defined as an atom, or an expression of the form (x . y) where x and y are s-expressions. Read more on Wikipedia...

Example from Wikipedia:
def parse_sexp(string): """ >>> parse_sexp("(+ 5 (+ 3 5))") [['+', '5', ['+', '3', '5']]] """ sexp = [[]] word = '' in_str = False for char in string: if char is '(' and not in_str: sexp.append([]) elif char is ')' and not in_str: if word: sexp[-1].append(word) word = '' temp = sexp.pop() sexp[-1].append(temp) elif char in (' ', '\n', '\t') and not in_str: if word: sexp[-1].append(word) word = '' elif char is '\"': in_str = not in_str else: word += char return sexp[0]
nemerle.html 路 s-expressions.html 路 lolcode.html

View source

PLDB - Build the next great programming language 路 v2022 Day 93 Docs Build Acknowledgements Traffic Today Traffic Trends Mirrors GitHub