Re: [racket-users] Writing a "command-line front-end" for a language

2022-09-08 Thread 'Reuben Thomas' via Racket Users
On Mon, 5 Sept 2022 at 02:20, Shu-Hung You wrote: > > Okay, if you want to bypass the #lang protocol entirely, here is the > needed code. As you have expected, it uses eval and then calls > dynamic-require. > Thanks very much for this code and detailed explanation, that was a great help. -- ht

Re: Fwd: [racket-users] Writing a "command-line front-end" for a language

2022-09-08 Thread 'Reuben Thomas' via Racket Users
On Sun, 4 Sept 2022 at 19:39, Philip McGrath wrote: > > You may indeed want a tool that supports files without #lang if you are > working with an existing language and there isn't a way to make the #lang > line acceptable to its existing grammar. > That's exactly it! > Despite the title of the

Re: [racket-users] Writing a "command-line front-end" for a language

2022-09-04 Thread Shu-Hung You
On Sun, Sep 4, 2022 at 4:21 AM Reuben Thomas wrote: > > On Sat, 3 Sept 2022 at 19:10, Shu-Hung You wrote: >> >> Running `racket foo.asm` will produce the desired output, so a shell >> script that directly passes the arguments to Racket could work. >> Otherwise, just use (dynamic-require filename

Re: Fwd: [racket-users] Writing a "command-line front-end" for a language

2022-09-04 Thread Philip McGrath
On Sun, Sep 4, 2022, at 10:00 AM, Reuben Thomas wrote: > On Sun, 4 Sept 2022 at 10:31, Reuben Thomas wrote: >> On Sun, 4 Sept 2022 at 04:13, Philip McGrath >> wrote: >>> >>> However, in some cases you might really want a program other than `racket` >>> as the entry point for your language: for

Re: Fwd: [racket-users] Writing a "command-line front-end" for a language

2022-09-04 Thread 'Reuben Thomas' via Racket Users
On Sun, 4 Sept 2022 at 10:31, Reuben Thomas wrote: > On Sun, 4 Sept 2022 at 04:13, Philip McGrath > wrote: > >> >> However, in some cases you might really want a program other than >> `racket` as the entry point for your language: for instance, maybe you want >> to have flags for controlling whe

Re: Fwd: [racket-users] Writing a "command-line front-end" for a language

2022-09-04 Thread 'Reuben Thomas' via Racket Users
On Sun, 4 Sept 2022 at 04:13, Philip McGrath wrote: > > However, in some cases you might really want a program other than `racket` > as the entry point for your language: for instance, maybe you want to have > flags for controlling where the output goes. One example of such a program > is the `sc

Re: [racket-users] Writing a "command-line front-end" for a language

2022-09-04 Thread 'Reuben Thomas' via Racket Users
On Sat, 3 Sept 2022 at 19:10, Shu-Hung You wrote: > Running `racket foo.asm` will produce the desired output, so a shell > script that directly passes the arguments to Racket could work. > Otherwise, just use (dynamic-require filename #f) in main.rkt. > Thanks for helping! Don't both of these m

Re: Fwd: [racket-users] Writing a "command-line front-end" for a language

2022-09-03 Thread Philip McGrath
On Sat, Sep 3, 2022, at 2:09 PM, Shu-Hung You wrote: > -- Forwarded message - > From: Shu-Hung You > Date: Sat, Sep 3, 2022 at 1:03 PM > Subject: Re: [racket-users] Writing a "command-line front-end" for a language > To: Reuben Thomas > > > Run

Fwd: [racket-users] Writing a "command-line front-end" for a language

2022-09-03 Thread Shu-Hung You
-- Forwarded message - From: Shu-Hung You Date: Sat, Sep 3, 2022 at 1:03 PM Subject: Re: [racket-users] Writing a "command-line front-end" for a language To: Reuben Thomas Running `racket foo.asm` will produce the desired output, so a shell script that directly

[racket-users] Writing a "command-line front-end" for a language

2022-09-03 Thread 'Reuben Thomas' via Racket Users
I'm a relative Racket newbie, and I've just enjoyed *Beautiful Racket*. I am working on a Racket implementation of a simple assembler (for the Hack VM in the NAND2Tetris course). I have a partial implementation up and running using #lang lines. I would like to add a more traditional command-line