Anonlang - Anonsage Language
I like thinking about programming language design. So, here's a few thoughts and sample syntax of the latest iteration I'm working on:
Output 'Hello, World!':<h1 'Hello, World!'>
Simple Temperature converter: fahrenheit = celsius * 1.8 + 32
'Fahrenheit: ' <input id=fah type=number bind=solve(fahrenheit, celsius=cel)>
'Celsius: ' <input id=cel type=number bind=solve(celsius, fahrenheit=fah)>
Alternatively: fah = <input type=number>
cel = <input type=number>
fah = cel * 1.8 + 32
'Fahrenheit: ' <fah>
'Celsius: ' <cel>
Simple TODO list with local and remote storage: storage_key = 'tasks'
pref_key = 'user_storage_type_pref'
local_storage = platform.storage
remote_storage = url(https://example.com/api/storage)
user_storage = local_storage(pref_key) otherwise remote_storage(pref_key) otherwise local_storage
get_tasks() = user_storage(storage_key) otherwise mutable_list()
tasks = get_tasks()
save_task(value) = tasks.add(value) then user_storage(storage_key).add(value)
remove_task(value) = tasks.remove(value) then user_storage(storage_key).remove(value)
set_user_storage_type(storage_type) = local_storage(pref_key).set(storage_type) then remote_storage(pref_key).set(storage_type) then user_storage.update() then tasks.update()
<checkbox text='Use remote storage?'
on_check=set_user_storage_type(remote_storage)
on_uncheck=set_user_storage_type(local_storage)>
<input hint='Add a task' on_key_enter=save_task(input.text)>
<list bind=tasks template(task)=`<checkbox on_check=remove_task(task)> task`>
Basic Syntax
- Data types and interfaces: Iterable, Text, Number, List, Set, Map, View - Casting: `.to*` - Control logic: if-else, loop-in, Ex: `if isTrue() loop char in row in file doSomething(char) else doSomethingElse()`Open questions
- `then` can used the same/similar to bash's pipe | - Can calling a variable and 0-arg function be done the same way? Ceylon?Posts:
- Loop Syntax
- Data Type Conversion Syntax
- Comment Syntax
- Anondata
- Fuzzy Logic
- Pivot
- An Idealist's Journey
- Zero-Based Arrays vs One-Based Arrays
- As a templating language
- Syntax: Scope
- Security
- Matrix Multiplication 2
- Syntax: Matrix Multiplication
- Pattern: MVC
- Implementation
- config.anon
- Syntax: Scope
- Syntax: Comments 2
- Syntax: Comments
- Thought: Linear Algebra Metaphor
- Syntax Update
- Basic Syntax
- Pivot: From Language to ...
- String Concatenation with String Variables
- Exploring Possible Visibility Modifier for the Ideal Language to the Extreme
- Better Functions, Methods, and Fields
- About Libraries
- Language Design for Developers First
- Developer-First Language
- Anonlang - The cross-platform cross-language developer-friendly language