Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Factor Support #363

Merged
merged 1 commit into from
Jan 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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