lhartikk / arnoldc Goto Github PK
View Code? Open in Web Editor NEWArnold Schwarzenegger based programming language
Home Page: lhartikk.github.io/ArnoldC/
License: Apache License 2.0
Arnold Schwarzenegger based programming language
Home Page: lhartikk.github.io/ArnoldC/
License: Apache License 2.0
Consider the following contrived example:
IT'S SHOWTIME
HEY CHRISTMAS TREE var
YOU SET US UP @I LIED
GET TO THE CHOPPER var
HERE IS MY INVITATION 1
HE HAD TO SPLIT 0
ENOUGH TALK
TALK TO THE HAND var
YOU HAVE BEEN TERMINATED
I get:
Exception in thread "main" java.lang.ArithmeticException: / by zero
at hello.main(Hello.java)
I would expect something like:
HERE'S YOUR SUBZERO, NOW PLAIN ZERO
To calculate odd and even numbers:
a = b % 2
It would be nice to have an ability to pass a few arguments to Print to concatenate them like the following:
TALK TO THE HAND "F( " n ")=" m
Attempting an assignment using logical operations (including CONSIDER THAT A DIVORCE, KNOCK KNOCK, and YOU ARE NOT YOU YOU ARE ME) breaks use of variables defined before the assignment. Compiles fine, byte code is broken.
Minimal reproducing code:
IT'S SHOWTIME
HEY CHRISTMAS TREE one
YOU SET US UP 0
HEY CHRISTMAS TREE two
YOU SET US UP @I LIED
GET TO THE CHOPPER two
HERE IS MY INVITATION @I LIED
YOU ARE NOT YOU YOU ARE ME @I LIED
ENOUGH TALK
TALK TO THE HAND one
YOU HAVE BEEN TERMINATED
ALLOW ME TO BREAK THE ICE
Allow combining of variables and strings when printed
I hope it isn't out of line for me to post this.
https://gist.github.com/FracturedRetina/9712751
Current functionality:
An ArnoldC program is given as an input to the compiler. Java Bytecode is generated. The generated Java Bytecode has to be run with a second command.
Desired functionality:
The default functionality compiles and runs the program. Additional flags can be given if only the Bytecode is desired.
http://projecteuler.net/problem=1
Solve with ArnoldC.
I love ArnoldC and have been experimenting with it for a bit, but I have come across several scenarios where I have tried to run my program and got lengthy errors regarding inconsistent stackmap frames.
For example,
Exception in thread "main" java.lang.VerifyError: Inconsistent stackmap frames at branch target 75
Exception Details:
Location:
lfib.main([Ljava/lang/String;)V @75: return
Reason:
Type top (current frame, locals[5]) is not assignable to integer (stack map, locals[5])
Current Frame:
bci: @23
flags: { }
locals: { integer, integer, integer, integer, integer }
stack: { integer }
Stackmap Frame:
bci: @75
flags: { }
locals: { integer, integer, integer, integer, integer, integer }
stack: { }
Bytecode:
0000000: 1100 193b 1100 003c 1100 003d 1100 013e
0000010: 1100 0136 0415 0499 0034 1100 0036 051c
0000020: 1d60 3605 b200 1115 05b6 0017 1d3d 1505
0000030: 3e1b 3c1a 1ba3 0007 03a7 0007 04a7 0003
0000040: 3604 1b11 0001 603c a7ff cdb1
Stackmap Table:
full_frame(@21,{Integer,Integer,Integer,Integer,Integer},{})
full_frame(@60,{Integer,Integer,Integer,Integer,Integer,Integer},{})
same_locals_1_stack_item_frame(@64,Integer)
same_frame(@75)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2531)
at java.lang.Class.getMethod0(Class.java:2774)
at java.lang.Class.getMethod(Class.java:1663)
at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
Code causing this error: https://gist.github.com/brandonio21/be36c230748e6d530027#file-lfib25
It would be nice to have FOR in ArnoldC.
My suggestion is
TRUST ME
To be able to do all logical functions a not function is needed.
I might suggest:
NOT TO BE
GET TO THE CHOPPER should be GET TO THE CHOPPA
Thanks
Solve Project Euler problems using ArnoldC.
https://projecteuler.net/problems
https://github.com/lhartikk/ArnoldC/wiki/Project-Euler-Solutions
How about a method like "PUT THAT var DOWN" to dispose/delete an object?
My suggestion is YOU'RE LUGGAGE! https://www.youtube.com/watch?v=jC1vAvbGSNw
C:\Windows\system32>java -jar ArnoldC.jar hello.arnoldc
Error:Exception in thread "main" org.parboiled.errors.ParsingException: WHAT THE FUCK
DID I DO WRONG:
Invalid input '-', expected Root (line 1, pos 1):
-e "IT'S SHOWTIME\nTALK TO THE HAND "hello world"\nYOU HAVE BEEN TERMINATED"
^
at org.arnoldc.ArnoldParser.parse(ArnoldParser.scala:191)
at org.arnoldc.ArnoldGenerator.generate(ArnoldGenerator.scala:8)
at org.arnoldc.ArnoldC$.main(ArnoldC.scala:20)
at org.arnoldc.ArnoldC.main(ArnoldC.scala)
What did I miss doing?
Hello,
I'm new to the whole scala/JVM stuff but I managed to create a JAR file following the instructions from here: http://www.scala-sbt.org/release/docs/Getting-Started/Welcome.html . However I'm still having trouble getting the compiler to run (on Ubuntu 13.10).
I installed scala
# apt-get install scala
installed sbt from the deb source above
and in the project folder I ran
# sbt
> compile
> package
now I have a JAR file but when I try to run I get an exception:
misel@miles:~/code/ArnoldC$ java -jar target/scala-2.10/arnoldc_2.10-0.1.jar hello.arnoldc
Exception in thread "main" java.lang.NoClassDefFoundError: scala/io/Source$
at org.arnoldc.ArnoldC$.main(ArnoldC.scala:12)
at org.arnoldc.ArnoldC.main(ArnoldC.scala)
Caused by: java.lang.ClassNotFoundException: scala.io.Source$
Do you have any ideas what's the problem might be?
And maybe a guide like this might be helpful in the README.md :)
Regards,
Stefan
I don't see any mechanism to read input (from file, console, anything), would be cool to have
It would be perhaps useful to have an ability to sleep for a period of seconds. Something like:
(DON'T DISTURB MY FRIEND) HE'S DEAD TIRED
Awesome job guys, this stuff is hilarious!
I noticed a few keywords missing though. Here are my humble suggestions:
break: "If it bleeds we can kill it"
modulo (%): "I let him go"
null: "You're one ugly muthafucka"
static: "Stick around" (if you implement object oriented code)
Could ArnoldC be expressed as C macros, or is the Scala doing something more sophisticated?
There are certain cases where a try/catch statement would allow more sophisticated behaviors. Arnold would be quite pleased with more powerful programs, so we should consider this proposal seriously. My thoughts:
try: I LET HIM GO
catch: IT'S NOT A TUMOR
COME WITH ME IF YOU WANT TO LIVE
https://www.youtube.com/watch?v=m6z4yiq4_K8#t=13
Propose the following syntax:
COME WITH ME IF YOU WANT TO LIVE
[statements]
HE'LL LIVE [exception]
[statements in catch block]
TERMINATED
Seeing that all other commands are punctuated, it makes sense to put commas in appropriate places in this command.
In current implementation the mutable symboltable is passed in code-generation phase from the AST nodes and updated accordingly.
--> CHANGE TO
Symboltable to immutable. Each AST node resolves it's variables/symbols which can then be passed upwards.
As of yet, ArnoldC has no method for generating random numbers.
Tavi Rider on reddit suggested I WAS ELECTED TO LEAD NOT TO READ
As new features/bugfixes are introduced a way to find the version number of the compiler must found.
e.g.
java -jar ArnoldC.jar -version
0.1
For instance:
IT'S SHOWTIME
TALK TO THE HAND "hello world"
YOU HAVE BEEN TERMINATED
or something more "arnold specific"
Hi again,
every language needs an implementation of 99 bottles of beer so I created one here.
https://gist.github.com/misel228/9705395
Since this is my first project in this new language I figured I let the seniors have a look at it before I post it on www.99-bottles-of-beer.net/
So what do you think?
Regards,
Misel
I suggest we deprecate GET UP
and go with GIVE YOU A LIFT
Personally I don't think we're at a stage where breaking changes are automatically veto'd. Push comes to shove, we can maintain backward compatibility by keeping both.
Users who believe this change will cause their production systems an unacceptable time, please speak now.
I propose "I need a vacation" for the break operator
It would be good to have an ability to compile and execute ArnoldC source directly with one command. It can be look like the following:
java -jar ArnoldC.jar -run hello.arnoldc
and compile source with the following command:
java -jar ArnoldC.jar -compile hello.arnoldc
instead of
java -jar ArnoldC.jar hello.arnoldc
java hello
Current situation:
The compiler outputs the default Parboiled error messages about expected input when something unexpected input is countered.
Desired situation:
-Giving more semantic meaning to the error messages
-Did you mean messages to help the user:
e.g. the user types ITS SHOWTIME ->did you mean IT'S SHOWTIME
Reproducable with:
IT'S SHOWTIME
HEY CHRISTMAS TREE var
YOU SET US UP @I LIED
GET TO THE CHOPPER var
HERE IS MY INVITATION @NO PROBLEMO
KNOCK KNOCK 1
KNOCK KNOCK 0
ENOUGH TALK
TALK TO THE HAND var
YOU HAVE BEEN TERMINATED
Current situation:
If the generated Java bytecode by the ArnoldGenerator is erroneous e.g. stack map frame errors occur the test run gets deadlocked.
Desired functionality:
The test detects that the program is stuck and reports something reasonably. Most importantly goes on with the next tests.
It will be nice to see the String type and also some corresponding operations, such as concatenation of strings with each other.
I tried to write a recursive factorial function, the compiler did not complain, but when i tried to run it, jvm threw an exception when loading the class file
Exception in thread "main" java.lang.VerifyError: Inconsistent stackmap frames at branch target 39 in method fact.fact(I)I at offset 16
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2521)
at java.lang.Class.getMethod0(Class.java:2764)
at java.lang.Class.getMethod(Class.java:1653)
at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
and here's the source of the factorial method & main:
IT'S SHOWTIME
HEY CHRISTMAS TREE f
YOU SET US UP 1
GET YOUR ASS TO MARS f
DO IT NOW fact 5
TALK TO THE HAND f
YOU HAVE BEEN TERMINATED
LISTEN TO ME VERY CAREFULLY fact
I NEED YOUR CLOTHES YOUR BOOTS AND YOUR MOTORCYCLE n
GIVE THESE PEOPLE AIR
HEY CHRISTMAS TREE m
YOU SET US UP 1
HEY CHRISTMAS TREE f
YOU SET US UP 1
BECAUSE I'M GOING TO SAY PLEASE n
I'LL BE BACK 1
BULLSHIT
GET TO THE CHOPPER m
HERE IS MY INVITATION n
GET DOWN 1
ENOUGH TALK
GET YOUR ASS TO MARS f
DO IT NOW fact m
GET TO THE CHOPPER f
HERE IS MY INVITATION f
YOU'RE FIRED n
ENOUGH TALK
I'LL BE BACK f
YOU HAVE NO RESPECT FOR LOGIC
HASTA LA VISTA, BABY
Please implement.
This is the best thing I have ever seen.
I wanted to send you an email saying so, but it looks like you don't post it on your profile (understandable). As you can probably tell from my profile, I work at Uber and think we need more people like you who write code like this.
Even if you're not looking to get recruited, you should come by the office and get a beer sometime. The world owes it to you for this.
Red Heat:
malloc: CAPITALISM
Predator:
free: YOU ARE ONE UGLY MOTHERFUCKER
Terminator:
exit: CHILL OUT DICKWAD
I think there are currently two "schools"
Arnold Driven Development (ADD)
Feature Driven Development (FDD)
Discuss!
Hi guys, I guess this is not a real issue and therefore this might not be the best way to reach you, but it's the easiest one I found.
I stumbled upon your programming language and found it very fun and hilarious, I strongly encourage you to check out this website which is a hub for "esoteric" programming languages, like yours:
http://99-bottles-of-beer.net/
Basically you just have to write a program that sings the famous song and place it there, so everyone can know about your language and see it in action :-)
Cheers!
Clearly this should be first priority.
I believe we should allow both punctuation marks in keywords, and phonetic affinity (e.g. IT'S NOT A TOOMAH!
over IT'S NOT A TUMOR!
over IT'S NOT A TUMOR
) as they correspond beautifully with ADD, which has been adopted as a fundamental guideline.
My vote goes for both.
People, cast your votes.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.