Should we add an AST in the bootstrap?

8 views
Skip to first unread message

Bill Cox

unread,
Mar 19, 2023, 12:47:11 PM3/19/23
to Rune language discussion
Rust macros manipulate the AST, which is very cool, IMO.  The C version of the Rune compiler parsed directly into its database data structures, without an AST.  Also, the bootstrap will have a dynamic LALR(1) parser since yacc doesn't support Rune, and I'd like to better support domain-specific languages.  Being able to directly manipulate the AST in Rune would aid building DSLs.

Bill

0dminnimda

unread,
Mar 19, 2023, 1:10:47 PM3/19/23
to Rune language discussion
Will having an AST make the binding easier? IMHO the first bootstrap should only have features needed to bootstrap itself. The bootstrap version shouldn't be the v1.0 and should not promise any more than "there are enough features to compile me"

Bill Cox

unread,
Mar 20, 2023, 8:39:56 AM3/20/23
to 0dminnimda, Rune language discussion
If we re-implement my old dynamic LALR-1 parser in Rune (my default plan), we'll have an AST to start, and instead of writing C code in yacc rules (in pares/deparse.y), we'll write Rune code in a separate file to do a pass over the AST to build the database data structures.

The simplest thing might actually be writing a recursive-descent parser in Rune that directly fills out database objects.

On Sun, Mar 19, 2023 at 10:10 AM 0dminnimda <0dmin...@gmail.com> wrote:
Will having an AST make the binding easier? IMHO the first bootstrap should only have features needed to bootstrap itself. The bootstrap version shouldn't be the v1.0 and should not promise any more than "there are enough features to compile me"

--
You received this message because you are subscribed to the Google Groups "Rune language discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rune-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rune-discuss/f2293736-2e48-4b0d-91a4-2716d42b6138n%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Aiden Hall

unread,
Mar 20, 2023, 2:04:00 PM3/20/23
to Bill Cox, 0dminnimda, Rune language discussion
I see no reason not to allow manipulation of the AST - as Bill says we'll necessarily have one anyways. However I also agree that this (and really any other new features) should be written only after the bootstrap is largely completed, so we can maintain as close to 1:1 compatibility between compilers as is feasible.

Reply all
Reply to author
Forward
0 new messages