Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
FOCAL (programming language)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Comparison with JOSS== FOCAL is, for all intents, a cleaned-up version of JOSS with changes to make the syntax terser and easier to parse. Almost all FOCAL commands have a one-to-one correspondence with JOSS and differ only in details. The most obvious change at first glance is that JOSS is case-insensitive and outputs keywords in mixed-case whereas FOCAL was upper-case only. Additionally, JOSS statements end with a period, making them look like written statements, whereas FOCAL has no required line-ending. One major difference is that JOSS included a complete set of comparison operations and a [[boolean logic]] system that operated within {{code|if}} and {{code|for}} constructs. Furthermore, branches and loops could be applied to any statement, in contrast to FOCAL, where the only operation either could carry out was the equivalent to a goto. For example, in JOSS, one could: 1.10 Type A if X>10. 1.20 Type i for i=1(1)10. The first line optionally prints A based on the value of X, and the second prints the numbers 1 to 10. In contrast, FOCAL lacked the ability to compare values, and loops were applied by skipping to the next line when they completed. The equivalent code in FOCAL would be: 1.10 IF (X-10),,1.30 1.20 TYPE A! 1.30 FOR I=1,1,10;TYPE I,! JOSS' implementation makes common constructs easier to build and more closely match a programmer's intentions, at the cost of making the runtime more complex. For example, JOSS allowed ranges in loops to be described in a flexible fashion like 1,2,3,10(5)50,75,78. This flexibility comes at a cost; in FOCAL the start, stop, and step can be written in a custom in-memory structure and easily updated as the loop is performed, whereas JOSS requires it to reevaluate an expression that may be, but often isn't, more complex. In order to make the code terser in FOCAL, changes were relatively minor. For example, JOSS' {{code|Do part 20.}} becomes the slightly smaller FOCAL {{code|DO 20}}, while {{code|Do step 20.1}} becomes {{code|DO 20.1}}. Command keywords were also shortened where possible, so JOSS' {{code|Demand}} becomes FOCAL's {{code|ASK}}, both to make it shorter and to allow the letter D to be uniquely used for {{code|DO}}. To simplify the parser, some JOSS constructs were removed. For example, JOSS could perform multiple assignments with {{code|Set S{{=}}P, P{{=}}Q, Q{{=}}S.}} while in FOCAL these had to be made individual statements, {{code|SET S{{=}}P; SET P{{=}}Q; SET Q{{=}}S}}. Likewise, JOSS' {{code|Form}}, used to format output, was combined into FOCAL's {{code|TYPE}} with the {{code|%}}.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)