Skip to content

Commit

Permalink
Add Factor Support
Browse files Browse the repository at this point in the history
  • Loading branch information
Capital-EX committed Dec 22, 2022
1 parent fcc990f commit f150fee
Show file tree
Hide file tree
Showing 3 changed files with 156 additions and 0 deletions.
1 change: 1 addition & 0 deletions LANGUAGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ Expect (exp)
Extensible Stylesheet Language Transformations (xslt,xsl)
F# (fs,fsi,fsx,fsscript)
F* (fst)
Factor (factor)
Fennel (fnl)
FIDL (fidl)
Fish (fish)
Expand Down
23 changes: 23 additions & 0 deletions examples/language/factor.factor
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
! Written for SCC by CapitalEx
USING: combinators io kernel math.order math.parser random
ranges ;
IN: simple-guessing-game

: pick-number ( -- n )
100 [1..b] random ;

: read-number ( -- n )
"Enter a guess: " write readln dec> ;

: guessing-game ( n -- )
dup read-number <=> dup {
{ +lt+ [ "Too high!" print t ] }
{ +gt+ [ "Too low!" print t ] }
[ drop "You won!" print f ]
} case [ guessing-game ] [ drop ] if ;

MAIN: [
"I'm thinking of a number between 1 and 100" print
pick-number
guessing-game
]
132 changes: 132 additions & 0 deletions languages.json
Original file line number Diff line number Diff line change
Expand Up @@ -2119,6 +2119,138 @@
],
"quotes": []
},
"Factor" :{
"complexitychecks": [
"if",
"when",
"unless",
"if*",
"when*",
"unless*",
"?if",
"?",
"cond",
"case",

"cond>quot",
"case>quot",
"alist>quot",

"while",
"until",
"loop",

"0&&",
"1&&",
"2&&",
"3&&",
"n&&",
"&&",

"0||",
"1||",
"2||",
"3||",
"n||",
"||",

"and",
"or",
"xor",

"eq",
"=",

"smart-if",
"smart-if*",
"smart-when",
"smart-when*",
"smart-unless",
"smart-unless*"
],
"extensions": [
"factor"
],
"multi_line": [
[
"![[",
"]]"
],
[
"![=[",
"]=]"
],
[
"![==[",
"]==]"
],
[
"![===[",
"]===]"
],
[
"![====[",
"]====]"
],
[
"![=====[",
"]=====]"
],
[
"![======[",
"]======]"
],
[
"/*",
"*/"
],
[
"((",
"))"
]
],
"line_comment": [
"!"
],
"quotes": [
{
"start": "\"",
"end": "\""
},
{
"start": "STRING:",
"end": ";"
},
{
"start": "[======[",
"end": "]======]"
},
{
"start": "[=====[",
"end": "]====]"
},
{
"start": "[====[",
"end": "]====]"
},
{
"start": "[===[",
"end": "]===]"
},
{
"start": "[==[",
"end": "]==]"
},
{
"start": "[=[",
"end": "]=]"
},
{
"start": "[[",
"end": "]]"
}
]
},
"Fennel": {
"complexitychecks": [
"(for",
Expand Down

0 comments on commit f150fee

Please sign in to comment.