Posts by freundTech@mastodon.xyz
(DIR) Post #283564 by freundTech@mastodon.xyz
2018-09-29T10:10:49Z
0 likes, 0 repeats
@MightyPork Like amazon?
(DIR) Post #342090 by freundTech@mastodon.xyz
2018-10-02T21:55:22Z
0 likes, 0 repeats
Writing a compiler is hard!
(DIR) Post #344172 by freundTech@mastodon.xyz
2018-10-03T10:38:33Z
0 likes, 0 repeats
@MightyPork @cpsdqs js isn't much better, but at least you can't combine it with pointers there.Try running:var i = 10;for (var i = 0; i < 5; i++) { console.log(i);}console.log(i);(And yes I know that the using let instead of var fixes that)
(DIR) Post #350328 by freundTech@mastodon.xyz
2018-10-03T08:46:07Z
0 likes, 0 repeats
@cpsdqs Because I'm trying to create a language, that compiles to .mcfunction, a format used by minecraft datapacks.It's basically just a list of minecraft commands in a file, that can be run with /function <NAME>.I'm currently stuck on code generation for arithmetic expressions, as all of the resources I can find for that use a stack machine, however I can't think of a way to implement a stack with scoreboards, so I have to use an accumulator/register machine instead.
(DIR) Post #350329 by freundTech@mastodon.xyz
2018-10-03T19:32:00Z
0 likes, 0 repeats
@cpsdqs successfully compiled "test2 = test + 1" to scoreboard commands!
(DIR) Post #350830 by freundTech@mastodon.xyz
2018-10-03T19:42:52Z
0 likes, 0 repeats
@cpsdqs Well to be fair: I've been writing on it for 2 days now.Also I should clean up my code. It's already starting to get messy...
(DIR) Post #350832 by freundTech@mastodon.xyz
2018-10-03T19:52:13Z
0 likes, 0 repeats
@cpsdqs python... Maybe not the fastest language, but fast to write. Also lark-parser is a great python library for parsing context-free grammars.
(DIR) Post #350834 by freundTech@mastodon.xyz
2018-10-03T20:06:40Z
0 likes, 0 repeats
@cpsdqs There are different types of languages, which require different automata to parse.The most simple are regular languages, which can be described using regular expressions and parsed using a finite state automaton.Then there are context-free languages, describes by context-free grammars. Most programming languages are context-free languages. They can't be described by regular expressions.Then there context-sensitive and recursively enumerable languages.
(DIR) Post #350836 by freundTech@mastodon.xyz
2018-10-03T20:18:44Z
0 likes, 0 repeats
@cpsdqs There's a lot more to explain about that. For example how those grammars work and how to do the actual parsing.For example regular expressions are defined as such:∅ (empty set) is a regular expression𝜀 (empty word) is a regular expressionAll a ∈ Σ (set of terminals/letters) are regular expressionsIf α and β are regexs then αβ, (α|β) and (α)* are also regexs.Every regex can be describes using only those rules. Modern languages just add stuff to make writing them easier.
(DIR) Post #350990 by freundTech@mastodon.xyz
2018-10-03T20:38:03Z
0 likes, 0 repeats
@MightyPork Formal languages are an interesting topic! ^^
(DIR) Post #572287 by freundTech@mastodon.xyz
2018-10-16T16:01:06Z
0 likes, 0 repeats
@MightyPork Because lots of people think they know how write software that doesn't suck, when they really don't.Nobody knows that.
(DIR) Post #572302 by freundTech@mastodon.xyz
2018-10-16T16:01:59Z
0 likes, 0 repeats
@MightyPork Because lots of people think they know how to write software that doesn't suck, when they really don't.Nobody knows that.