feat: generate unified AST and editor contracts from ASDL
Verify databases and deploy Aster VM / verify-and-deploy (push) Successful in 7m55s
Verify databases and deploy Aster VM / verify-and-deploy (push) Successful in 7m55s
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
-- Endor AST schema. Source syntax belongs to lexer.peg and grammar.peg.
|
||||
-- Wire contract: endor-ast-json/1, kind/data tagged sums and UTF-8 byte spans.
|
||||
-- Builtins: string (owned text), span (UTF-8 byte range), schema_id (wire ID).
|
||||
-- * is a sequence; ? is optional. Recursion is boxed by the Rust generator.
|
||||
module Endor {
|
||||
AstDocument = (schema_id schema, AstRoot root)
|
||||
AstRoot = Module(Program body)
|
||||
| Expression(Expr body)
|
||||
| Interactive(InteractiveInput body)
|
||||
|
||||
Name = (string text, span span)
|
||||
Program = (Decl* declarations, span span)
|
||||
Decl = (DeclKind kind, span span)
|
||||
DeclKind = Function(Function definition)
|
||||
Function = (Name name, Parameter* parameters, Name return_type, Block body, span span)
|
||||
Parameter = (Name name, Name type_name, span span)
|
||||
Block = (Stmt* statements, span span)
|
||||
Stmt = (StmtKind kind, span span)
|
||||
StmtKind = Binding(Binding binding)
|
||||
| Return(ReturnStatement statement)
|
||||
| Expression(Expr expression)
|
||||
| Declaration(Decl declaration)
|
||||
Binding = (Name name, Expr value, span span)
|
||||
ReturnStatement = (Expr? value, span span)
|
||||
InteractiveInput = (Stmt* statements, span span)
|
||||
|
||||
Expr = (ExprKind kind, span span)
|
||||
ExprKind = Name(string text)
|
||||
| Number(string spelling)
|
||||
| String(string value)
|
||||
| Symbol(Name name)
|
||||
| Unary(UnaryOp operation, Expr operand)
|
||||
| Binary(BinaryOp operation, Expr left, Expr right)
|
||||
| Member(Expr object, Name name)
|
||||
| Call(Expr callee, Expr* arguments)
|
||||
UnaryOp = Negate
|
||||
BinaryOp = Add | Subtract | Multiply | Divide
|
||||
}
|
||||
Reference in New Issue
Block a user