Skip to content
This repository has been archived by the owner on Dec 12, 2023. It is now read-only.

Runtime #16

Closed
cevr opened this issue Apr 24, 2021 · 4 comments
Closed

Runtime #16

cevr opened this issue Apr 24, 2021 · 4 comments

Comments

@cevr
Copy link

cevr commented Apr 24, 2021

Is there a runtime for this as well?

Similar to how in graphql you can create documents by using the 'gql' function, would it be possible to create state machines in the same way?

I saw a twitter post too with this exact approach.

https://twitter.com/n_moore/status/1385986489797029894?s=21

I look forward to this project's growth 😃

@mattpocock
Copy link

A parse function would also be excellent:

import { parseToJson } from '@lucylang/node';

const machine = parseToJson(
`
// Lucy file in here
`
)

@matthewp
Copy link
Collaborator

matthewp commented May 6, 2021

@mattpocock is this meant to return an AST? Or is this the JSON representation from the other issue?

@mattpocock
Copy link

@matthewp Probably the same JSON representation from the other issue. Though I'd assume we'd add methods for the raw parsing to JS, too.

@matthewp
Copy link
Collaborator

I never properly addressed this issue. Some background: I originally started on Lucy a couple of years ago and tagged template literals is how it originally worked. You can see the original version here: https://github.com/matthewp/lucy/blob/main/packages/xstate/test/guard-test.js#L10

For various reasons I put the project aside until I started it back up recently. I decided it was best to define the language as a standalone thing first. Recently I've been more interested in trying out a tagged template approach again. It wouldn't work with things like use but for the most part the new language should work well. The question is can it be done in a small package. The current compiler wouldn't work of course, it would need to be a new JS based parser / compiler.

That is to say I'm interested to try and work on this, but it won't be for at least a little while until the TS support and various tooling is more mature. Then I might come back around to this idea as I do think there is a segment of people who would be more likely to use Lucy if they didn't need to use a separate language file and associated tooling.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants