Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constant values #137

Open
timothee-haudebourg opened this issue Apr 28, 2023 · 0 comments
Open

Constant values #137

timothee-haudebourg opened this issue Apr 28, 2023 · 0 comments
Labels
enhancement New feature or request scope:semantics Related to the semantics of TreeLDR scope:syntax Related to the syntax of TreeLDR

Comments

@timothee-haudebourg
Copy link
Collaborator

I propose to add a new construct in TreeLDR: constants. A constant is a named construct, just like a layout, struct field, or enum variant that holds a value formatted with a given layout.

The general syntax is:

const Name: Layout = Value ;

For instance:

const PI: xs:decimal = 3.1415;

This will require implementing value expressions.

Such a constant can then be exported in the target language as a constant definition. For instance in Rust:

const PI: f64 = 3.1415;
@timothee-haudebourg timothee-haudebourg added enhancement New feature or request scope:syntax Related to the syntax of TreeLDR scope:semantics Related to the semantics of TreeLDR labels Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request scope:semantics Related to the semantics of TreeLDR scope:syntax Related to the syntax of TreeLDR
Projects
None yet
Development

No branches or pull requests

1 participant