LFGo /

Filename Size Date modified Message
ex
49 B
2.7 KB
9.5 KB

LFGo: Lisp-Flavoured Go

(C) 2016 Kim, Taegyoon

LFGo is a programming language that transcompiles to Go. It uses Lisp-like syntax.

Usage

$ racket l++.rkt -h
l++.rkt [ <option> ... ] [<filenames>] ...
 where <option> is one of
  -c, --compile : Compile only; do not run
  -v, --verbose : Display verbose messages
  -o <file> : Place the output into <file>
  --help, -h : Show this help
  -- : Do not treat any remaining argument as a switch (at this level)
 Multiple single-letter switches can be combined after one `-'; for
  example: `-h-' is the same as `-h --'

Syntax and semantics

See the source code for details.

Comments

; #! end-of-line comment

#| nestable block comment |#

#; S-expression comment

See Reading Comments.

Macros

Macros are supported via Racket's macro system define-syntax, define-syntax-rule and defmacro.

Examples

Hello, World!

(import "fmt")
(main
  (fmt.Println "Hello, World!"))

Run with

$ racket lfgo.rkt ex/hello.lfgo
Hello, World!

Other examples

Other examples are in the ex directory.

99 Bottles of Beer

(import "fmt")
(main
  (for (def i 99) (>= i 1) (-- i)
    (fmt.Println i "bottles of beer on the wall," i "bottles of beer.")
    (fmt.Println "Take one down and pass it around," (- i 1) "bottle of beer on the wall.")))

License

Copyright 2016 Kim, Taegyoon

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.