Simple Preprocessor
Submit
Language is selected by the extension of the file. See the list of supported languages to know the extension of your language.
Problem
Preprocess all input lines using the following steps:
1. Trim all tabs and spaces from the beginning and end of the line
2. If the line is not empty and doesn't start with #, output the line.
Options
exec is denied
now post-mortem time, all source codes will be revealed
Sample input:_
#=======================================
#Preprocessor test file and preprocessor
#=======================================
#Define application attributes
*application 'preprocessor' has entry 'start' and has exit 'finish'
*functionality 'console'
*add module 'core'
*add module 'streams'
*add module 'strings'
#Define entry point
fixed function->start [no arguments, no value]
#Open standard input and output
stream->stdin = getstd(0)
stream->stdout = getstd(1)
#Loop until EOF
fixed loop [exit on stdin@readline(empty) as string->line is null]
#Open an edit block to perform operations only on line
fixed edit line
#Remove all leading and trailing tabs and spaces
fixed loop [exit on @characters(0) as character->check is not in {' ',' '}, exit on @length@value as integer->size is not 0]
@start@modify(@start@value + 1)
complete
fixed loop [exit on @characters(@length@value - 1) as character->check is not in {' ',' '}, exit on @length@value as integer->size is not 0]
@length@modify(@length@value - 1)
complete
complete
#Check if the line is not empty
fixed skip [execute on line@length@value as integer->temp is not 0]
#Check if the line doesn't start with a hash symbol
fixed skip [execute on line@characters(line@length@value - 1) as character->check is not '#']
#Write the new line to the output
stdout@writeline(line)
complete
complete
complete
#Close and finalize all streams
stdin@close(empty)
stdout@flush(empty)
stdout@eof(empty)
stdout@close(empty)
#Clean all variables from memory
destroy {stdin, stdout}
#Exit the function
exit(empty)
complete
#Define exit point
fixed function->finish [no arguments, value is integer]
#Return successful exit code
exit(0)
complete
Sample output:
*application 'preprocessor' has entry 'start' and has exit 'finish'
*functionality 'console'
*add module 'core'
*add module 'streams'
*add module 'strings'
fixed function->start [no arguments, no value]
stream->stdin = getstd(0)
stream->stdout = getstd(1)
fixed loop [exit on stdin@readline(empty) as string->line is null]
fixed edit line
fixed loop [exit on @characters(0) as character->check is not in {' ',' '}, exit on @length@value as integer->size is not 0]
@start@modify(@start@value + 1)
complete
fixed loop [exit on @characters(@length@value - 1) as character->check is not in {' ',' '}, exit on @length@value as integer->size is not 0]
@length@modify(@length@value - 1)
complete
complete
fixed skip [execute on line@length@value as integer->temp is not 0]
fixed skip [execute on line@characters(line@length@value - 1) as character->check is not '#']
stdout@writeline(line)
complete
complete
complete
stdin@close(empty)
stdout@flush(empty)
stdout@eof(empty)
stdout@close(empty)
destroy {stdin, stdout}
exit(empty)
complete
fixed function->finish [no arguments, value is integer]
exit(0)
complete
Ranking
Rank | User | Size | Time | Date | Statistics |
---|
1 | clock | 30 | 0.0184 | 2012/08/02 07:19:47 | 0B / 19B / 10B |
2 | leonid | 30 | 0.0285 | 2012/08/02 09:56:26 | 0B / 19B / 10B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | tails | 31 | 0.0418 | 2012/08/09 21:03:23 | 0B / 10B / 19B |
2 | ais523 | 32 | 0.0109 | 2012/08/15 15:22:40 | 0B / ?B / ?B |
3 | shlomif | 34 | 0.0111 | 2012/08/13 03:16:49 | 0B / 10B / 21B |
4 | tanon | 35 | 0.0112 | 2012/08/11 18:27:51 | 0B / ?B / ?B |
5 | jonathan camacho | 37 | 0.0113 | 2014/01/19 05:32:03 | 0B / 11B / 23B |
6 | BioFALSE | 42 | 0.0217 | 2012/12/04 22:49:42 | 0B / 15B / 27B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | clock | 48 | 0.0175 | 2012/08/02 07:17:39 | 0B / 29B / 13B |
2 | hallvabo | 48 | 0.0188 | 2012/08/02 07:51:11 | 0B / 29B / 13B |
3 | leonid | 48 | 0.0263 | 2012/08/02 09:56:43 | 0B / 29B / 13B |
4 | twobit | 48 | 0.0203 | 2012/08/03 10:21:09 | 0B / 29B / 13B |
5 | Hendrik | 48 | 0.0166 | 2012/08/10 01:16:17 | 0B / 29B / 13B |
6 | recursive | 63 | 0.0198 | 2012/08/15 00:10:10 | 0B / 36B / 18B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | clock | 50 | 0.0226 | 2012/08/10 17:29:06 | 1B / 25B / 23B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | kaki | 59 | 0.0216 | 2013/03/25 05:17:11 | 0B / 22B / 37B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | pooq | 62 | 0.0881 | 2012/10/07 02:35:02 | 0B / 46B / 12B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | clock | 41 | 0.0191 | 2012/08/02 07:44:21 | 0B / 23B / 18B |
2 | 0mg | 41 | 0.0238 | 2012/08/02 16:02:54 | 0B / 23B / 18B |
3 | Hendrik | 41 | 0.0183 | 2012/08/10 15:40:18 | 0B / 23B / 18B |
4 | nn | 41 | 0.0168 | 2012/08/11 22:55:47 | 0B / 23B / 18B |
5 | Shmiddty | 41 | 0.0257 | 2013/12/20 13:51:42 | 0B / 23B / 18B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | clock | 45 | 0.0436 | 2012/08/14 16:04:48 | 0B / 22B / 23B |
2 | twobit | 60 | 0.0126 | 2012/08/03 10:29:30 | 0B / 36B / 22B |
3 | yamaya | 60 | 0.0108 | 2012/08/11 13:55:53 | 0B / 25B / 35B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | clock | 69 | 0.0221 | 2012/08/11 16:22:35 | 0B / 33B / 29B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | clock | 74 | 2.7849 | 2012/08/10 16:47:03 | 0B / 42B / 30B |
2 | teebee | 75 | 0.3164 | 2012/08/03 22:55:36 | 0B / 38B / 35B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | clock | 70 | 0.0113 | 2012/08/10 17:53:48 | 0B / 35B / 20B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | clock | 81 | 0.0103 | 2012/08/02 16:33:48 | 0B / 45B / 32B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | teebee | 41 | 0.0042 | 2012/08/03 07:51:01 | 0B / 8B / 32B |
2 | av | 47 | 0.0206 | 2012/08/03 08:51:20 | 0B / 9B / 37B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | clock | 40 | 0.0412 | 2012/08/02 08:15:13 | 0B / 23B / 13B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | nn | 26 | 0.0107 | 2012/08/11 20:22:12 | 0B / 4B / 18B |
2 | yamaya | 26 | 0.0108 | 2012/08/12 03:00:38 | 0B / 3B / 19B |
3 | clock | 28 | 0.0136 | 2012/08/12 02:25:16 | 0B / 5B / 21B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | clock | 25 | 0.0109 | 2012/08/02 07:54:13 | 0B / 5B / 19B |
2 | tails | 25 | 0.0157 | 2012/08/02 21:04:20 | 0B / 5B / 19B |
3 | teebee | 25 | 0.0110 | 2012/08/02 23:31:58 | 0B / 5B / 19B |
4 | nn | 25 | 0.0137 | 2012/08/03 20:57:57 | 0B / 5B / 19B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | yamaya | 26 | 0.0146 | 2012/08/14 14:14:40 | 0B / 11B / 12B |
2 | clock | 31 | 0.0135 | 2012/08/11 14:47:12 | 0B / 8B / 22B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | tails | 34 | 0.0945 | 2021/04/14 11:59:21 | 0B / 11B / 20B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | clock | 39 | 0.0058 | 2012/08/10 17:15:52 | 0B / 7B / 31B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | clock | 29 | 0.0157 | 2012/08/11 14:38:53 | 0B / 6B / 21B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | %20 | 225 | 0.0963 | 2016/07/23 15:25:26 | 0B / 0B / 0B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | tails | 29 | 0.1876 | 2012/08/10 21:16:07 | 0B / 6B / 23B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | clock | 15 | 0.0466 | 2012/08/02 15:16:49 | 0B / 2B / 13B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | clock | 24 | 0.2335 | 2012/08/14 15:50:12 | 0B / 9B / 11B |
2 | nn | 26 | 0.0143 | 2012/08/11 23:33:41 | 0B / 9B / 14B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | clock | 49 | 1.0900 | 2012/08/03 14:25:11 | 0B / 31B / 18B |
2 | nn | 49 | 0.9963 | 2012/08/11 23:02:28 | 0B / 32B / 17B |
Language Ranking_
Rank | Lang | User | Size | Score |
1 | Jelly | Erik the Outgolfer | 14 | 10000 |
2 | FlogScript | clock | 15 | 9333 |
3 | Vim | clock | 24 | 5833 |
4 | sed | clock | 25 | 5600 |
5 | AWK | nn | 26 | 5384 |
6 | Bash | yamaya | 26 | 5384 |
7 | GolfScript | tails | 29 | 4827 |
8 | xgawk | clock | 29 | 4827 |
9 | Ruby | clock | 30 | 4666 |
10 | Perl | tails | 31 | 4516 |
11 | Bash (builtins) | tails | 34 | 4117 |
12 | wake | clock | 39 | 3589 |
13 | REBOL | clock | 40 | 3500 |
14 | JavaScript | clock | 41 | 3414 |
15 | K | teebee | 41 | 3414 |
16 | Lua | clock | 45 | 3111 |
17 | Python | clock | 48 | 2916 |
18 | Groovy | clock | 49 | 2857 |
19 | J | I., S. | 50 | 2800 |
20 | PHP | clock | 50 | 2800 |
21 | Scheme | kaki | 59 | 2372 |
22 | Io | pooq | 62 | 2258 |
23 | Tcl | clock | 69 | 2028 |
24 | SNOBOL | clock | 70 | 2000 |
25 | Haskell | henkma | 74 | 1891 |
26 | Kite | clock | 74 | 1891 |
27 | Icon | clock | 81 | 1728 |
28 | C | david_werecat (Y.OHNO) | 105 | 1333 |
29 | C# | Hendrik | 120 | 1166 |
30 | Whitespace | %20 | 225 | 622 |
return to the top page