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
Lithe
(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!
==Examples== Programming in Lithe consists of defining rule-action pairs and classes. Take the task of computing the [[absolute value]] of a number, for example: '''rule''' "|" <i:'''int'''> "|" '''return int'''; {'''if''' i<0 '''then return''' -i '''else return''' i '''end'''} After this rule-action pair has been defined, it can be freely used within Lithe source code, for example, the following expression will thereafter be valid: |x - y| + 3 The equivalent rule in [[Backus–Naur form|BNF]] would be: <'''int'''> ::= "|" <'''int'''> "|" Note that the Lithe description swaps the left and right sides of the BNF one, then adds a name to each nonterminal in the BNF right-hand side. These names are used in the action part, which is expressed as a string that is translated into a sequence of actions by using other, previously defined, rule-action pairs (eventually, some of those rule-action pairs will invoke primitive actions).
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)