Back to articles
Comp Language Syntax

Comp Language Syntax

via Dev.toPeter Shinners

An ongoing series in my quest to untangle my own thoughts and goals for the Comp programming language. A language focused on developer experience? So much of my focus has been on the syntax and grammar. The entire concept is built on a handful of core fundamental rules that everything expands from. No separators or terminators Whitespace independent No line-based statements No indentation Along with these fundamentals there are a few other strongly motivated designs. Use kabab-case for identifiers No keywords Avoid nesting braces Along with that there is has been from-the-start requirement that the structure literal has two forms. {1 2 3} for positional sequences (lists, arrays) {a=1 b=2} for named mappings (dicts, hashes) This has been a long and ongoing puzzle, but the payoff has been spectacular. Let's look at another small code example and call out a few highlights. ! func shopping-cart-demo ( { { "Apple" price = 1.00 } { "Banana" price = 0.50 quantity = 2 } { "Apple" 1.00 quantity

Continue reading on Dev.to

Opens in a new tab

Read Full Article
8 views

Related Articles