[racket-users] Re: Writing to serial port?

2021-09-23 Thread Zeta Convex
Ah, OK. It seems fairly straightforward:

(system "stty -F /dev/ttyACM0 115200 crtscts")

(define out 0)
(set! out (open-output-file "/dev/ttyACM0" #:mode 'binary #:exists 'append))
;(set! in  (open-input-file  port-name #:mode 'binary))
(file-stream-buffer-mode out 'none)
(write-byte whatever out)

(close-output-port out)

On Thursday, 23 September 2021 at 18:31:53 UTC+1 Zeta Convex wrote:

>
> How do I write to a serial port? I'm on Linux, and want a baud rate of 
> 115200.
>
> I'm new to Scheme. I can't seem to find a library to do what I want.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/2ee59fe3-1543-4fea-80ea-a03cc72aa014n%40googlegroups.com.


[racket-users] Writing to serial port?

2021-09-23 Thread Zeta Convex

How do I write to a serial port? I'm on Linux, and want a baud rate of 
115200.

I'm new to Scheme. I can't seem to find a library to do what I want.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/b9d76bfd-6c40-4f12-b9ad-7cc1947ce047n%40googlegroups.com.


[racket-users] Re: parser-tools/lex

2018-08-10 Thread Zeta Convex


On Friday, 10 August 2018 13:57:18 UTC+1, Zeta Convex wrote:
>
> I'm trying to match anything that isn't a tab or space, but I end up 
> matching nearly everything. 
>

Ah, I think I just figured it out. I need to replace 

>*[(:+ (complement (:or #\Tab #\Space)))*
>

with 
[(+(char-complement (:or #\Tab #\Space)))

It took me a long time to figure that out!

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] parser-tools/lex

2018-08-10 Thread Zeta Convex
I'm trying to match anything that isn't a tab or space, but I end up 
matching nearly everything. Here's a snip from the code:

(define tsv-lexer
  (lexer
   [(eof) 'EOF]
   [#\space (tsv-lexer input-port)]
   [#\tab (tsv-lexer input-port)]
   *[(:+ (complement (:or #\Tab #\Space)))*
(begin
  (display "lexeme is:")
  (displayln lexeme)
  (token-FIELD lexeme))]
 ))

If use input "AAA " I get the output:
lexeme is:AAA 
but it should be matching just AAA. What's going wrong?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] bf "module: initial import is not a well-formed module path"

2018-08-09 Thread Zeta Convex


On Thursday, 9 August 2018 21:34:16 UTC+1, Shu-Hung You wrote:
>
> Change the first few lines of lang/reader.rkt to: 
>
> #lang s-exp syntax/module-reader 
> *bf/language *
> #:read my-read 
> #:read-syntax my-read-syntax 
> ;; ... 
>
> Ah yes, that did it! Thanks!

And just install the entire directory as a package using raco pkg 
> install. 


I just installed it into my collects directory rather than using raco. 

I  typed my stuff in using his tutorial, rather than anything from planet.


> I'm still getting application error after that, but I'm not sure what 
> went wrong. 
>
>
Actually, everything is now working fine for me. Thanks for your help.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: bf "module: initial import is not a well-formed module path"

2018-08-09 Thread Zeta Convex
OK. I had a partial success. reader.rkt needs to start with something like:

#lang s-exp syntax/module-reader
"language.rkt"
#:read my-read
#:read-syntax my-read-syntax
...

except that I can't run my BF program (hello2.rkt) from an arbitrary 
directory, because it doesn't know where to locate language.rkt.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] bf "module: initial import is not a well-formed module path"

2018-08-09 Thread Zeta Convex
 I'm following the example from "F*dging up a Racket" at 

https://www.hashcollision.org/brainfudge/index.html 

I set up a project within ~/.racket/6.12/collects: 

. 
├── bf 
│   ├── hello2.rkt 
│   ├── hello.rkt 
│   ├── lang 
│   │   └── reader.rkt 
│   ├── language.rkt 
│   ├── parser.rkt 
│   └── semantics.rkt 


I don't have a planet account, so I'm jiggling with the code. 

Should I be setting up new collections directly under 
~/.racket/6.12/collects (because that's what I've done)? 

I've got the file reader.rkt as follows: 

#lang s-exp syntax/module-reader 
(require "../language.rkt") 
#:read my-read 
#:read-syntax my-read-syntax 

(require "../parser.rkt") 


(define (my-read in) 
  (syntax->datum (my-read-syntax #f in))) 

(define (my-read-syntax src in) 
  (parse-expr src in)) 


The file hello2.rkt contains: 

#lang bf 
++[><-]>. 
>++[>++<-]>+. 
+++..+++.>[>+++<-]>. 
<+++[><-]>.<+++[>+<-]>. 
>>.+++.--..>>+. 

When I try to run this file, I get the error message: 

module: initial import is not a well-formed module path in: (require 
"../language.rkt") 
Module Language: invalid language specification in: (require 
"../language.rkt") 

If I comment out reader.rkt:(require "../language.rkt") I get the message: 

syntax/module-reader: must specify either a module language, or #:language 

So I guess I need to specify a module language, but I don't know how to do 
that. 



-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.