Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programming language besides Tcl where everything is string

Are there any programming languages where everything is a string. For example, let's consider this Tcl snippet (comments shows the equivalent statement in C/Java) for e.g.

set x [append ab cd] ;# c = "ab" + "cd"
set m 1 ;# m = 1
set n [expr $m + 1] ;# n = m + 1

Effectively, this is reverse of what is found in languages like C or Java; here by default what we type is a literal string unless it is a "special" word or preceded by $ sign (in which case, the string succeeding $ is a variable).

like image 325
DurgaDatta Avatar asked Feb 15 '26 06:02

DurgaDatta


1 Answers

Rexx (Restructured Extended Executor) and OORexx are two languages with the same philosophy:

In Rexx -- somewhat like in TCL -- to a large extent everything is a string. Having stacks and streams composed of lines gives you a simple list or array of strings. But mostly, strings simply act like other datatypes as needed. For example, a string that contains a suitable representation of a number (digits, decimal, an exponent "e", etc.) can be used in arithmetic operations. For processing reports, log files, and the like, this is exactly the behavior you want.

*nix has many such mini-languages. For example:

  • sed
  • tr
  • cut
  • paste
  • join
  • fmt
  • split
  • pr
  • fold

References

  • ANSI X3J18-199X Standard for Rexx (pdf)
  • Rexx Functions – Standard vs Non-Standard
  • GNU Coreutils
  • Tokenize a String: tr
  • FizzBuzz: sed
  • CSV to HTML translation: sed
  • GUI Scripting: JavaScript, Smalltalk, Tcl, AutoHotkey: Arrays - Hyperpolyglot
like image 199
5 revsPaul Sweatte Avatar answered Feb 17 '26 19:02

5 revsPaul Sweatte



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!