I/O
##I/O YourYour program should take an input file along with a number designating how many spaces are used to indent a block. Here's an example:
The meat of the program
##The meat of the program
BlocksBlocks open with : and each line within the block is indented using the block delimiter, like Python code.
Examples
##Examples Input:
Scoring
##Scoring TheThe code with the least amount of bytes wins!
##I/O Your program should take an input file along with a number designating how many spaces are used to indent a block. Here's an example:
##The meat of the program
Blocks open with : and each line within the block is indented using the block delimiter, like Python code.
##Examples Input:
##Scoring The code with the least amount of bytes wins!
I/O
Your program should take an input file along with a number designating how many spaces are used to indent a block. Here's an example:
The meat of the program
Blocks open with : and each line within the block is indented using the block delimiter, like Python code.
Examples
Input:
Scoring
The code with the least amount of bytes wins!
Make my pseudocode real
I've got some Java pseudocode that uses whitespace instead of curly braces, and I want you to convert it.
##I/O Your program should take an input file along with a number designating how many spaces are used to indent a block. Here's an example:
$ convert.lang input.p 4 // Convert using 4 spaces as the block delimiter $ convert.lang input.p 2 // Convert using 2 spaces as the block delimiter
It should then convert the result using the specified block delimiter and output the result to stdout.
##The meat of the program
Blocks open with : and each line within the block is indented using the block delimiter, like Python code.
while(true):
System.out.println("Test");
Each : is replaced with a {, and a } is appended to the end of the block.
while(true) {
System.out.println("Test");
}
##Examples Input:
public class Test:
public static void main(String[] args):
System.out.println("Java is verbose...");
Output:
$ convert Test.pseudojava 4
public class Test {
public static void main(String[] args) {
System.out.println("Java is verbose...");
}
}
Input:
main():
printf("Hello World");
Output:
$ convert test.file 2
main() {
printf("Hello World");
}
Input:
def generic_op(the_stack, func): # Generic op handling code b = the_stack.pop() if isinstance(b, list): if b: return top = b.pop(0) while b: top = func(top, b.pop(0)) the_stack.push(top) else: a = the_stack.pop() return func(a, b)
Output:
$ convert code.py 4
def generic_op(the_stack, func){
# Generic op handling code
b = the_stack.pop()
if isinstance(b, list) {
if b {
return
}
top = b.pop(0)
while b {
top = func(top, b.pop(0))
}
the_stack.push(top)
}
else {
a = the_stack.pop()
return func(a, b)
}
}
##Scoring The code with the least amount of bytes wins!