unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* more on nyacc extension languages
@ 2018-08-31 14:42 Matt Wette
  2018-09-01 19:38 ` Matt Wette
  0 siblings, 1 reply; 2+ messages in thread
From: Matt Wette @ 2018-08-31 14:42 UTC (permalink / raw)
  To: guile-user

Just goofing off a bit:

scheme@(guile-user)> ,use (nyacc lang nx-lib)
scheme@(guile-user)> (install-inline-language-evaluator)

scheme@(guile-user)> #<nx-matlab: a=[1, 2, 3]; >#
scheme@(guile-user)> (define b (vector-ref a 2))
scheme@(guile-user)> #<nx-javascript: var c = b + 2; >#
scheme@(guile-user)> c
$1 = 5

scheme@(guile-user)> (define d 1)
scheme@(guile-user)> (set! d #<nx-matlab: d + 1; >#)
scheme@(guile-user)> (set! d #<nx-javascript: d + 1; >#)
scheme@(guile-user)> d
$2 = 3

This is using read-hash-extend with a handler that looks
up the language then compiles the code to tree-il, then
decompiles to scheme and returns the scheme form.

Matt




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-09-01 19:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-31 14:42 more on nyacc extension languages Matt Wette
2018-09-01 19:38 ` Matt Wette

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).