Skip to content

Commit f150fee

Browse files
committed
Add Factor Support
1 parent fcc990f commit f150fee

File tree

3 files changed

+156
-0
lines changed

3 files changed

+156
-0
lines changed

LANGUAGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ Expect (exp)
7575
Extensible Stylesheet Language Transformations (xslt,xsl)
7676
F# (fs,fsi,fsx,fsscript)
7777
F* (fst)
78+
Factor (factor)
7879
Fennel (fnl)
7980
FIDL (fidl)
8081
Fish (fish)

examples/language/factor.factor

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
! Written for SCC by CapitalEx
2+
USING: combinators io kernel math.order math.parser random
3+
ranges ;
4+
IN: simple-guessing-game
5+
6+
: pick-number ( -- n )
7+
100 [1..b] random ;
8+
9+
: read-number ( -- n )
10+
"Enter a guess: " write readln dec> ;
11+
12+
: guessing-game ( n -- )
13+
dup read-number <=> dup {
14+
{ +lt+ [ "Too high!" print t ] }
15+
{ +gt+ [ "Too low!" print t ] }
16+
[ drop "You won!" print f ]
17+
} case [ guessing-game ] [ drop ] if ;
18+
19+
MAIN: [
20+
"I'm thinking of a number between 1 and 100" print
21+
pick-number
22+
guessing-game
23+
]

languages.json

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2119,6 +2119,138 @@
21192119
],
21202120
"quotes": []
21212121
},
2122+
"Factor" :{
2123+
"complexitychecks": [
2124+
"if",
2125+
"when",
2126+
"unless",
2127+
"if*",
2128+
"when*",
2129+
"unless*",
2130+
"?if",
2131+
"?",
2132+
"cond",
2133+
"case",
2134+
2135+
"cond>quot",
2136+
"case>quot",
2137+
"alist>quot",
2138+
2139+
"while",
2140+
"until",
2141+
"loop",
2142+
2143+
"0&&",
2144+
"1&&",
2145+
"2&&",
2146+
"3&&",
2147+
"n&&",
2148+
"&&",
2149+
2150+
"0||",
2151+
"1||",
2152+
"2||",
2153+
"3||",
2154+
"n||",
2155+
"||",
2156+
2157+
"and",
2158+
"or",
2159+
"xor",
2160+
2161+
"eq",
2162+
"=",
2163+
2164+
"smart-if",
2165+
"smart-if*",
2166+
"smart-when",
2167+
"smart-when*",
2168+
"smart-unless",
2169+
"smart-unless*"
2170+
],
2171+
"extensions": [
2172+
"factor"
2173+
],
2174+
"multi_line": [
2175+
[
2176+
"![[",
2177+
"]]"
2178+
],
2179+
[
2180+
"![=[",
2181+
"]=]"
2182+
],
2183+
[
2184+
"![==[",
2185+
"]==]"
2186+
],
2187+
[
2188+
"![===[",
2189+
"]===]"
2190+
],
2191+
[
2192+
"![====[",
2193+
"]====]"
2194+
],
2195+
[
2196+
"![=====[",
2197+
"]=====]"
2198+
],
2199+
[
2200+
"![======[",
2201+
"]======]"
2202+
],
2203+
[
2204+
"/*",
2205+
"*/"
2206+
],
2207+
[
2208+
"((",
2209+
"))"
2210+
]
2211+
],
2212+
"line_comment": [
2213+
"!"
2214+
],
2215+
"quotes": [
2216+
{
2217+
"start": "\"",
2218+
"end": "\""
2219+
},
2220+
{
2221+
"start": "STRING:",
2222+
"end": ";"
2223+
},
2224+
{
2225+
"start": "[======[",
2226+
"end": "]======]"
2227+
},
2228+
{
2229+
"start": "[=====[",
2230+
"end": "]====]"
2231+
},
2232+
{
2233+
"start": "[====[",
2234+
"end": "]====]"
2235+
},
2236+
{
2237+
"start": "[===[",
2238+
"end": "]===]"
2239+
},
2240+
{
2241+
"start": "[==[",
2242+
"end": "]==]"
2243+
},
2244+
{
2245+
"start": "[=[",
2246+
"end": "]=]"
2247+
},
2248+
{
2249+
"start": "[[",
2250+
"end": "]]"
2251+
}
2252+
]
2253+
},
21222254
"Fennel": {
21232255
"complexitychecks": [
21242256
"(for",

0 commit comments

Comments
 (0)