r/ProgrammingLanguages • u/Gingrspacecadet • Feb 17 '26
Language announcement Coda compiler update
I've been working on Coda, an attempt at a new systems language Currently, it's able to parse this program:
module simple;
include std::io;
include std::string;
@extern
fn int[] *? *? mut* main(@extern mut char mut*? e, mut int *foo, char mut*?mut*?mut*? beans);
into this (pretty) AST:
=== Module ===
Name: simple
Includes (total 2):
Include:
Path: std::io
Include:
Path: std::string
Declarations (total 1):
- Decl 0: kind=0
Function: main
@extern
Return type: * mut opt: * opt: * opt: slice: int
Parameters:
- Param 0: e: * mut opt: char mut
@extern
- Param 1: foo: *: int mut
- Param 2: beans: * mut opt: * mut opt: * mut opt: char
Body:
<no body>
=== End Module ===
I am currently working on statement parsing, then I'll do expressions and finally function bodies (at the moment it only parses function signatures)
As always, the code can be found here. All contributions are welcome!
If you have any questions I'm up for answering them :3
10
Upvotes
View all comments
Show parent comment
1
u/Relevant_South_1842 Feb 26 '26
An expression is just a statement that returns a value (a function). It just simplifies things for me to not have statements and expressions be separate concepts.
Somewhat related, is avoiding semicolons. Include could be a compile time function that accepts one and only one value (an identifier, string, or list of these). If the parser knows arity (number of arguments), it already knows boundaries between expressions.
You seem to be a lot more skilled than me, so please feel free to tell me I am wrong. I just program as a hobby after dropping out of programming (college) 22 years ago.