Open jmeaster30 opened 6 months ago
This might be easier cause I made a thing that let's parser phase 1 send a whole ast node to parser phase 2 instead of just a list of tokens
Actually I have an idea for annotations there are going to be 3 kinds
@Trace
@Operator(
symbol: +,
precedence: 10,
order: infix
)
Or
@Operator(+, 10, infix)
@@ Documentation
This function does really neat stuff
@@
Declaring an annotation:
@Annotation(
name: Trace,
scope: function
)
function trace_annotation(function_name: string, target_function: func(auto Arguments...)->(auto Returns...), annotation_parameters: AnnotationParameters, arguments: Arguments) -> (result: Returns...) { }
For parameters in declaring an annotation it could be nice to just make a struct that holds the parameters:
union OperatorOrder {
Prefix,
Postfix,
Infix,
}
pack OperatorParameters {
symbol: string,
precedence: u32,
order: OperatorOrder
}
@Annotation (
name: "Operator",
scope: function,
parameters: OperatorParameters
)
Blah blah blah
Ordering of things will be as follows as a result
This does make me think that the symbol table should be built into the ast so we can easily do multiple passes to get everything checked semantically
Moved the parser to phase 1. Block annotations would still need to be parsed a little bit
Renaming cause I want to have a central place to track the annotation overhaul stuff
I would like to have the annotation parser be part of the phase 1 parser so that we can have better parsing of annotations.
For example, it would improve functionality around online annotations for function parameters and even individual statement macros (like the hydro macros).
It would probably allow hydro macros to be specifically in expressions (which is phase 2 parsing I guess). The main issue with having a hydro macros is then all the hydro keywords have to become ocean keywords :(
TODO:
Unanswered Questions: