"I don't want to die in a language I can't understand."
- Jorge Luis Borges

Latest version: 0.8.0
Release date: 21th April 2019
Price: Free. No nags and No expiry date.
Source code: Incuded.
Self Hosted: No other tools required to modify/rebuild Phix.
-
-- Phix has just five builtin data types -- -- <======== object =========> -- | | -- +-atom +-sequence -- | | -- +-integer +-string --
-
-- Phix is simple puts(1, "Hello, World!") -- and can be interpreted or compiled: $ p hello Hello, World! $ p -c hello Hello, World!
-
-- Phix is multi-platform C:\Phix> p hello Hello, World! ~/phix$ .\p hello Hello, World! ?iff(platform()=WINDOWS?"Windows":"Linux")
-
-- user-defined types made simple type pair(object p) return sequence(p) and length(p)=2 end type pair p1 = {2,3} -- ok pair p2 = {2,4,6} -- fails p1 &= 0 -- fails -
-- line comments /* multiline comments /* nestable */ */
-
-- naturally polymorphic ?sort({1, 1.5, "oranges", -9, 1e300, 100, "apples"}) Output: {-9,1,1.5,100,1e+300,"apples","oranges"} -
-- one difference worth learning sequence s1 = {1,2,3}, s2 = {4,5,6} ?s1&s2 ?append(s1,s2) Output: {1,2,3,4,5,6} {1,2,3,{4,5,6}} -
-- negative subscripts are permitted sequence s = tagset(6) ?s s[-2..-1] = {-2,-1} ?s --s[5..6] = {-2,-1} -- equivalent Output: {1,2,3,4,5,6} {1,2,3,4,-2,-1} -
-- fully mutable strings string this = "feed" string that = this -- both=="feed" that[2..3] = "oo" -- that:="food" this[1] = 'n' -- this:="need" ?{this,that} Output: {"need","food"} -
-- variable length slice substitution string s = "food" ?s s[2..3] = "e" ?s s[2..1] = "east" ?s Output: "food" "fed" "feasted"
-
-- Phix comes with batteries included... include builtins\timedate.e set_timedate_formats({"h:m:s"}) timedate start = parse_date_string("10:37:15"), ended = parse_date_string("12:38:14") ?elapsed(timedate_diff(start,ended)) Output: "2 hours and 59s" -
-- associative arrays aka dictionaries setd("one",1) setd(2,"duo") ?getd("one") ?getd(2) Output: 1 "duo" -
-- exception handling try integer i = 1/0 catch e ?e[E_USER] end try puts(1,"still running...\n") Output: "attempt to divide by 0" still running...
-
-- regular expressions include builtins\regex.e ?gsub(`\ba\b`,"I am a string","another") Output: "I am another string"
Phix is Pete’s Self Hosted Hybrid Interpreter/Compiler
pshhic was
not the best of acronyms, plus phiX is the name of the first ever
manmade lifeform artifically created from scratch in a laboratory, which seems
rather appropriate for a self-hosted compiler
Aims:
- Create an easy to use programming language which is also easy to modify and maintain.
- Bug location must be made as easy as possible.
If as some studies suggest up to 90% of effort is actually spent fixing bugs, it follows that the
toolchain should be strongly focused on the expediency with which bugs can be located and fixed
- at least those in otherwise well written code; obviously anything difficult to understand in
the first place will more than likely prove at least as tricky the second time round, should
it go wrong.
In Phix, all errors, both compile-time and run-time, are human-readable and indicate the precise file and line where they happened, and Edita jumps right there. - Allow the programmer to focus on solving the problem, rather than solving the solution.
- Terse may at first seem nice, but properly readable and easy to understand code is better.
“Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.”
- Antoine de Saint-Exupéry

“Simplicity is the ultimate sophistication.”
- Leonardo da Vinci
(as commonly attributed, eg
,
but see
)
“A language that doesn’t have everything is actually easier to program in than some that do.”
- Dennis M. Ritchie
“Are you quite sure that all those bells and whistles, all those wonderful facilities of your so called
powerful programming languages, belong to the solution set rather than the problem set?”
- Edsger W. Dijkstra
“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible,
you are, by definition, not smart enough to debug it.”
- Brian W. Kernighan
“The unavoidable price of reliability is simplicity.”
- C.A.R. Hoare
“Any intelligent fool can make things bigger, more complex, and more violent.
It takes a touch of genius - and a lot of courage - to move in the opposite direction.”
- Albert Einstein
from Hacker News http://phix.x10.mx/
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.