Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
TclForth: Forth to Tcl transpiler (github.com/wejgaard)
51 points by blacksqr on March 23, 2017 | hide | past | favorite | 7 comments


Forth solely based on Tcl/Tk - nice idea! This allows me to write GUI scripts without having to deal with the TCL syntax, and without being dependent on bindings to other languages. This is the KISS principle in action!

However, there are two little bugs (in Linux).

1) "Help / tclForth Guide" causes an error message because an URL cannot be executed as a script. You should take reference to the BROWSER environment variable. This should also work in OSX.

2) When I start the chess GUI there also appears an empty window named "chess.tcl". Is it possible to keep this window close?

You should mention on your homepage that the tcl scripts should be started with "wish", or you should add the following two lines at the top of the tcl scripts:

  #!/bin/sh
  exec wish "$0" ${1+"$@"}
By the way, how can I handle command line arguments?


Compiler. Like clang or gcc - a program that converts from one language to another.

  $ cat hello.c
  #include <stdio.h>
   
  int main(void)
  {
          printf("hello world\n");
   
          return 42;
  }

  $ cc -O3 -S hello.c -o -
          .section	__TEXT,__text,regular,pure_instructions
          .macosx_version_min 10, 12
          .globl	_main
          .align	4, 0x90
  _main:                                  ## @main
          .cfi_startproc
  ## BB#0:
          pushq	%rbp
  Ltmp0:
          .cfi_def_cfa_offset 16
  Ltmp1:
          .cfi_offset %rbp, -16
          movq	%rsp, %rbp
  Ltmp2:
          .cfi_def_cfa_register %rbp
          leaq	L_str(%rip), %rdi
          callq	_puts
          movl	$42, %eax
          popq	%rbp
          retq
          .cfi_endproc
   
          .section	__TEXT,__cstring,cstring_literals
  L_str:                                  ## @str
          .asciz	"hello world"
   
   
  .subsections_via_symbols


Fully agree. Not sure why you are being downvoted. The word 'transpiler' annoys me a great deal because we already had a word in frequent use for that.


The project README doesn't use this word either.

The Forth source code is compiled to Tcl procedures for execution in the Tcl run time system.


assembly source is the byproduct of compilers not their output.


Generally speaking compiler will take C/C++/Go/whatever and produce assembly as output. The Assembler will produce take this output .asm/.s and produce some form of binary. The Linker will take these binaries and produce an executable you can run.

Note this is oversimplified (and in some cases wrong) but the general point is that when you call a "compiler" you're generally calling a high-level utility that ties a number of separate components together.


Neat project and potentially worth playing with. Appears to be abandoned though, sadly.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: