axion-lang / axion Goto Github PK
View Code? Open in Web Editor NEWExperimental programming metalanguage, targeting on intertranspiling with other languages.
License: GNU General Public License v3.0
Experimental programming metalanguage, targeting on intertranspiling with other languages.
License: GNU General Public License v3.0
fn sum (a: int, b: int) -> int
return a + b
Note: Regular/anonymous functions are implemented as FunctionDef
class.
Example:
count = x match
1: "one"
2: "two"
3: "three"
_: "?"
Note: Implemented as a macro.
Found an exception occurring when trying to render error/warning.
This can be done simpler.
In cases with equal line indentation, like:
use:
System: Module1;
Axion: Module2;
Etc;
Lexer products Unknown
token instead of nothing.
Should be fixed to v. 0.2.9.5.
C-style:
class A { x: int; y: int; }
1-Expression style:
fn (x: int) x * x * x
Indentation-style:
class A
x: int
y: int
At the moment compiler logic enforces explicit span (start/end location) marking for expressions.
Idea is in marking the span while binding expression part to it's parent.
This is achieved by usage of Bind(Node)
and InitIfNull(NodeList<Node>)
in Node
-based properties.
class Point (x: Int, y: Int)
Note: Implemented as a NodeList<Expr> DataMembers
property of ClassDef
.
When block has function
/class
/struct
/other top level expression, then C# doesn't allow semicolons to be placed after that expressions.
for example:
Axion:
fn Hello
Console.WriteLine("Hello, world!")
C#:
void Hello() {
Console.WriteLine("Hello, world!");
}; // semicolon here is not permitted
// (results in 'error CS1597: Semicolon after method or accessor block is not valid')
Is this project still alive? I love the idea of language orientatet programming. I am the developer of backlang and I want to make axion a full robsu language that can be compiled to il, like backlang does.
Related to #13.
Syntax:
import
system
io
collections.generic
reflection
axion
core { specification, compiler }
How would you build a dsl with this?
like only expand macros in a certain context:
mydsl { do x on after y unless z }
bin = 2::100101
oct = 8::523521
hex = 16::C0FFEE
tri = 36::V13HZ
doz = 12::138A3B
Transpiler converts any x++
- like expression to ++ (x)
one.
Invalid code is here:
Consider the following macros definition snippet:
macro for-in-statement ('for', item: Atom, 'in', iterable: Infix, scope: Scope)
macro for-index-statement ('for', init: Any, ',', condition: Infix, ',', step: Infix, scope: Scope)
return {{
$init
while $condition {
$scope
$step
}
}}
And piece of code that uses it:
for (x, y) in zip(1..9, 9..1) Console.print(x, y)
First macro will try to match it, but it'll fail and report error.
Then, 2-nd macro will match successfully, but error will remain.
Doc-comment for every function-expression builder and every expression constructor should contain valid ANTLR grammar rule, describing syntax of constructing expression.
Doc-comment format:
<summary>
<c>
expression: syntax;
</c>
</summary>
Every expression rule should end with expr
(except for comprehension
, name
, definition
and type
expressions).
There is a check, that for
keyword is not placed at new line, to resolve that code:
Axion:
<expression>
for x in y
code()
not to be parsed as for comprehension
(<expression> for x in y
).
But also, for
is allowed to be placed in that context:
(float(f)
for a in l
...
for f in e
unless e.length == 0)
and, because of newline
check, we must write it like:
(float(f) for a in l
...
for f in e
unless e.length == 0)
so, for
allowed to be placed on new line if it's invoked by function, that parses
collection expression embraced in ()
, {}
or []
.
Example:
fn makemap[T](g: T, seq: List[T]
a: int = 1 # immediate assignment (type can be omitted)
b = 2 # type is inferred
c: int # type required without initializer
let a: int = 1 # immediate assignment
let b = 2 # type is inferred
let c: int # type required without initializer
c = 3 # deferred assignment (now type of `let c` can be omitted)
Render exception like:
Error: Unknown operator.
8| someInt $= 340
^^
src\main.ax,
line 8, column 9.
Feature is already partially implemented.
messages =
friends
|> Seq.map(fn (x): x.Messages)
|> Seq.concat
Note: Implemented as infix operator, converted to regular FuncCallExpr
through traversing.
Multiple arguments usage still unimplemented.
End of multiple line strings, like:
string1 = f"""Multiline
string literal"""
string2 = f```Multiline
string literal```
is missed by Lexer due to invalid algorithm here:
Modules should be organized by nesting directories.
Definitions from one module should have straight accessibility from other module's parts.
e.g: examine the hierarchy:
app1
- frontend
- button.ax
- list-view.ax
- backend
- converter.ax
- parser.ax
Here, parts of module frontend
should have access to each other without imports.
Same goes for backend
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.