Overview
Wecode supports multiple programming languages for code submission. Each language is configured with default execution limits and file extensions.Supported languages
Out of the box, Wecode supports:- C (gcc compiler)
- C++ (g++ compiler)
- Java (OpenJDK with security policies)
- Python (2.x and 3.x)
- JavaScript (Node.js)
- Pascal (Free Pascal Compiler)
Language configuration
Each language has the following settings:Display name of the language (e.g., “Python 3”, “Java”)
File extension for submissions (e.g., “py”, “java”, “cpp”)
Default time limit in seconds for code execution
Default memory limit in megabytes
Display order in language selection dropdowns
Managing languages
Adding a new language
As an admin:- Navigate to Settings → Languages
- Click Add Language
- Configure the language settings
- Create compilation script in
tester/directory - Test with a sample submission
Editing language settings
To modify time or memory limits:- Go to Languages list
- Click Edit on the language
- Update default limits
- Save changes
Per-problem language configuration
When creating a problem, you can:- Select which languages are allowed
- Override default time/memory limits per language
- Set different limits for different languages
Compilation and execution
Compilation scripts
Each language has a compilation script intester/:
Execution flow
Resource limits
Time limits
- Purpose: Prevent infinite loops and excessive runtime
- Measurement: Wall-clock time with perl timing script
- Typical values: 1-10 seconds depending on problem complexity
Memory limits
- Purpose: Prevent memory exhaustion attacks
- Measurement: Peak memory usage in the Docker container
- Typical values: 64-512 MB depending on problem requirements
Output limits
- Purpose: Prevent disk fill attacks
- Default: Configured in
tester/runcode.sh - Effect: Output truncated if exceeded
Language-specific considerations
Python
- Both Python 2 and Python 3 supported
- Slower execution time → higher time limits recommended
- NumPy and common libraries available
Java
- Security manager enforced (
java.policy) - Class name must match filename
- Higher memory requirements
- Main class auto-detected
C/C++
- GCC compiler with standard flags
- Fastest execution times
- Can use standard library
API reference
Model: Language
Location:app/Models/Language.php
Relationships
Routes
| Method | URI | Action | Permission |
|---|---|---|---|
| GET | /languages | List all languages | Admin |
| GET | /languages/create | Show create form | Admin |
| POST | /languages | Store new language | Admin |
| GET | /languages/{language} | Show language details | Admin |
| GET | /languages/{language}/edit | Show edit form | Admin |
| PUT/PATCH | /languages/{language} | Update language | Admin |
| DELETE | /languages/{language} | Delete language | Admin |
Docker configuration
Each language requires:- Docker image with compiler/interpreter
- Compilation script in
tester/ - Security policies (especially for Java)
Best practices
Conservative limits
Start with conservative time/memory limits and increase only if needed. This prevents resource abuse.
Language fairness
Set time limits proportional to language speed (e.g., Python gets 3x C++ time) to ensure fairness.
Test thoroughly
Always test new language configurations with known-good sample code before using in assignments.
Document requirements
If you add non-standard libraries, document them in problem descriptions so students know what’s available.
Troubleshooting
Compilation errors
If all submissions fail to compile:- Check compilation script syntax
- Verify Docker image is available
- Test script manually in the
tester/directory
Time limit exceeded
If valid solutions hit time limits:- Run solution locally to measure actual time
- Consider language-specific multipliers
- Optimize test cases to avoid unnecessary overhead
Memory issues
If submissions crash with memory errors:- Check if problem actually requires more memory
- Verify limits are set correctly in language config
- Look for memory leaks in student code
Related documentation
- Docker sandboxing - Execution environment details
- Creating problems - Setting per-problem language limits
- Submissions - Submission and grading process
- Queue system - How submissions are processed

