exercism / elm

Exercism exercises in Elm.
https://exercism.org/tracks/elm
MIT License
134 stars 108 forks source link

Parse tags from student solutions #632

Open ceddlyburge opened 10 months ago

ceddlyburge commented 10 months ago

Related to this comment, it would be good to parse the tags for the solution from the Elm code that a student submits.

We already parse the code in to an abstract syntax tree in the representer and I think analyser, so although it will be a big job, it shouldn't be too ridiculous.

We would need to chat with Exercism about what tags should map to what parts of the elm syntax, and about how we should report the tags.

jiegillet commented 10 months ago

I looked into the list of tags and thought a little. Here is my brain dump.

There are many tags that will never be relevant (paradigm:imperative, construct:class, construct:do-while-loop...) and that's fine.

There are a few tags that will always be relevant (paradigm:functional, technique:immutability...) and that's fine, although I do wonder what effect always-present tags would have on the AI model.

There are some tags that are a bit vague (technique:exceptions, technique:enumeration, technique:type-conversion...) because they have an equivalent (Result, map, toFloat) but it's not quite the same thing as in C#.

There are some tags that have the wrong name but the concepts are equivalent (construct:switch = case, construct:null = Nothing?), we might have to bite the bullet on that.

There are some Elm concepts that don't have established tags like optional type, opaque type (maybe construct:visibility-modifiers works for that?) that we could use in the uses: tags.

It's often conceptually easy to map from tags to Elm functions/expressions:

However, if we will be traversing an AST, what we need is the reverse map from the list above: Elm expression => tag.

Some concepts will require more than just a simple traversal, like technique:recursion.

I would highly recommend using elm-review for this use, it makes it really easy to check which modules functions are from, even if they were aliased or whatever. That's what is used in the analyzer. We could use the data extractor function (I haven't used it yet, but it's a textbook use for it).

jiegillet commented 10 months ago

@ceddlyburge @mpizenberg if you want to have a meeting about this, I would love join. My absolute best time for meetings is Saturday mornings (Japan time) because the kids are at their grandmas, but now I realize that's the middle of the night for Europe. Then second best is Friday evenings (Japan time).

ceddlyburge commented 9 months ago

Hi @jiegillet @mpizenberg @ErikSchierboom , Japan is 9 hours ahead of the UK, so 8pm japan would be 11am UK, and 12pm in France, would that work for everybody? I could take lunch at that time and fit in a meeting about this most fridays.

jiegillet commented 9 months ago

That would be great for me :) Otherwise, I could also do after at 9 or 10PM Saturdays or Sundays.

mpizenberg commented 9 months ago

Hi, yes that works for me too.

ErikSchierboom commented 9 months ago

Yes that would be fine. Could you send a meeting request?

ceddlyburge commented 9 months ago

I've sent a meeting request to everybody's email addresses, please let me know if you don't receive it ...

ceddlyburge commented 9 months ago

@ErikSchierboom , do you have a full list of the existing tags? I think it will be useful to put them in a spreadsheet ready for the meeting on friday ...

ErikSchierboom commented 9 months ago

construct:abstract-class construct:abstract-method construct:add construct:add-assignment construct:array construct:as-cast construct:assignment construct:async-await construct:attribute construct:auto-implemented-property construct:big-integer construct:binary-number construct:bit-array construct:bitwise-and construct:bitwise-and-assignment construct:bitwise-not construct:bitwise-or construct:bitwise-or-assignment construct:bitwise-xor construct:bitwise-xor-assignment construct:boolean construct:break construct:byte construct:catch construct:catch-filter construct:char construct:checked construct:checked-expression construct:class construct:collection-initializer construct:comment construct:conditional-access construct:const construct:constructor construct:continue construct:conversion-operator construct:date-time construct:decimal construct:default construct:default-interface-implementation construct:delegate construct:dictionary construct:divide construct:divide-assignment construct:do-loop construct:double construct:enum
construct:equality construct:event construct:event-handler construct:event-subscription construct:event-unsubscription construct:explicit-conversion construct:expression-bodied-member construct:extension-method construct:field construct:file-scoped-namespace construct:finally construct:flags-enum construct:float construct:floating-point-number construct:foreach construct:for-loop construct:generic-method construct:generic-type construct:getter construct:hexadecimal-number construct:if construct:implicit-array-creation construct:implicit-conversion construct:implicit-object-creation construct:implicit-stack-alloc construct:indexer construct:inequality construct:initializer construct:int construct:integral-number construct:interface construct:invocation construct:is-cast construct:jagged-array construct:lambda construct:left-shift construct:left-shift-assignment construct:linked-list construct:linq construct:list construct:local-function construct:lock construct:logical-and construct:logical-not construct:logical-or construct:logical-xor construct:long construct:method construct:method-overloading construct:method-override construct:modulo construct:modulo-assignment construct:multi-dimensional-array construct:multiline-string construct:multiply construct:multiply-assignment construct:named-argument construct:nameof construct:namespace construct:nested-type construct:nint construct:nuint construct:null construct:nullability construct:nullable construct:null-coalesce construct:null-coalesce-assignment construct:null-suppression construct:number construct:object-initializer construct:operator-overloading construct:optional-parameter construct:overflow construct:parameter construct:pattern-matching construct:postfix-decrement construct:postfix-increment construct:prefix-decrement construct:prefix-increment construct:property construct:query-expression construct:queue construct:read-only construct:record construct:return construct:right-shift construct:right-shift-assignment construct:sbyte construct:scientific-notation-number construct:set construct:setter construct:short construct:stack construct:stack-alloc-creation construct:string construct:string-interpolation construct:struct construct:subtract construct:subtract-assignment construct:switch construct:switch-expression
construct:ternary construct:throw construct:throw-expression construct:try construct:tuple construct:type-inference construct:uint construct:ulong construct:unary-minus construct:unary-plus construct:underscored-number construct:unsigned-right-shift construct:unsigned-right-shift-assignment construct:user-defined-event construct:user-defined-exception construct:ushort construct:using-directive construct:using-statement construct:varargs construct:variable construct:verbatim-string construct:virtual-method construct:visibility-modifiers construct:while-loop construct:with construct:xml-comment construct:yield paradigm:declarative paradigm:functional paradigm:imperative paradigm:object-oriented paradigm:reflective technique:bit-manipulation technique:bit-shifting technique:boolean-logic technique:compound-assignment technique:concurrency technique:defensive-copying technique:enumeration technique:equality-comparison technique:exceptions technique:higher-order-functions technique:immutability technique:immutable-collection technique:inheritance technique:laziness technique:locks technique:looping technique:memory-management technique:mutexes technique:ordering technique:parallelism technique:performance technique:pointers technique:randomness technique:recursion technique:regular-expression technique:short-circuiting technique:sorted-collection technique:sorting technique:type-conversion technique:unsafe