Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Antsan

Pages: [1] 2 3 4
1
Design / Re: Unique RL idea with evolving world
« on: August 30, 2016, 07:29:03 AM »
One idea to manage difficulty would be to make all remaining missions harder when one is completed. The evil that arose is now more aware of the heroes and prepares accordingly.
If you want that to seem realistic, maybe move evils out of the world map into the dungeons – the overworld becomes less dangerous, the dungeons more.

2
Programming / Re: DIY programming language
« on: August 29, 2016, 04:03:23 PM »
Any given language can be compiled into Java bytecode if you write a compiler that does it. There is no arcane barrier that prevents you from writing a compiler for compiling C, C++, Common Lisp, Scheme, Haskell, Prolog, Forth or any other arbitrary language into JVM bytecode – there is no need to use a detour over a compiler that first compiles into Java. It's probably about as hard as writing a compiler which compiles any of these languages into x86 or x86_64 or whatever other assembly.

Yes, there aren't compilers for all languages into Java bytecode. Just as there aren't compilers for every language into C or Assembly. That doesn't tell you anything about the language, though.
What a language compiles (translates) into is not a property of the language but of the compiler used. If a given compiler does not exist, you can write it.

3
Programming / Re: DIY programming language
« on: August 29, 2016, 12:57:01 PM »
The code run by the JVM is not Java. It's bytecode that has exactly nothing in common with Java at all.

Read the first line of text in Wikipedia:
"A Java virtual machine (JVM) is an abstract computing machine that enables a computer to run a Java program."

..to run a Java program.
..a Java program.
..Java..
At the end of that same pararaph:
Quote
An instance of a JVM is an implementation running in a process that executes a computer program compiled into Java bytecode.
Quote
a computer program compiled into Java bytecode.
Quote
compiled into Java bytecode.
Quote
Java bytecode.
Quote
bytecode

So, what's Java bytecode?
Quote
Java bytecode is the instruction set of the Java virtual machine. Each bytecode is composed of one, or in some cases two bytes that represent the instruction (opcode), along with zero or more bytes for passing parameters.
Hmmm… One or two bytes per instruction. Somehow that doesn't sound like Java at all, since Java isn't instruction based. I think the language doesn't even have a concept called an "instruction".
Also:
Quote
A Java programmer does not need to be aware of or understand Java bytecode at all. However, as suggested in the IBM developerWorks journal, "Understanding bytecode and what bytecode is likely to be generated by a Java compiler helps the Java programmer in the same way that knowledge of assembly helps the C or C++ programmer."[2]
Seems the relationship between Java and Java bytecode is roughly the same as the relation between C++ and Assembly.

Here's an example of Java bytecode in human-readable instead of binary form:
Code: [Select]
0:   iconst_2
1:   istore_1
2:   iload_1
3:   sipush  1000
6:   if_icmpge       44
9:   iconst_2
10:  istore_2
11:  iload_2
12:  iload_1
13:  if_icmpge       31
16:  iload_1
17:  iload_2
18:  irem
19:  ifne    25
22:  goto    38
25:  iinc    2, 1
28:  goto    11
31:  getstatic       #84; // Field java/lang/System.out:Ljava/io/PrintStream;
34:  iload_1
35:  invokevirtual   #85; // Method java/io/PrintStream.println:(I)V
38:  iinc    1, 1
41:  goto    2
44:  return
Huh, it doesn't even look like Java at all.

Being a self-taught Cowboy programmer is nice and all, but if you're missing formal education you'll have to be more careful when reading and talking about stuff you're new to.

4
Programming / Re: DIY programming language
« on: August 29, 2016, 10:25:15 AM »
I can't think of any reason you couldn't compile any language against the JVM environment

Well you can't. Unless you write a compiler to compile C++ (or whatever) to Java first.
The code run by the JVM is not Java. It's bytecode that has exactly nothing in common with Java at all. The only connection they share is that Java was the first language to be compiled into that form of bytecode. So no, you don't need to compile anything to Java to run it on the JVM.

5
Programming / Re: DIY programming language
« on: August 28, 2016, 08:02:09 PM »
http://brew.sh/
Code: [Select]
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"Seems you need ruby. ;D

But seriously though, you actually might try compiling yourself. The Ruby page says this about compiling:
Quote
Of course, you can install Ruby from source. Download and unpack a tarball, then just do this:

Code: [Select]
$ ./configure
$ make
$ sudo make install

By default, this will install Ruby into /usr/local. To change, pass the --prefix=DIR option to the ./configure script.

Using the third-party tools or package managers might be a better idea, though, because the installed Ruby won’t be managed by any tools.
No idea whether these instructions work for OS X. There is no mention of any dependencies.
Is make normally installed on OS X?

Actually, OS X supposedly comes with ruby preinstalled. Installing homebrew and installing ruby with that might still be a good idea, though – the preinstalled version is probably very much out-of-date.

6
Programming / Re: DIY programming language
« on: August 28, 2016, 05:43:20 PM »
The official page says that you can install Ruby via homebrew like this:
Code: [Select]
$ brew install ruby
https://www.ruby-lang.org/en/documentation/installation/#homebrew

This should install all dependencies automatically.
Are you trying to compile yourself? This almost always requires all kinds of dependencies, even on Windows. The equivalent to using an installer is doing it with a package manager like homebrew.

7
Programming / Re: DIY programming language
« on: August 21, 2016, 08:07:58 PM »
You do realize it's executing java code.
It's executing byte code, not Java code. Just like a x86 processor isn't executing C code but assembly. Of course the JVM is a virtual machine, so it isn't as physical as a processor, but the principle is the same: Java is compiled into a specific form of byte code that is not Java anymore and executable by the JVM. The JVM cannot execute Java code directly – Java code needs to be compiled first. Just like C code or C++ code or whatever other code needs to be compiled to assembly before it can be executed on the processor with an interpreter.
You know, it's the Java Virtual Machine, not the Java Interpreter.

I despise Java probably a bit more than the next guy. Still, the fact that a language is running on the JVM doesn't tell you anything about the language at all. Prolog is running on the x86 (among other things) and yet it has almost nothing in common with assembly or C.

8
Programming / Re: DIY programming language
« on: August 21, 2016, 04:13:44 PM »
Scala very likely does not require Java but the JVM.

JVM is java.
Nope. JVM is the Java Virtual Machine, which is, well, a virtual machine executing byte code. Java is a programming language that is normally compiled into byte code which can be executed with the Java Virtual Machine.

9
Programming / Re: DIY programming language
« on: August 21, 2016, 02:49:55 PM »
Parlor tricks with syntax or esoteric features are fun to talk about, but not particularly useful in evaluating a language.

I don't think syntax is a trick. For example I don't like lisp's syntax and probably never will. But I need to try some other language than C++. It's not going to be Scala though, since I learned it requires java and I dislike java.
Scala very likely does not require Java but the JVM.

10
Programming / Re: DIY programming language
« on: August 20, 2016, 11:08:45 AM »
I a truly in awe of your overbearing competence in the field of programming languages and their use.

11
Off-topic (Locked) / Re: The bullshitty rules of 12 bay games.
« on: August 02, 2016, 12:22:23 PM »
Can't find the topic, so I can't see whether you're right or not.

Up in your screenshot it says "ban requested by user", so I'd wager it's not actually about posting sexual content.

12
Off-topic (Locked) / Re: The bullshitty rules of 12 bay games.
« on: August 02, 2016, 09:26:30 AM »
If you're gonna ignore the rules you're gonna be banned. If you hhad bothered reading the rules, you'd know that creating accounts to dodge bans is a bannable offense.

Really, I get the feeling you're just fishing for attention. Wanting attention isn't bad, but maybe you should try to get it at a place where you are wanted.

13
Programming / Re: DIY programming language
« on: August 02, 2016, 09:22:06 AM »
Rationals are in Common Lisp. Most languages don't bother with them because for a long time they were too inefficient. Also the precision the offer is mostly not needed.
Common Lisp also has complex numbers. Matrices and complex nmbers, as opposed to integers and floats, are not generally useful but only in certain domains. Putting them in the base language looks like overkill. Matrices have the additional problem of not being one but infintely many datatypes, that is, they'd need to be a parametrized data types.

Some programmming languages (not C/C++ though) were also built with the idea of keeping the base language as small as possible. Notably these languages are mostly built by people with an academic background, because building a minimal language requires way more thought and knowledge about mathematics than building one that just already has everything you want built in.
So, when a mathematician builds a language that is made as a programming language instead as a tool for a certain mathematical field, it is more likely to include less constructs instead of more.

14
Programming / Re: DIY programming language
« on: July 27, 2016, 03:15:07 PM »
Quote
3. More like range in Ada: range 1..10 means the integer can be only from 1 to 10. Simple, easy, safe.
Yep, (integer 0 10) is exactly the same in Common Lisp. There's also (real 0 10), for instance, which would include numbers like 2/7 and 0.734.

Quote
6. Why have 'auto' at all? Why not just determine the type? a=10; //int, a=1.0; //floating point, a="string"; //string
Don't know. To tell the compiler that a new variable is declared, probably.

Quote
I've written small things in Racket (or Scheme, I have some confusion about the difference), which, as far as I can tell, is a descendant of Lisp.
Racket is an implementation of Scheme with various enhancements not in the Scheme standard.
Scheme is a Lisp dialect.
Lisp is not a single language, but a language family. When people say "Lisp" to denote a single language, they probably mean "Common Lisp", although in Lisp circles this is not well-received.

Quote
For stranger syntax, assuming you haven't already, maybe look into Cat or Forth? I have heard/read that writing your own "forth style" language is fairly easy
Forth is awesome. Unfortunately I haven't taken the time to really learn it. I think it's not for Krice, though, since it hasn't types at all – at least as long you don't implement them yourself.

15
Programming / Re: DIY programming language
« on: July 27, 2016, 11:31:55 AM »
That sounds reasonable.

1. Common Lisp has multiple number types, but there is the general type "integer", which is a bignum internally – that is, size of integers is only bounded by memory size.
2. I disagree with this one. Having characters distinct from strings of length one ensures that type checks can be made at compilation time whether setting a single character in a string actually works as intended. What would it mean to set the third character in a string to "foo"?
3. Also in Common Lisp. "(integer -5)" is the type of all integers >=-5. "(integer * 20)" is the type of all integers <=20. "(integer -3000 524)" is the type of all integers x with -3000<=x<=524. Ranges can be made exclusive by wrapping the open bound in parenthesis, like this: "(integer (6))", which is the type of all integers >6. Arbitrary numbers chosen to show that this is not limited to a special subset of numbers.
4. See (3). This also is in C++: Use "unsigned int".
5. I see that this is desirable. When you declare types for variables in Common Lisp, this is enforced. Normally variables don't have types, though, they take just any value you give them. Values themselves still always have types.
6. In C++ you can use the "auto" keyword in place of a specific type. The compiler then infers the type for you. In Common Lisp it's the values that have types, not the variables.
7. Don't know any language that works this way. Haskell is purely functional so mutable variables require a special context either way, but I doubt this is what you want. I hear Clojure is big in immutable structures, but once again this is not about variables being constant but rather the values themselves being immutable. Given that you probably work mostly inside structures and shouldn't tamper around with freely dangling variables that much either way, I think this might be what you're looking for. I have no experience at all with Clojure, though.

Pages: [1] 2 3 4